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
1 change: 1 addition & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ jobs:
tests/startup_gfx2hlsl_s_abs_check.py \
tests/startup_gfx2hlsl_s_bitset_check.py \
tests/startup_gfx2hlsl_s_flbit_check.py \
tests/startup_gfx2hlsl_s_ff1_check.py \
tests/startup_gfx2hlsl_fma_mix_check.py \
tests/startup_gfx2hlsl_shift64_check.py \
tests/startup_gfx2hlsl_mul_mad_i24_check.py \
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ python3 -m venv out/pe-env
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_s_abs_check.py
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_s_bitset_check.py
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_s_flbit_check.py
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_s_ff1_check.py
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_fma_mix_check.py
./out/pe-env/bin/python -B tests/startup_image_2d_array_check.py
./out/pe-env/bin/python -B tests/startup_image_sample_a16_check.py
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3355,6 +3355,17 @@ if(EXISTS "${INTAKE_PYTHON}")
"$<TARGET_FILE:offscreen_check>" ${adapter})
set_tests_properties(startup_gfx2hlsl_s_flbit_dispatch_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77)
endforeach()
# gfx2hlsl lowers s_ff1_i32_b32 of a general scalar and s_ff1_i32_b64 of a zero-extended
# immediate (#2022 Item F); live SGPR-pair b64 is owned by open #2072. CPU evaluation, then
# a D3D12 UAV readback on WARP/hardware (same dispatch pattern as pack_absdiff).
add_test(NAME startup_gfx2hlsl_s_ff1 COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_s_ff1_check.py")
foreach(adapter IN ITEMS warp hardware)
add_test(NAME startup_gfx2hlsl_s_ff1_dispatch_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_s_ff1_check.py" dispatch "${DXC_EXECUTABLE}"
"$<TARGET_FILE:offscreen_check>" ${adapter})
set_tests_properties(startup_gfx2hlsl_s_ff1_dispatch_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77)
endforeach()
# gfx2hlsl lowers v_cube{id,sc,tc,ma}_f32: device-free translation controls.
add_test(NAME startup_gfx2hlsl_cube_controls COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_cube_check.py")
Expand Down
14 changes: 14 additions & 0 deletions docs/experiments.md
Original file line number Diff line number Diff line change
Expand Up @@ -8115,6 +8115,20 @@ destination with a known bit index folds. Run
`ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_s_bitset$' -V`
(or `python3 -B tests/startup_gfx2hlsl_s_bitset_check.py`). The fixture is
CPU-only; Windows WARP/hardware draws are left for an independent retest.
**Scalar find-first-one.** Startup translation lowers `s_ff1_i32_b32` of a
general scalar to `firstbitlow` (0xffffffff when the word is zero), matching
`pixel_aot` / Mesa. The compute-entry special case on `exec_lo` still folds to
lane 0. SCC is unchanged. Lane masks and descriptor-bearing sources are
refused. `s_ff1_i32_b64` accepts a 32-bit SOP1 literal/inline (ISA zero-extends
the high word to 0) and folds it, and also lowers a live SGPR pair with the same
64-bit firstbitlow scan as the scalar bit-scan forms. Run
`ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_s_ff1$' -V`
(or `python3 -B tests/startup_gfx2hlsl_s_ff1_check.py`). The `_dispatch_warp`
/ `_dispatch_hardware` variants compile the translated `firstbitlow` into a
compute shader and compare UAV readback for inputs 0, 1, 0x80000000 and
0x00010000 (and the zero-extended b64 immediates) against the same reference:
`ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_s_ff1_dispatch_warp$' -V`.
[Refs #2022](https://github.com/R0Y00/Xbox2Windows/issues/2022) Item F.

**Scalar find-first-bit-high.** Startup translation lowers `s_flbit_i32_b32` to
`S0 == 0 ? 0xffffffff : 31 - firstbithigh(S0)`, matching `pixel_aot` /
Expand Down
3 changes: 2 additions & 1 deletion tests/startup_gfx2hlsl_compute_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,8 @@ def check_controls():
for code in (bytes.fromhex('8003febe') + ff1 + end,
ff1 + bytes.fromhex('feff82bf') + end):
refused('compute entry EXEC mask', lambda: translate('A', code=code))
refused('requires compute exec_lo', lambda: translate('A', code=bytes.fromhex('6a1385be') + end))
# vcc_lo is a lane mask; general-scalar ff1 (#2022 Item F) still refuses it.
refused('lane mask', lambda: translate('A', code=bytes.fromhex('6a1385be') + end))
assert 's5 = 0u;' in translate('A-ff1').hlsl_cs()
assert expected('A-ff1') != expected('A')
check_lds()
Expand Down
4 changes: 3 additions & 1 deletion tests/startup_gfx2hlsl_s_bit_scan_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ def ref(name, value):
repr(lines))

# Refusals that must not widen: a 64-bit scan needs a register pair, 32-bit one register, and no lane-mask data.
check('b64 refuses an inline constant source', refused('s_ff1_i32_b64', 3, 0x80))
# s_ff0 keeps the pair-only SCALAR_BITS path (inline constants refused). s_ff1_i32_b64 also accepts a
# zero-extended 32-bit immediate (#2022 Item F), so the pair-only refusal is checked on s_ff0.
check('b64 refuses an inline constant source', refused('s_ff0_i32_b64', 3, 0x80))
check('b32 refuses exec destination', refused('s_bcnt1_i32_b32', EXEC_LO, 2))
check('b32 refuses m0 destination', refused('s_bcnt1_i32_b32', M0, 2))
check('b32 refuses exec source', refused('s_bcnt1_i32_b32', 3, EXEC_LO))
Expand Down
Loading
Loading