-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b58a183
commit b7a57f2
Showing
9 changed files
with
176 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "pip" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "daily" | ||
# Add assignees | ||
assignees: | ||
- "superlopuh" | ||
commit-message: | ||
prefix: "pip prod" | ||
prefix-development: "pip dev" | ||
include: "scope" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# This workflow will install MLIR, Python dependencies, run tests and lint with a single version of Python | ||
|
||
name: CI - MLIR-based Testing | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the main branch | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
python-version: ['3.10', '3.11', '3.12', '3.13'] | ||
|
||
env: | ||
LLVM_SYMBOLIZER_PATH: /usr/lib/llvm-11/bin/llvm-symbolizer | ||
MLIR-Version: d401987fe349a87c53fe25829215b080b70c0c1a | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: xdsl | ||
fetch-depth: 2 | ||
|
||
- name: Install native dependencies | ||
uses: awalsh128/cache-apt-pkgs-action@latest | ||
with: | ||
packages: mesa-vulkan-drivers | ||
version: 1.0 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: "xdsl/uv.lock" | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
run: | | ||
# Change directory so that xdsl-opt can be found during installation. | ||
cd xdsl | ||
uv python install ${{ matrix.python-version }} | ||
- name: Install the package locally and nbval | ||
run: uv sync | ||
|
||
- name: Execute lit tests | ||
run: uv run lit -v tests/filecheck/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// RUN: xdsl-webgpu-run --index-bitwidth=32 %s | filecheck %s | ||
|
||
builtin.module attributes {gpu.container_module} { | ||
"gpu.module"() ({ | ||
"gpu.func"() ({ | ||
^0(%arg : memref<4x4xindex>): | ||
%0 = "arith.constant"() {"value" = 2 : index} : () -> index | ||
%1 = "gpu.global_id"() {"dimension" = #gpu<dim x>} : () -> index | ||
%2 = "gpu.global_id"() {"dimension" = #gpu<dim y>} : () -> index | ||
%3 = "arith.constant"() {"value" = 4 : index} : () -> index | ||
%4 = "arith.muli"(%1, %3) : (index, index) -> index | ||
%5 = "arith.addi"(%4, %2) : (index, index) -> index | ||
"memref.store"(%5, %arg, %1, %2) {"nontemporal" = false} : (index, memref<4x4xindex>, index, index) -> () | ||
"gpu.return"() : () -> () | ||
}) {"function_type" = (memref<4x4xindex>) -> (), | ||
"gpu.kernel", | ||
"sym_name" = "fill" | ||
} : () -> () | ||
"gpu.func"() ({ | ||
^0(%arg : memref<4x4xindex>): | ||
%0 = "arith.constant"() {"value" = 1 : index} : () -> index | ||
%1 = "gpu.global_id"() {"dimension" = #gpu<dim x>} : () -> index | ||
%2 = "gpu.global_id"() {"dimension" = #gpu<dim y>} : () -> index | ||
%3 = "memref.load"(%arg, %1, %2) {"nontemporal" = false} : (memref<4x4xindex>, index, index) -> (index) | ||
%4 = "arith.addi"(%3, %0) : (index, index) -> index | ||
"memref.store"(%4, %arg, %1, %2) {"nontemporal" = false} : (index, memref<4x4xindex>, index, index) -> () | ||
"gpu.return"() : () -> () | ||
}) {"function_type" = (memref<4x4xindex>) -> (), | ||
"gpu.kernel", | ||
"sym_name" = "inc" | ||
} : () -> () | ||
"gpu.module_end"() : () -> () | ||
}) {"sym_name" = "gpu"} : () -> () | ||
func.func @main() -> index { | ||
%four = "arith.constant"() {"value" = 4 : index} : () -> index | ||
%one = "arith.constant"() {"value" = 1 : index} : () -> index | ||
%memref = "gpu.alloc"() {"alignment" = 0 : i64, "operandSegmentSizes" = array<i32: 0, 0, 0>} : () -> memref<4x4xindex> | ||
"gpu.launch_func"(%four, %four, %one, %one, %one, %one, %memref) {"operandSegmentSizes" = array<i32: 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0>, "kernel" = @gpu::@fill} : (index, index, index, index, index, index, memref<4x4xindex>) -> () | ||
"gpu.launch_func"(%four, %four, %one, %one, %one, %one, %memref) {"operandSegmentSizes" = array<i32: 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0>, "kernel" = @gpu::@inc} : (index, index, index, index, index, index, memref<4x4xindex>) -> () | ||
%hmemref = "memref.alloc"() {"alignment" = 0 : i64, "operandSegmentSizes" = array<i32: 0, 0>} : () -> memref<4x4xindex> | ||
"gpu.memcpy"(%hmemref, %memref) {"operandSegmentSizes" = array<i32: 0, 1, 1>} : (memref<4x4xindex>, memref<4x4xindex>) -> () | ||
printf.print_format "Result : {}", %hmemref : memref<4x4xindex> | ||
%zero = "arith.constant"() {"value" = 0 : index} : () -> (index) | ||
"func.return"(%zero) : (index) -> () | ||
} | ||
} | ||
|
||
// CHECK-NEXT{LITERAL}: Result : [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import lit.formats | ||
import os | ||
|
||
config.test_source_root = os.path.dirname(__file__) | ||
xdsl_webgpu_src = os.path.dirname(os.path.dirname(config.test_source_root)) | ||
|
||
config.name = "xDSL WebGPU" | ||
config.test_format = lit.formats.ShTest(preamble_commands=[f"cd {xdsl_webgpu_src}"]) | ||
config.suffixes = ['.mlir'] | ||
|
||
# checking if maxIndividualTestTime is available on the platform and sets | ||
# it to 20sec if so, declares lit-max-individual-test-time feature for | ||
# further checking by tests. | ||
supported, errormsg = lit_config.maxIndividualTestTimeIsSupported | ||
if supported: | ||
config.available_features.add("lit-max-individual-test-time") | ||
lit_config.maxIndividualTestTime = 20 | ||
else: | ||
lit_config.warning( | ||
"Setting a timeout per test not supported. " | ||
+ errormsg | ||
+ " Some tests will be skipped." | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from xdsl.interpreter import Interpreter | ||
from xdsl.tools.xdsl_run import xDSLRunMain | ||
|
||
from xdsl_webgpu.interpreters.wgpu import WGPUFunctions | ||
|
||
|
||
class xDSLWebGPURunMain(xDSLRunMain): | ||
def register_implementations(self, interpreter: Interpreter): | ||
super().register_implementations(interpreter) | ||
interpreter.register_implementations(WGPUFunctions()) | ||
|
||
|
||
def main(): | ||
return xDSLWebGPURunMain().run() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |