[Mlir-commits] [mlir] Support float8_e3m4 and float8_e4m3 in np_to_memref (PR #186453)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Mar 13 10:03:42 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r origin/main...HEAD mlir/python/mlir/runtime/np_to_memref.py mlir/test/python/execution_engine.py
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- python/mlir/runtime/np_to_memref.py 2026-03-13 17:01:17.000000 +0000
+++ python/mlir/runtime/np_to_memref.py 2026-03-13 17:03:08.122096 +0000
@@ -44,10 +44,11 @@
class F8E3M4(ctypes.Structure):
"""A ctype representation for MLIR's Float8E3M4."""
_fields_ = [("f8E3M4", ctypes.c_int8)]
+
class F8E4M3(ctypes.Structure):
"""A ctype representation for MLIR's Float8E4M3."""
_fields_ = [("f8E4M3", ctypes.c_int8)]
--- test/python/execution_engine.py 2026-03-13 17:01:17.000000 +0000
+++ test/python/execution_engine.py 2026-03-13 17:03:08.315045 +0000
@@ -654,10 +654,11 @@
# test to-numpy utility
x = ranked_memref_to_numpy(arg2_memref_ptr[0])
assert len(x) == 1
assert x[0] == 0.5
+
if HAS_ML_DTYPES:
run(testF8E3M4Memref)
else:
log("TEST: testF8E3M4Memref")
@@ -694,10 +695,11 @@
# test to-numpy utility
x = ranked_memref_to_numpy(arg2_memref_ptr[0])
assert len(x) == 1
assert x[0] == 0.5
+
if HAS_ML_DTYPES:
run(testF8E4M3Memref)
else:
log("TEST: testF8E4M3Memref")
``````````
</details>
https://github.com/llvm/llvm-project/pull/186453
More information about the Mlir-commits
mailing list