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 @@ -11153,6 +11153,11 @@ if(EXISTS "${INTAKE_PYTHON}")
"$<TARGET_FILE:offscreen_check>" ${adapter})
set_tests_properties(pixel_aot_cmpx_e64_${adapter} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77
ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/pixel_aot_cmpx_e64_${adapter}.txt")
add_test(NAME pixel_aot_cmpx_sdwa_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_SOURCE_DIR}/tests/pixel_aot_check.py" draw-cmpx-sdwa "${DXC_EXECUTABLE}"
"$<TARGET_FILE:offscreen_check>" ${adapter})
set_tests_properties(pixel_aot_cmpx_sdwa_${adapter} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77
ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/pixel_aot_cmpx_sdwa_${adapter}.txt")
add_test(NAME pixel_aot_region_body_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_SOURCE_DIR}/tests/pixel_aot_check.py" draw-region-body "${DXC_EXECUTABLE}"
"$<TARGET_FILE:offscreen_check>" ${adapter})
Expand Down
6 changes: 4 additions & 2 deletions docs/experiments.md

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions docs/experiments/direct-sdwa-profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ SDWA validation is per operand, mirroring
`place_subword` destination placement; no modifier or subword selection is
silently ignored.

Still refused in SDWA: `v_sin_f16`/`v_cos_f16` (no direct lowering),
`v_fmac_f32`/`v_fmac_f16` and the rest of `VOP2_SDWA_UNSUPPORTED_OPS`,
The SDWA forms of `v_sin_f16`/`v_cos_f16` are covered by the separate
`native_sin_cos_f16` suite. Still refused in SDWA: `v_fmac_f32`/`v_fmac_f16`
and the rest of `VOP2_SDWA_UNSUPPORTED_OPS`,
64-bit `_f64`/`_b64` forms, and VOP3-only ops (`v_fma_f16`, `v_min3_f16`,
`v_med3_f16`, `v_cvt_pknorm_*`).

