[Mlir-commits] [mlir] [MLIR] support dynamic indexing in `VectorEmulateNarrowTypes` (PR #114169)
Han-Chung Wang
llvmlistbot at llvm.org
Mon Nov 4 10:46:21 PST 2024
================
@@ -0,0 +1,53 @@
+// RUN: mlir-opt --test-emulate-narrow-int="arith-compute-bitwidth=1 memref-load-bitwidth=8" --cse --split-input-file %s | FileCheck %s
+
+// CHECK: #map = affine_map<()[s0, s1] -> ((s0 * 3 + s1) floordiv 4)>
+// CHECK: #map1 = affine_map<()[s0, s1] -> ((s0 * 3 + s1) mod 4)>
+func.func @vector_load_i2(%arg1: index, %arg2: index) -> vector<3x3xi2> {
+ %0 = memref.alloc() : memref<3x3xi2>
----------------
hanhanW wrote:
This style is probably written by me, or at least I reviewed the code. Making `%0` is a tricky in this kind of test because type converter is involved. I don't remember all the details. My impression is that there are patterns to replace the function argument types and it inserts a `unrealized_conversion_cast` is inserted. Because we want to flatten the memrefs and we have the emulation pattern for `memref.alloca`, so my easiest way was offloading it to `memref.alloca` which handles the case.
This style is clearer to me because that we do know that we want to flatten the memrefs. It is one of the core ideas in subtype emulation. Looping ABI changes (i.e., update the function argument type) seems to be a noise in this scope, IMO.
But yeah, more comments/documentations is better. @lialan can you help add a comment?
https://github.com/llvm/llvm-project/pull/114169
More information about the Mlir-commits
mailing list