diff --git a/.github/workflows/ci-gpu.yaml b/.github/workflows/ci-gpu.yaml index 198724b4c..7f6a51316 100644 --- a/.github/workflows/ci-gpu.yaml +++ b/.github/workflows/ci-gpu.yaml @@ -212,6 +212,17 @@ jobs: run: | pytest -n 4 --capture=tee-sys -vv ./tests/unittests/ + - name: Run LIT tests + env: + WAVE_TEST_WATER: ${{ '1' }} + WAVE_TEST_DWARFDUMP: ${{ env.IS_RDNA4 == 'false' && '1' || '0' }} + run: | + # TODO: mlir_converter tests segfault on mi35x + # TODO: can't sudo to install dwarfdump on rdna4 + echo "WAVE_TEST_WATER=$WAVE_TEST_WATER" + echo "WAVE_TEST_DWARFDUMP=$WAVE_TEST_DWARFDUMP" + lit lit_tests/ -a --filter=mlir_converter + - name: Test TKW runtime related stack on amdgpu if: ${{ env.HAS_GPU == 'true' }} run: | @@ -231,17 +242,6 @@ jobs: run: | WAVE_CACHE_ON=0 pytest -n 4 --timeout=600 --capture=tee-sys -vv --run-e2e --run-expensive-tests --durations=100 ./tests/kernel/ - - name: Run LIT tests - env: - WAVE_TEST_WATER: ${{ env.IS_CDNA3 == 'true' && '1' || '0' }} - WAVE_TEST_DWARFDUMP: ${{ env.IS_RDNA4 == 'false' && '1' || '0' }} - run: | - # TODO: mlir_converter tests segfault on mi35x - # TODO: can't sudo to install dwarfdump on rdna4 - echo "WAVE_TEST_WATER=$WAVE_TEST_WATER" - echo "WAVE_TEST_DWARFDUMP=$WAVE_TEST_DWARFDUMP" - lit lit_tests/ -v - - name: MyPy Type Checking run: | mypy diff --git a/lit_tests/kernel/wave/mlir_converter.py b/lit_tests/kernel/wave/mlir_converter.py index ac63ea959..a376e5866 100644 --- a/lit_tests/kernel/wave/mlir_converter.py +++ b/lit_tests/kernel/wave/mlir_converter.py @@ -1,5 +1,5 @@ # REQUIRES: water -# RUN: python %s | FileCheck %s +# RUN: python -v %s | FileCheck %s import sys diff --git a/wave_lang/kernel/wave/mlir_converter/mlir_converter.py b/wave_lang/kernel/wave/mlir_converter/mlir_converter.py index 71b67890d..21369f579 100644 --- a/wave_lang/kernel/wave/mlir_converter/mlir_converter.py +++ b/wave_lang/kernel/wave/mlir_converter/mlir_converter.py @@ -46,7 +46,7 @@ def emit_wave_dialect( errors produced by MLIR. """ - child = Path(__file__).with_name("water_emitter.py") + child = Path(__file__).with_name("water_emitter.py").resolve() if not child.exists(): raise RuntimeError(f"water emitter helper not found: {child}") @@ -76,6 +76,9 @@ def emit_wave_dialect( ) ) + print(output.decode("utf-8", errors="replace"), file=sys.stderr) + print(err.decode("utf-8", errors="replace"), file=sys.stderr) + if proc.returncode != 0: raise RuntimeError( f"water_emitter failed (code {proc.returncode}):\n" diff --git a/wave_lang/kernel/wave/mlir_converter/water_emitter.py b/wave_lang/kernel/wave/mlir_converter/water_emitter.py index e5433aa0c..58a22bba8 100644 --- a/wave_lang/kernel/wave/mlir_converter/water_emitter.py +++ b/wave_lang/kernel/wave/mlir_converter/water_emitter.py @@ -67,14 +67,38 @@ SHARED_ADDRESS_SPACE, ) +print("water_emitter imported", file=sys.stderr) + assert "iree" not in sys.modules, ( "IREE was transitively imported into the water emitter, " + "which will lead to MLIR library clashes. " + "Please clean up the import list so as not to import IREE." ) +print("past iree assertion", file=sys.stderr) + try: + import sys + import os + import hashlib + + for p in sys.path: + print(f"walking {p}", file=sys.stderr) + for root, dirs, files in os.walk(p): + for file in files: + if not file.endswith(".so"): + continue + path = (Path(root) / file).resolve() + with open(path, "rb") as f: + contents = f.read() + h = hashlib.sha256(contents).hexdigest() + print( + f"file: {root}/{file}, actual {str(path)}, {os.path.getsize(root + os.sep + file)}, hash={h}", + file=sys.stderr, + ) from water_mlir.water_mlir import ir + + print("past water_mlir import", file=sys.stderr) from water_mlir.water_mlir.dialects.wave import ( AddOp, AllocateOp, @@ -98,18 +122,34 @@ WaveMmaKindAttr, WaveWorkgroupDimAttr, ) + + print("past water_mlir.dialects import", file=sys.stderr) from water_mlir.water_mlir.sympy_to_affine_converter import ( convert_sympy_to_affine_map, ) + + print("past water_mlir.sympy_to_affine_converter import", file=sys.stderr) from water_mlir.water_mlir.dialects import arith + + print("past water_mlir.dialects.arith import", file=sys.stderr) from water_mlir.water_mlir.dialects import func + + print("past water_mlir.dialects.func import", file=sys.stderr) from water_mlir.water_mlir.dialects import wave + + print("past water_mlir.dialects.wave import", file=sys.stderr) from water_mlir.water_mlir.dialects import amdgpu + + print("past water_mlir.dialects.amdgpu import", file=sys.stderr) from water_mlir.water_mlir.dialects.transform import interpreter + + print("past water_mlir.dialects.transform.interpreter import", file=sys.stderr) except Exception as e: print(f"FATAL: failed to import water_mlir: {e}", file=sys.stderr) sys.exit(1) +print("past water_mlir imports", file=sys.stderr) + # Mapping from tkw_op_name to actual op constructors WAVE_OP_CONSTRUCTORS = { "add": AddOp, @@ -830,6 +870,8 @@ def _emit_from_captured_trace( if enable_debug_info and not trace.location: diagnostics.append("Missing debug location for wave trace") + print("inside emission", file=sys.stderr) + with ir.Context() as ctx, ( trace.location.to_water() if trace.location else ir.Location.unknown() ): @@ -895,6 +937,7 @@ def _emit_from_captured_trace( help="Test diagnostic serialization and deserialization through stdin and stdout", ) + print("emitter initialized", file=sys.stderr) args = parser.parse_args() trace, constraints, options, pipeline = _parse_input()