Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6977,6 +6977,11 @@ if(EXISTS "${INTAKE_PYTHON}")
"$<TARGET_FILE:offscreen_check>" ${adapter})
set_tests_properties(compute_store_aot_bfe_${adapter} PROPERTIES TIMEOUT 45
ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/compute_store_aot_bfe_${adapter}.txt")
add_test(NAME compute_store_aot_vcmp_select_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_SOURCE_DIR}/tests/compute_store_check.py" draw-vcmp-select "${DXC_EXECUTABLE}"
"$<TARGET_FILE:offscreen_check>" ${adapter})
set_tests_properties(compute_store_aot_vcmp_select_${adapter} PROPERTIES TIMEOUT 45
ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/compute_store_aot_vcmp_select_${adapter}.txt")
add_test(NAME compute_store_aot_mubuf_reduction_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_SOURCE_DIR}/tests/compute_store_check.py" draw-mubuf-reduction "${DXC_EXECUTABLE}"
"$<TARGET_FILE:offscreen_check>" ${adapter})
Expand Down
10 changes: 10 additions & 0 deletions docs/experiments.md
Original file line number Diff line number Diff line change
Expand Up @@ -5477,6 +5477,16 @@ The `DOT_U` fixture in `tests/compute_store_check.py` (`draw-dot-u`, `compute_st
ctest --preset dev --no-tests=error -R '^compute_store_aot_dot_u_(warp|hardware)$' -V
```

#### Per-lane compare and select

`v_cmp_{f,lt,eq,le,gt,ne,ge,t}_{u32,i32}` (`_e32` into `vcc_lo` and `_e64` into `vcc_lo` or `s0..s105`), `v_cmp_{f,lt,eq,le,gt,lg,ge,o,u,nge,nlg,ngt,nle,neq,nlt,tru}_f32` (`_e32` into `vcc_lo` and `_e64` into `vcc_lo` or `s0..s105`), `v_cndmask_b32_e32 vD, S0, vS1, vcc_lo`, and `v_cndmask_b32_e64 vD, S0, S1, (vcc_lo|sN)` track per-lane compare results as `("cond", hlsl_bool_expression)` in `vcc_cond` or `scalar[n]` and lower selects to `(cond ? S1 : S0)`. Because only the same lane reads its condition bit, the lowering is independent of wave size. Integer `u32` compares compare `uint` words, `i32` compares cast via `asint(...)`, and `f32` compares cast via `asfloat(...)` with explicit `isnan(...)` checks for all ordered and unordered IEEE NaN predicates. Existing lane guards (`s_and_saveexec_b32` on uniform `v_cmp`), constant-mask `v_cndmask_b32_e64`, and `vcc_carry`/`vcc_borrow` keep their behavior, and any write to `vcc_lo` invalidates the other VCC-derived states. `f32` source modifiers, `clamp`, SDWA/DPP spellings, scalar ALU or branch readers of a condition SGPR, `s_and_saveexec_b32` on a condition built from loaded or ALU data, `_ci` carry-in from a condition, and stale conditions after another VCC write are refused.

The `VCMP_SELECT` suite in `tests/compute_store_check.py` (`draw-vcmp-select`, `compute_store_aot_vcmp_select_${adapter}`) runs 12 64-thread `gfx1013` dispatches (`buffer_store_dwordx4`, 256 output words plus 64 `SENTINEL` words each) covering all 32 predicates across equal values, `0x7fffffff` vs `0x80000000`, `0` vs `0xffffffff`, denormal raw words (`0x00000001` vs `0x80000001`), `±0`, `NaN` on either or both sides, `±inf`, and memory-loaded/`tid` inputs, comparing all 3,840 words against an independent Python model. Reference controls (`lt`/`gt` swapped at word 1, signed for unsigned at word 1, ordered for unordered at word 5, select operands swapped at word 0, sentinel modified at word 256) and recompiled-HLSL mutations (`<` for `<=`, `asint` dropped, `isnan` replaced by `isinf` on an unordered predicate) must all fail.

```powershell
ctest --preset dev --no-tests=error -R '^compute_store_aot_vcmp_select_(warp|hardware)$' -V
```

### Two- and three-dimensional thread groups

The PSV0 group size can be any `numthreads(x,y,z)` within the `cs_6_0` limits
Expand Down
3 changes: 2 additions & 1 deletion tests/compute_alu_cmp_ne_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def controls():
for compare, diagnostic in (
("v_cmp_ne_i32_e32 vcc_lo, v0, s3", "Unsupported compute instruction"),
("v_cmp_ne_i32_e32 vcc_hi, s3, v0", "Unsupported compute instruction"),
("v_cmp_ne_i32_e64 s20, s3, v0", "Unsupported compute instruction"),
# v_cmp_ne_i32_e64 s20, ... sets s20 to a per-lane cond without writing vcc_lo, so s_and_saveexec_b32 refuses it.
("v_cmp_ne_i32_e64 s20, s3, v0", "Unverified or repeated lane guard"),
("v_cmp_ne_i32_e64 vcc_lo, -v0, s3", "Unsupported compute instruction"),
("v_cmpx_ne_i32_e32 vcc_lo, s3, v0", "Unsupported compute instruction"),
("v_cmp_ne_i32_e32 vcc_lo, s20, v0", "Unverified lane guard compare"),
Expand Down
12 changes: 6 additions & 6 deletions tests/compute_lane_mask_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ def mask(*changes, width=32, lines=LANE_MASK, **binding):
(lane_mask, (("0x600d, s8", "0x600d, s4"),), {}),
(lane_mask, (("s_bitreplicate_b64_b32 s[8:9], 0x3f3f3f3f", "s_mov_b32 s8, 0x3f3f3f3f\ns_add_u32 s8, s8, s14"),
("s_mov_b32 s14, 0xbeef", ""), ("s_mov_b32 s1, 0", "s_mov_b32 s1, 0\ns_mov_b32 s14, 0xbeef")), {}),
# Mask uses the profile does not lower: a wave64 pair, vcc_lo or exec_lo as the mask, the e32 form, an exec
# write from the mask, and a saveexec from it instead of a compare.
# Mask uses the profile does not lower: a wave64 pair, exec_lo as the mask, an exec write from the mask,
# and a saveexec from it instead of a compare; vcc_lo without a prior v_cmp_* cond is an unverified lane mask.
(unsupported + "v_cndmask_b32_e64 v1, v0, 0x600d, s[8:9]", (("0x600d, s8", "0x600d, s[8:9]"),), {}),
(unsupported + "v_cndmask_b32_e64 v1, v0, 0x600d, vcc_lo", (("0x600d, s8", "0x600d, vcc_lo"),), {}),
(lane_mask, (("0x600d, s8", "0x600d, vcc_lo"),), {}),
(unsupported + "v_cndmask_b32_e64 v1, v0, 0x600d, exec_lo", (("0x600d, s8", "0x600d, exec_lo"),), {}),
(unsupported + "v_cndmask_b32_e32", (("v_cndmask_b32_e64 v2, s14, v0, s10",
"v_cndmask_b32_e32 v2, s14, v0, vcc_lo"),), {}),
(lane_mask, (("v_cndmask_b32_e64 v2, s14, v0, s10",
"v_cndmask_b32_e32 v2, s14, v0, vcc_lo"),), {}),
(unsupported + "s_mov_b32 exec_lo, s8", (("s_mov_b32 s14, 0xbeef", "s_mov_b32 s14, 0xbeef\n"
"s_mov_b32 exec_lo, s8"),), {}),
(unsupported + "s_and_saveexec_b32 s20, s8", (("s_mov_b32 s14, 0xbeef", "s_mov_b32 s14, 0xbeef\n"
Expand All @@ -141,7 +141,7 @@ def mask(*changes, width=32, lines=LANE_MASK, **binding):
# Select sources that are not known words, and a destination past v255.
("Unverified ALU operand", (("v2, s14, v0, s10", "v2, s20, v0, s10"),), {}),
("Unverified ALU operand", (("v2, s14, v0, s10", "v2, s14, v7, s10"),), {}),
("Unverified ALU operand", (("v1, v0, 0x600d, s8", "v256, v0, 0x600d, s8"),), {}),
("Invalid vector destination", (("v1, v0, 0x600d, s8", "v256, v0, 0x600d, s8"),), {}),
# A select result is data only: not a store address.
("Unsupported store address", (("v[1:4], v0, s[4:7]", "v[1:4], v1, s[4:7]"),), {}),
# Groups whose lanes depend on the unknown wave size, or on more than local X.
Expand Down
Loading
Loading