[Mlir-commits] [mlir] [mlir][amdgpu] Lower make_gather_dma_descriptor. (PR #172083)
Krzysztof Drewniak
llvmlistbot at llvm.org
Mon Dec 15 09:11:16 PST 2025
================
@@ -1378,9 +1379,63 @@ def AMDGPU_MakeDmaDescriptorOp :
Variadic<Index>: $atomic_barrier_indices,
Optional<Index>: $global_increment,
Optional<I32>: $lds_increment,
- Optional<Index>: $iteration_count)>,
- Results<(outs AMDGPU_TDMDescriptorType: $desc)> {
+ Optional<Index>: $iteration_count);
+
+ let extraClassDeclaration = [{
+ int64_t getRank() {
+ return getGlobalStaticSizes().size();
+ }
+
+ unsigned getElementTypeWidth() {
+ return getBase().getType().getElementType().getIntOrFloatBitWidth();
+ }
+
+ SmallVector<OpFoldResult> getMixedGlobalSizes() {
+ return getMixedValues(getGlobalStaticSizes(), getGlobalDynamicSizes(), getContext());
+ }
+
+ SmallVector<OpFoldResult> getMixedGlobalStrides() {
+ return getMixedValues(getGlobalStaticStrides(), getGlobalDynamicStrides(), getContext());
+ }
+
+ SmallVector<OpFoldResult> getMixedSharedSizes() {
+ return getMixedValues(getSharedStaticSizes(), getSharedDynamicSizes(), getContext());
+ }
+
+ constexpr bool isGather() {
----------------
krzysz00 wrote:
These methods are all templated by something like `DmaOpType` (I forget how it's spelled in the actual code) because the lowering for gathers and non-gathers is _almost_ identical. Once the correct template replacement gets picked, the compiler will know that the `isGather()` call will either be `return false;` or `return true;`. I _suspect_ that the `constexpr` here ensures that this substitution happens.
My gut says that you probably want to go for `static constexpr` in the classes just to be safe, though, so this looks like `OpType::isGather()`
https://github.com/llvm/llvm-project/pull/172083
More information about the Mlir-commits
mailing list