[Mlir-commits] [mlir] [xegpu][transform] Improve `insert_prefetch` to support loads from dynamic shaped memrefs. (PR #228258)

Tuomas Kärnä llvmlistbot at llvm.org
Fri Oct 2 06:23:29 PDT 2026


================
@@ -427,10 +556,13 @@ transform::InsertPrefetchOp::apply(transform::TransformRewriter &rewriter,
   auto readCacheHint =
       xegpu::CachePolicyAttr::get(ctx, xegpu::CachePolicy::CACHED);
 
-  // Modify loadOp mixedOffsets by replacing the for loop induction variable
-  // with the given value.
+  // Case 1 substitutes the iteration into load_nd's direct-IV offset. In
+  // case 2 the cloned subview carries the iteration, so load offsets stay zero.
----------------
tkarna wrote:

I think the previous implementation was actually more generic. By substituting the loop induction variable, with the updated value, we can support any offset arithmetic that loop had. For example, there may well be affine map computation etc.

If I understand correctly, your new implementation assumes that the load offset must have the loop's induction variable directly, which I think is a quite limiting assumption.

https://github.com/llvm/llvm-project/pull/228258


More information about the Mlir-commits mailing list