[Mlir-commits] [mlir] [MLIR][NVVM] Fix valid range of ord in tensormap.replace op (PR #202853)

Srinivasa Ravi llvmlistbot at llvm.org
Tue Jun 9 22:06:15 PDT 2026


https://github.com/Wolfram70 created https://github.com/llvm/llvm-project/pull/202853

Fixes the valid range of the `ord` attribute in the NVVM dialect `tensormap.replace` op to be `0-4` as indicated in the PTX ISA.

PTX ISA Reference: https://docs.nvidia.com/cuda/parallel-thread-execution/#data-movement-and-conversion-instructions-tensormap-replace

>From df39e8b124a0d11c546c8ecd3cb02d0c2ba65fd9 Mon Sep 17 00:00:00 2001
From: Srinivasa Ravi <srinivasar at nvidia.com>
Date: Wed, 10 Jun 2026 05:02:31 +0000
Subject: [PATCH] [MLIR][NVVM] Fix valid range of ord in tensormap.replace op

Fixes the valid range of the `ord` attribute in the NVVM dialect
`tensormap.replace` op to be 0-4 as indicated in the PTX ISA.

PTX ISA Reference: https://docs.nvidia.com/cuda/parallel-thread-execution/#data-movement-and-conversion-instructions-tensormap-replace
---
 mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td                 | 2 +-
 mlir/test/Target/LLVMIR/nvvm/tensormap_replace_invalid.mlir | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
index dabb519aa1395..e21b3c132ded4 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
@@ -6898,7 +6898,7 @@ def NVVM_TensormapReplaceOp : NVVM_VoidIntrinsicOp<"tensormap.replace",
     TensormapFieldAttr:$field,
     AnyTypeOf<[LLVM_PointerGlobal, LLVM_PointerShared]>:$addr,
     Optional<AnyTypeOf<[I64, I32]>>:$new_value,
-    OptionalAttr<ConfinedAttr<I32Attr, [IntMinValue<1>, IntMaxValue<5>]>>:$ord,
+    OptionalAttr<ConfinedAttr<I32Attr, [IntMinValue<0>, IntMaxValue<4>]>>:$ord,
     OptionalAttr<TensormapFieldValueAttr>:$new_value_attr
   );
 
diff --git a/mlir/test/Target/LLVMIR/nvvm/tensormap_replace_invalid.mlir b/mlir/test/Target/LLVMIR/nvvm/tensormap_replace_invalid.mlir
index 245a5da40ab9f..21454491f218a 100644
--- a/mlir/test/Target/LLVMIR/nvvm/tensormap_replace_invalid.mlir
+++ b/mlir/test/Target/LLVMIR/nvvm/tensormap_replace_invalid.mlir
@@ -27,7 +27,7 @@ llvm.func @tensormap_replace_invalid_ordinal(%addr : !llvm.ptr<1>, %new_val : i3
 // -----
 
 llvm.func @tensormap_replace_ordinal_out_of_range(%addr : !llvm.ptr<1>, %new_val : i32) {
-  // expected-error @+1 {{attribute 'ord' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 1 whose maximum value is 5}}
+  // expected-error @+1 {{attribute 'ord' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 0 whose maximum value is 4}}
   nvvm.tensormap.replace field = box_dim[6], new_value = %new_val in %addr : !llvm.ptr<1>, i32
   llvm.return
 }



More information about the Mlir-commits mailing list