[Mlir-commits] [mlir] [XeGPU] Add sg_map for scatter verification (PR #124300)
Artem Kroviakov
llvmlistbot at llvm.org
Wed Jan 29 01:35:30 PST 2025
================
@@ -170,6 +170,64 @@ func.func @test_prefetch_vc_2(%src: ui64) {
return
}
+// -----
+func.func @test_create_tdesc_sg_map_1(%src: ui64) {
+ %cst = arith.constant dense<[0, 8, 16, 24]> : vector<4xindex>
+ // expected-error at +1 {{TensorDesc of a 1D tensor must have wi_layout[1] == tdescShape[0]}}
+ %1 = xegpu.create_tdesc %src, %cst : ui64, vector<4xindex> -> !xegpu.tensor_desc<4xf32, #xegpu.scatter_tdesc_attr<>, #xegpu.sg_map<wi_layout = [4, 1], wi_data = [1, 1]>>
----------------
akroviakov wrote:
> For example, I think such descriptor should be fine:
> `!xegpu.tensor_desc<2xf32, #xegpu.scatter_tdesc_attr<chunk_size = 2>, #xegpu.sg_map<wi_layout = [1, 1], wi_data = [1, 2]>>`
The upstream [documentation ](https://mlir.llvm.org/docs/Dialects/XeGPU/#xegpucreate_tdesc-xegpucreatedescop) explicitly states:
> The first dimension of the result TensorDesc corresponds to work-items, so it should match the dimension of offsets. It may also has a second dimension corresponding to the chunk_size if the chunk size is larger than 1.
According to this, the shape in your example must be `<1x2xf32>` for a normal tdesc.
As for tensors with `sg_map`, AFAIK in https://github.com/llvm/llvm-project/pull/120566 it was established that __the original tensor descriptor type is preserved__.
https://github.com/llvm/llvm-project/pull/124300
More information about the Mlir-commits
mailing list