[llvm] [NVPTX] Add missing Range attr to tensormap.replace intrinsics. (PR #207099)
Yunqing Yu via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 10:06:40 PDT 2026
================
@@ -0,0 +1,26 @@
+; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+
+; The %ord operand of the indexed-field tensormap.replace intrinsics must be in
+; the range [0, 5), per the PTX ISA (`tensormap.replace`: "The only valid values
+; for `ord` are [0..4]").
+
+declare void @llvm.nvvm.tensormap.replace.box.dim.p1(ptr addrspace(1) %addr, i32 immarg %ord, i32 %new_value)
+declare void @llvm.nvvm.tensormap.replace.global.dim.p1(ptr addrspace(1) %addr, i32 immarg %ord, i32 %new_value)
+declare void @llvm.nvvm.tensormap.replace.element.stride.p1(ptr addrspace(1) %addr, i32 immarg %ord, i32 %new_value)
+declare void @llvm.nvvm.tensormap.replace.global.stride.p1(ptr addrspace(1) %addr, i32 immarg %ord, i64 %new_value)
+
+define void @test_tensormap_replace_ord_out_of_range(ptr addrspace(1) %addr, i32 %v32, i64 %v64) {
+ ; CHECK: immarg value 5 out of range [0, 5)
+ call void @llvm.nvvm.tensormap.replace.box.dim.p1(ptr addrspace(1) %addr, i32 5, i32 %v32)
+
+ ; CHECK: immarg value 6 out of range [0, 5)
+ call void @llvm.nvvm.tensormap.replace.global.dim.p1(ptr addrspace(1) %addr, i32 6, i32 %v32)
+
+ ; CHECK: immarg value 5 out of range [0, 5)
+ call void @llvm.nvvm.tensormap.replace.element.stride.p1(ptr addrspace(1) %addr, i32 5, i32 %v32)
+
+ ; CHECK: immarg value 6 out of range [0, 5)
+ call void @llvm.nvvm.tensormap.replace.global.stride.p1(ptr addrspace(1) %addr, i32 6, i64 %v64)
+
+ ret void
+}
----------------
yunqingy180 wrote:
Fixed. Thanks.
https://github.com/llvm/llvm-project/pull/207099
More information about the llvm-commits
mailing list