[Mlir-commits] [mlir] [MLIR][XeGPU] Pass inst_data for blocking create/constant Mask and Step op (PR #175456)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun Jan 11 12:35:31 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
@llvm/pr-subscribers-mlir-gpu
Author: Nishant Patel (nbpatel)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/175456.diff
2 Files Affected:
- (modified) mlir/lib/Dialect/XeGPU/Transforms/XeGPUBlocking.cpp (+2-1)
- (modified) mlir/test/Dialect/XeGPU/xegpu-blocking.mlir (+53)
``````````diff
diff --git a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUBlocking.cpp b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUBlocking.cpp
index ba2753f517ce6..f0581208c8a2b 100644
--- a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUBlocking.cpp
+++ b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUBlocking.cpp
@@ -228,7 +228,8 @@ XeGPUBlockingPass::getTileShape(Operation *op) const {
if (isa<vector::MultiDimReductionOp>(op))
return getTileShape(op->getOpOperand(0));
- if (isa<vector::TransposeOp, vector::BroadcastOp>(op))
+ if (isa<vector::TransposeOp, vector::BroadcastOp, vector::StepOp,
+ vector::ConstantMaskOp, vector::CreateMaskOp>(op))
return getTileShape(op->getOpResult(0));
return std::nullopt;
diff --git a/mlir/test/Dialect/XeGPU/xegpu-blocking.mlir b/mlir/test/Dialect/XeGPU/xegpu-blocking.mlir
index 9f9edcd416ddf..2b35b75b8d4ea 100644
--- a/mlir/test/Dialect/XeGPU/xegpu-blocking.mlir
+++ b/mlir/test/Dialect/XeGPU/xegpu-blocking.mlir
@@ -352,6 +352,59 @@ gpu.module @test_kernel {
}
}
+// -----
+#l = #xegpu.layout<inst_data = [16]>
+gpu.module @test_kernel {
+ gpu.func @test_vector_constant_mask(%src: ui64, %dst: ui64) {
+ //CHECK: arith.constant dense<true> : vector<16xi1>
+ %mask = vector.constant_mask [32] {layout_result_0 = #l} : vector<32xi1>
+ %cst = arith.constant dense<[
+ 0, 8, 16, 24, 32, 40, 48, 56,
+ 64, 72, 80, 88, 96, 104, 112, 120,
+ 128, 136, 144, 152, 160, 168, 176, 184,
+ 192, 200, 208, 216, 224, 232, 240, 248
+ ]> : vector<32xindex>
+ %ld = xegpu.load %src[%cst], %mask {chunk_size = 1, layout = #l, l1_hint = #xegpu.cache_hint<cached>} : ui64, vector<32xindex>, vector<32xi1> -> vector<32xf32>
+ xegpu.store %ld, %dst[%cst], %mask {chunk_size = 1, layout = #l, l1_hint = #xegpu.cache_hint<cached>} : vector<32xf32>, ui64, vector<32xindex>, vector<32xi1>
+ gpu.return
+ }
+}
+
+// -----
+#l = #xegpu.layout<inst_data = [16]>
+gpu.module @test_kernel {
+ gpu.func @test_vector_create_mask(%src: ui64, %dst: ui64) {
+ %c16 = arith.constant 16 : index
+ //CHECK-COUNT-2: vector.create_mask {{.*}} : vector<16xi1>
+ %mask = vector.create_mask %c16 {layout_result_0 = #l} : vector<32xi1>
+ %cst = arith.constant dense<[
+ 0, 8, 16, 24, 32, 40, 48, 56,
+ 64, 72, 80, 88, 96, 104, 112, 120,
+ 128, 136, 144, 152, 160, 168, 176, 184,
+ 192, 200, 208, 216, 224, 232, 240, 248
+ ]> : vector<32xindex>
+ %ld = xegpu.load %src[%cst], %mask {chunk_size = 1, layout = #l, l1_hint = #xegpu.cache_hint<cached>} : ui64, vector<32xindex>, vector<32xi1> -> vector<32xf32>
+ xegpu.store %ld, %dst[%cst], %mask {chunk_size = 1, layout = #l, l1_hint = #xegpu.cache_hint<cached>} : vector<32xf32>, ui64, vector<32xindex>, vector<32xi1>
+ gpu.return
+ }
+}
+
+// -----
+#l = #xegpu.layout<inst_data = [16]>
+gpu.module @test_kernel {
+ gpu.func @test_vector_step(%src: ui64, %dst: ui64) {
+ %c16 = arith.constant 16 : index
+ //CHECK: [[cst:%.+]] = arith.constant dense<16> : vector<16xindex>
+ //CHECK: [[step:%.+]] = vector.step : vector<16xindex>
+ //CHECK: arith.addi [[step]], [[cst]] : vector<16xindex>
+ %step = vector.step {layout_result_0 = #l} : vector<32xindex>
+ %mask = vector.create_mask %c16 {layout_result_0 = #l} : vector<32xi1>
+ %ld = xegpu.load %src[%step], %mask {chunk_size = 1, layout = #l, l1_hint = #xegpu.cache_hint<cached>} : ui64, vector<32xindex>, vector<32xi1> -> vector<32xf32>
+ xegpu.store %ld, %dst[%step], %mask {chunk_size = 1, layout = #l, l1_hint = #xegpu.cache_hint<cached>} : vector<32xf32>, ui64, vector<32xindex>, vector<32xi1>
+ gpu.return
+ }
+}
+
// -----
gpu.module @test_kernel {
``````````
</details>
https://github.com/llvm/llvm-project/pull/175456
More information about the Mlir-commits
mailing list