Created
April 6, 2025 23:47
-
-
Save saulshanabrook/8ceec4d3a1fda21deba61f7d50d64ebf to your computer and use it in GitHub Desktop.
mlir egglog logs
This file contains hidden or 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
$ uv run pytest -x | |
==================================================================== test session starts ==================================================================== | |
platform darwin -- Python 3.12.5, pytest-8.3.5, pluggy-1.5.0 | |
rootdir: /Users/saul/p/mlir-egglog | |
configfile: pyproject.toml | |
collected 15 items | |
tests/test_basic_expressions.py F | |
========================================================================= FAILURES ========================================================================== | |
______________________________________________________ TestBasicExpressions.test_arithmetic_expression ______________________________________________________ | |
self = <test_basic_expressions.TestBasicExpressions testMethod=test_arithmetic_expression> | |
def test_arithmetic_expression(self): | |
def arithmetic_fn(x): | |
return x * 2.0 + 1.0 | |
# Test frontend compilation (MLIR generation) | |
mlir_code = compile(arithmetic_fn, debug=True) | |
self.assertIn("arith.mulf", mlir_code) | |
self.assertIn("arith.addf", mlir_code) | |
# Test full pipeline compilation | |
jit = JITEngine() | |
> func_addr = jit.jit_compile(arithmetic_fn) | |
tests/test_basic_expressions.py:23: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
src/mlir_egglog/jit_engine.py:88: in jit_compile | |
address = self.run_backend(mlir) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <mlir_egglog.jit_engine.JITEngine object at 0x1015729c0> | |
mlir_src = '\nfunc.func @kernel_worker(\n %arg0: memref<?xf32>,\n %arg1: memref<?xf32>\n) attributes {llvm.emit_c_interface... %v4 = arith.addf %v3, %v2 : f32\n affine.store %v4, %arg1[%idx] : memref<?xf32>\n }\n return\n}\n' | |
def run_backend(self, mlir_src: str) -> bytes: | |
mlir_compiler = MLIRCompiler(debug=False) | |
mlir_omp = mlir_compiler.to_llvm_dialect(mlir_src, target=Target.BASIC_LOOPS) | |
llvm_ir = mlir_compiler.mlir_translate_to_llvm_ir(mlir_omp) | |
print(llvm_ir) | |
print("Parsing LLVM assembly.") | |
try: | |
# Clean up the LLVM IR by ensuring proper line endings and formatting | |
llvm_ir = llvm_ir.strip() | |
# Clean up problematic attribute strings (hack for divergence in modern LLVM IR syntax with old llvmlite) | |
llvm_ir = llvm_ir.replace("captures(none)", " ") | |
llvm_ir = llvm_ir.replace("memory(argmem: readwrite)", "") | |
llvm_ir = llvm_ir.replace("memory(none)", "") | |
llvm_ir += "\n" | |
mod = llvm.parse_assembly(llvm_ir) | |
mod = compile_mod(self.ee, mod) | |
# Resolve the function address | |
func_name = f"_mlir_ciface_{KERNEL_NAME}" | |
address = self.ee.get_function_address(func_name) | |
> assert address, "Function must be compiled successfully." | |
E AssertionError: Function must be compiled successfully. | |
src/mlir_egglog/jit_engine.py:74: AssertionError | |
------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- | |
0.44.0 | |
Parsing LLVM assembly. | |
Error during LLVM IR parsing/compilation: Function must be compiled successfully. | |
LLVM IR that failed to parse: | |
------------------------------------------------------------------- Captured stderr call -------------------------------------------------------------------- | |
/var/folders/xn/05ktz3056kqd9n8frgd6236h0000gn/T/tmpx_t4bzbx:15:11: error: unexpected error: Dialect `arith' not found for custom op 'arith.constant' | |
%c1 = arith.constant 1 : index | |
^ | |
/var/folders/xn/05ktz3056kqd9n8frgd6236h0000gn/T/tmpx_t4bzbx:15:11: error: unexpected note: Registered dialects: acc, amx, arm_neon, arm_sme, arm_sve, builtin, dlti, func, gpu, llvm, nvvm, omp, rocdl, spirv, vcix, x86vector ; for more info on dialect registration see https://mlir.llvm.org/getting_started/Faq/#registered-loaded-dependent-whats-up-with-dialects-management | |
%c1 = arith.constant 1 : index | |
^ | |
================================================================== short test summary info ================================================================== | |
FAILED tests/test_basic_expressions.py::TestBasicExpressions::test_arithmetic_expression - AssertionError: Function must be compiled successfully. | |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
===================================================================== 1 failed in 0.74s ===================================================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment