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
3 changes: 3 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ jobs:
(["tests/startup_gfx2hlsl_vopc_sdwa_check.py", "decode", "libLLVM-15.so.1"], {}),
(["tests/startup_gfx2hlsl_sop2_complement_check.py", "binary", "llvm-mc-15"], {}),
(["tests/startup_gfx2hlsl_sop2_complement_check.py", "decode", "libLLVM-15.so.1"], {}),
(["tests/startup_gfx2hlsl_f32_lg_check.py", "binary", "llvm-mc-15"], {}),
(["tests/startup_gfx2hlsl_f32_lg_check.py", "decode", "libLLVM-15.so.1"], {}),
(["tests/startup_inline_sampler_check.py", "binary", "llvm-mc-15"], {}),
(["tests/startup_smem_address_check.py", "binary", "llvm-mc-15"], {}),
(["tests/compute_entry_layout_check.py", "binary", "llvm-mc-15"], {}),
Expand Down Expand Up @@ -203,6 +205,7 @@ jobs:
tests/startup_gfx2hlsl_shift64_check.py \
tests/startup_gfx2hlsl_vopc_sdwa_check.py \
tests/startup_gfx2hlsl_sop2_complement_check.py \
tests/startup_gfx2hlsl_f32_lg_check.py \
tests/startup_inline_sampler_check.py \
tests/startup_buffer_address_check.py \
tests/startup_smem_address_check.py \
Expand Down
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2054,6 +2054,10 @@ if(EXISTS "${INTAKE_PYTHON}")
# reference; floating-point SDWA forms and unsupported modifiers are refused. The draws are registered below.
add_test(NAME startup_gfx2hlsl_vopc_sdwa COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_vopc_sdwa_check.py")
# f32 lg/nlg ordered for NaN (#1920): every f32 condition, e32 and e64 under every neg/abs, evaluated over
# +-0, denormals, +-1, +-max, +-inf and NaNs against the ISA reference; the old != lowering must fail.
add_test(NAME startup_gfx2hlsl_f32_lg COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_f32_lg_check.py")
# A negated source on the vector select flips that source's sign bit (#1709).
add_test(NAME startup_gfx2hlsl_cndmask_neg COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_cndmask_neg_check.py")
Expand Down Expand Up @@ -2170,6 +2174,14 @@ if(EXISTS "${INTAKE_PYTHON}")
"$<TARGET_FILE:offscreen_check>" ${adapter} $<$<BOOL:${STARTUP_FXC}>:${STARTUP_FXC}>)
set_tests_properties(startup_gfx2hlsl_vopc_sdwa_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77)
endforeach()
# gfx2hlsl v_cmp/v_cmpx lg and nlg f32 over every pair of +-0, denormal, +-1, +-max, +-inf and NaN words decide
# 16 x 16 pixels, checked pixel by pixel (#1920); the old != lowering must fail the same draws.
foreach(adapter IN ITEMS warp hardware)
add_test(NAME startup_gfx2hlsl_f32_lg_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_f32_lg_check.py" draw "${DXC_EXECUTABLE}"
"$<TARGET_FILE:offscreen_check>" ${adapter} $<$<BOOL:${STARTUP_FXC}>:${STARTUP_FXC}>)
set_tests_properties(startup_gfx2hlsl_f32_lg_${adapter} PROPERTIES TIMEOUT 300 SKIP_RETURN_CODE 77)
endforeach()
add_test(NAME startup_gfx2hlsl_mad_controls COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_mad_check.py")
foreach(adapter IN ITEMS warp hardware)
Expand Down
24 changes: 24 additions & 0 deletions docs/experiments.md
Original file line number Diff line number Diff line change
Expand Up @@ -6053,6 +6053,30 @@ translations that read the whole dword or zero-extend the byte must fail the dra
and match their own plain-integer image. Run `ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_vopc_sdwa' -V`.
`tests/startup_gfx2hlsl_vopc_sdwa_check.py binary <llvm-mc>` and `decode <libLLVM>` round-trip every accepted
form through LLVM 15.

**f32 lg and nlg compares with a NaN source (#1920).** `V_CMP_LG_F32` is less or greater: ordered and not equal,
false when either source is NaN, and `V_CMP_NLG_F32` is its negation. `compare()` lowered them as `a != b` and
`!(a != b)`, and HLSL `!=` is unordered, so both gave the opposite result on every NaN pair. They now read
`(ORDERED && (a < b || a > b))` and its negation, where ORDERED tests both source words for NaN on their bits
(`(w & 0x7fffffff) <= 0x7f800000`, before the neg/abs modifiers). The bit test is needed on hardware: DXC without
`-Gis` marks the float compares `fast`, and on an RX 9070 XT (driver 32.0.31044.16) the DXC build of the plain
less-or-greater in the `cmp` fixture below returned 1 for both lg and nlg on all 156 NaN pairs (its `v_cmpx`
fixtures matched); FXC on both backends and DXC on WARP gave the ordered result.
`startup_gfx2hlsl_f32_lg` decodes every f32 condition of the table (v_cmp and v_cmpx, e32 and e64 under every
neg/abs combination, 510 forms), translates it and evaluates the HLSL over all 256 pairs of +-0, +-min denormal,
+-1.0, +-max finite, +-inf, +-quiet, signalling and payload NaN against a reference built from the ISA
definitions on the bit patterns; the old `!=` text fails all 68 lg/nlg forms, and the f32 SDWA forms stay refused.
The draws `startup_gfx2hlsl_f32_lg_{warp,hardware}` build one of those words from the pixel's x and one from its
y, so 16 x 16 pixels cover every pair, and write `v_cmp_lg_f32_e32`, `v_cmp_nlg_f32_e64`, `v_cmp_lg_f32_e64` and
`v_cmp_nlg_f32_e32` results or keep a pixel through `v_cmpx_lg/nlg_f32_e32/e64`, compiled with FXC `ps_5_1` and
DXC `ps_6_0`. Every pixel matched on WARP and on the RX 9070 XT with both compilers: lg is 1 on unequal pairs and
0 on equal and NaN pairs, nlg the opposite. Both backends flushed denormal compare sources to signed zero, which
D3D allows; the draw accepts the image with denormals kept or flushed, the same choice for every fixture, and
reports which. The old `!=` text fails each draw against both images (156 pixels differ against the flushed one)
and matches its own image. Run `ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_f32_lg' -V`;
`tests/startup_gfx2hlsl_f32_lg_check.py binary <llvm-mc>` and `decode <libLLVM>` round-trip the forms and the
fixtures through LLVM 15.

**Four half channels in a typed buffer load.** `BUF_FMT_16_16_16_16_FLOAT` stores x and y in the first
dword and z and w in the second, and the typed-load format table had only the two-channel half-float
form, so a load of this format was refused with `buffer format BUF_FMT_16_16_16_16_FLOAT` - 5 of the 29
Expand Down
Loading
Loading