Expand All @@ -56,7 +57,7 @@ a second and third program (12, 28 and 6 slots, each under the 32-slot
hardware layout) with an independent Python/ISA reference model, plus 15
refusal controls: disallowed VOP2 SDWA ops, float/int modifier violations,
omod/clamp on integer destinations, invalid 16-bit destination selection and
unused mode, a byte source pick, literal 255, and `v_sin_f16`. The new
unused mode, a byte source pick, and literal 255. The new
profiles also pin the `v_frexp_*_f32` SDWA source pick (a WORD_1 pick reads
only the high half, so the picked value is a subnormal) and destination
placement (a WORD destination keeps only the result's low half, with the
Expand Down
35 changes: 34 additions & 1 deletion tests/form_coverage_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,12 @@ def check_shader_records():
assert compare_forms <= covered, (name, sorted(compare_forms - covered))
assert not {form for _, form in covered} & (compare_neighbours | {f"{n}_e64" for n in compare_neighbours})
assert cmpx_forms <= reference and cmpx_forms <= covered, (name, sorted(cmpx_forms - covered))
assert {form for _, form in covered if form.startswith("v_cmpx_")} == {form for _, form in cmpx_forms}, name
# The non-SDWA v_cmpx family is the 190 forms above; the 62 exec-writing SDWA forms are a separate
# family, checked by check_cmpx_sdwa_coverage and counted here from the same control run.
assert {form for _, form in covered
if form.startswith("v_cmpx_") and not form.endswith("_sdwa")} == {form for _, form in cmpx_forms}, name
assert {form for _, form in covered if form.startswith("v_cmpx_") and form.endswith("_sdwa")} == \
{entry["form"] for entry in pixel.CMPX_SDWA_FORMS}, name
# The scalar ALU fixture counts its SOP1, SOP2, SOPK and SOPC forms; the neighbours the controls
# reject (s_addc_u32, s_cmp_lt_u64) stay out; s_getreg_b32 joined the accepted forms with the mode-register fixture.
scalar = {"s_movk_i32", "s_cmovk_i32", "s_not_b32", "s_add_u32", "s_sub_u32", "s_add_i32", "s_sub_i32",
Expand Down Expand Up @@ -1422,6 +1427,33 @@ def check_sdwa_cmp_coverage():
assert ("SDWA", "v_cmp_lt_f16_sdwa") not in fc.gfx_forms(stripped, reference), name


def check_cmpx_sdwa_coverage():
"""The 62 exec-writing VOPC SDWA comparisons are the complete SDWA v_cmpx family of both references,
counted from this fixture's accepted words. The non-SDWA exec writers and the v_cmp SDWA forms stay out."""
import pixel_aot_check as pixel
wanted = {("SDWA", entry["form"]) for entry in pixel.CMPX_SDWA_FORMS}
assert len(wanted) == 62
saved = set(pixel.ACCEPTED)
pixel.ACCEPTED.clear()
try:
pixel.translate(pixel.uncompressed_export(pixel.cmpx_sdwa_body()))
accepted = set(pixel.ACCEPTED)
finally:
pixel.ACCEPTED.clear()
pixel.ACCEPTED.update(saved)
assert not {form for form in accepted if form.startswith("v_cmp_")}
assert not {form for form in accepted if form.startswith("v_cmpx_") and not form.endswith("_sdwa")}
for name in ("gfx1013.tsv", "rdna2.tsv"):
reference = fc.load_reference(name)
family = {entry for entry in reference if entry[0] == "SDWA" and entry[1].startswith("v_cmpx_")}
assert family == wanted, (name, sorted(family ^ wanted))
covered = fc.gfx_forms(accepted, reference)
assert wanted <= covered, (name, sorted(wanted - covered))
# Control: removing one accepted SDWA word removes exactly that form from the count.
stripped = accepted - {"v_cmpx_lt_f16_sdwa"}
assert ("SDWA", "v_cmpx_lt_f16_sdwa") not in fc.gfx_forms(stripped, reference), name


def check_dpp_f16_arith_round_forms():
"""The 16 quad-local DPP16/DPP8 binary16 arithmetic and rounding forms count as covered once
the translator accepts their fixtures; unlowered f16 DPP/SDWA neighbours stay uncovered."""
Expand Down Expand Up @@ -1722,6 +1754,7 @@ def check_f16_cvt_norm_forms():
check_swap_coverage()
check_pk_fmac_coverage()
check_sdwa_cmp_coverage()
check_cmpx_sdwa_coverage()
check_sopk_wait_forms()
check_s_version_form()
check_parsing()
Expand Down
3 changes: 2 additions & 1 deletion tests/native_cvt_f16_i16_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ def refusal_programs():
programs = []
for op, (vop1_op, vop3_op, _, to_f16) in OPS.items():
programs.append(([vop1(vop1_op, 3, 250), 0xFF00B101, 0xBF810000], 'unsupported DPP arithmetic'))
programs.append(([vop1(vop1_op, 3, 249), 0x06060601, 0xBF810000], 'unimplemented direct SDWA operand profile'))
programs.append(([vop1(vop1_op, 3, 249), 0x06060601, 0xBF810000],
'unsupported SDWA destination modifier'))
programs.append((vop3_unary(vop3_op, 3, 257, omod=1) + [0xBF810000], f'unsupported {op} clamp or omod'))
programs.append((vop3_unary(vop3_op, 3, 257, op_sel=1) + [0xBF810000], f'unsupported {op} high-half op_sel'))
programs.append((vop3_unary(vop3_op, 3, 257, op_sel=8) + [0xBF810000], f'unsupported {op} high-half op_sel'))
Expand Down
3 changes: 2 additions & 1 deletion tests/native_sdwa_profiles_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,8 @@ def refusal_cases():
(sdwa_instruction(profile("v_floor_f16", 0x5B, True, 0, src0=DWORD | 0x80, dst=WORD_0), reg0=255),
"literal is unavailable in SDWA"),
(sdwa_instruction(profile("v_fmac_f32", 0x2B, False, 0, 0)), SDWA_REFUSAL),
(sdwa_instruction(profile("v_sin_f16", 0x60, True, 0)), SDWA_REFUSAL),
# v_sin_f16/v_cos_f16 are admitted by the SDWA path since #3300; the
# separate native_sin_cos_f16 suite pins their positive forms.
)


Expand Down
Loading
Loading