[llvm] [AMDGPU][Draft] OOB mode - module flag (PR #160922)
Piotr Sobczak via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 12 07:59:02 PDT 2026
================
@@ -1,67 +1,112 @@
-; Tests for IR verifier enforcement of the "amdgpu.oob.mode" module flag.
-; The flag must use Module::Min (i32 8) merge behaviour, carry a constant
-; integer value, and have no bits set outside the currently defined mask (0x3).
+; Tests for IR verifier enforcement of the "amdgpu.buffer.oob.relaxed" and
+; "amdgpu.tbuffer.oob.relaxed" module flags. Each flag must use Module::Min
+; (i32 8) merge behaviour, carry a constant integer value, and be 0 or 1.
; RUN: split-file %s %t
; --- Negative: wrong merge behaviour (Override=4 instead of Min=8) ---
-; RUN: not llvm-as %t/wrong-behavior.ll --disable-output 2>&1 \
-; RUN: | FileCheck %s --check-prefix=WRONG-BEHAVIOR
+; RUN: not llvm-as %t/wrong-behavior-buffer.ll --disable-output 2>&1 \
+; RUN: | FileCheck %s --check-prefix=WRONG-BUF
+; RUN: not llvm-as %t/wrong-behavior-tbuffer.ll --disable-output 2>&1 \
+; RUN: | FileCheck %s --check-prefix=WRONG-TBUF
; --- Negative: non-integer value ---
-; RUN: not llvm-as %t/non-integer.ll --disable-output 2>&1 \
-; RUN: | FileCheck %s --check-prefix=NON-INTEGER
+; RUN: not llvm-as %t/non-integer-buffer.ll --disable-output 2>&1 \
+; RUN: | FileCheck %s --check-prefix=NON-INT-BUF
+; RUN: not llvm-as %t/non-integer-tbuffer.ll --disable-output 2>&1 \
+; RUN: | FileCheck %s --check-prefix=NON-INT-TBUF
+
+; --- Negative: value out of range (2 is not 0 or 1) ---
+; RUN: not llvm-as %t/out-of-range-buffer.ll --disable-output 2>&1 \
+; RUN: | FileCheck %s --check-prefix=RANGE-BUF
+; RUN: not llvm-as %t/out-of-range-tbuffer.ll --disable-output 2>&1 \
+; RUN: | FileCheck %s --check-prefix=RANGE-TBUF
+
+; --- Positive: absent flags (no error expected) ---
+; RUN: llvm-as %t/absent.ll --disable-output 2>&1 | count 0
-; --- Negative: unknown bits set ---
-; RUN: not llvm-as %t/unknown-bits.ll --disable-output 2>&1 \
-; RUN: | FileCheck %s --check-prefix=UNKNOWN-BITS
+; --- Positive: valid relaxed value 1 for buffer ---
+; RUN: llvm-as %t/valid-buffer-1.ll --disable-output 2>&1 | count 0
-; --- Positive: absent flag (no error expected) ---
-; RUN: llvm-as %t/absent.ll --disable-output 2>&1 | count 0
+; --- Positive: valid relaxed value 1 for tbuffer ---
+; RUN: llvm-as %t/valid-tbuffer-1.ll --disable-output 2>&1 | count 0
+
+; --- Positive: both flags set to 1 ---
+; RUN: llvm-as %t/valid-both-1.ll --disable-output 2>&1 | count 0
-; --- Positive: valid relaxed value 0x1 ---
-; RUN: llvm-as %t/valid-0x1.ll --disable-output 2>&1 | count 0
+; --- Positive: explicit strict value 0 ---
+; RUN: llvm-as %t/valid-both-0.ll --disable-output 2>&1 | count 0
-; --- Positive: valid relaxed value 0x3 ---
-; RUN: llvm-as %t/valid-0x3.ll --disable-output 2>&1 | count 0
+; --- Linker BUG: absent + relaxed(1) currently preserves relaxed(1) ---
----------------
piotrAMD wrote:
I am hitting a bug in IRMover.cpp where absent module flags are not treated as 0 in the Min behavior, despite it being documented as "Min
Takes the min of the two values, which are required to be non-negative integers. *An absent module flag is treated as having the value 0*." (emphasis mine).
It looks there's a different behavior between no module flags vs empty module flags (the latter works).
https://github.com/llvm/llvm-project/pull/160922
More information about the llvm-commits
mailing list