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
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11372,6 +11372,18 @@ if(EXISTS "${INTAKE_PYTHON}")
"${CMAKE_SOURCE_DIR}/tests/pixel_aot_check.py" draw-f16-rcp-sqrt "${DXC_EXECUTABLE}"
"$<TARGET_FILE:offscreen_check>" ${adapter})
set_tests_properties(pixel_aot_f16_rcp_sqrt_${adapter} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77)
add_test(NAME pixel_aot_f16_rsq_exp_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_SOURCE_DIR}/tests/pixel_aot_check.py" draw-f16-rsq-exp "${DXC_EXECUTABLE}"
"$<TARGET_FILE:offscreen_check>" ${adapter})
set_tests_properties(pixel_aot_f16_rsq_exp_${adapter} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77)
add_test(NAME pixel_aot_f16_log_trig_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_SOURCE_DIR}/tests/pixel_aot_check.py" draw-f16-log-trig "${DXC_EXECUTABLE}"
"$<TARGET_FILE:offscreen_check>" ${adapter})
set_tests_properties(pixel_aot_f16_log_trig_${adapter} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77)
add_test(NAME pixel_aot_f16_minmax3_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_SOURCE_DIR}/tests/pixel_aot_check.py" draw-f16-minmax3 "${DXC_EXECUTABLE}"
"$<TARGET_FILE:offscreen_check>" ${adapter})
set_tests_properties(pixel_aot_f16_minmax3_${adapter} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77)
add_test(NAME pixel_aot_f16_fmac_ldexp_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_SOURCE_DIR}/tests/pixel_aot_check.py" draw-f16-fmac-ldexp "${DXC_EXECUTABLE}"
"$<TARGET_FILE:offscreen_check>" ${adapter})
Expand Down Expand Up @@ -11660,6 +11672,12 @@ if(EXISTS "${INTAKE_PYTHON}")
ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/pixel_aot_f16_round_${adapter}.txt")
set_tests_properties(pixel_aot_f16_rcp_sqrt_${adapter} PROPERTIES
ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/pixel_aot_f16_rcp_sqrt_${adapter}.txt")
set_tests_properties(pixel_aot_f16_rsq_exp_${adapter} PROPERTIES
ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/pixel_aot_f16_rsq_exp_${adapter}.txt")
set_tests_properties(pixel_aot_f16_log_trig_${adapter} PROPERTIES
ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/pixel_aot_f16_log_trig_${adapter}.txt")
set_tests_properties(pixel_aot_f16_minmax3_${adapter} PROPERTIES
ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/pixel_aot_f16_minmax3_${adapter}.txt")
set_tests_properties(pixel_aot_f16_fmac_ldexp_${adapter} PROPERTIES
ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/pixel_aot_f16_fmac_ldexp_${adapter}.txt")
set_tests_properties(pixel_aot_f16_cvt_int16_${adapter} PROPERTIES
Expand Down
12 changes: 11 additions & 1 deletion docs/experiments.md

Large diffs are not rendered by default.

101 changes: 101 additions & 0 deletions tests/form_coverage_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,104 @@ def check_f16_rcp_sqrt_forms():
pixel.ACCEPTED.update(saved)


def check_f16_rsq_exp_forms():
"""The four plain binary16 VOP1 reciprocal-square-root and exponent forms (e32 and e64 spellings of rsq and
exp) count as covered once the translator accepts their fixtures; the DPP and SDWA spellings and log, sin and
cos stay uncovered."""
import pixel_aot_check as pixel
saved = set(pixel.ACCEPTED)
pixel.ACCEPTED.clear()
try:
for key in pixel.F16_RSQ_EXP_PROGRAMS:
pixel.translate_f16(pixel.f16_rsq_exp_program(*key))
ops = ("rsq", "exp")
forms = {("VOP1", f"v_{op}_f16") for op in ops} | {("VOP3", f"v_{op}_f16_e64") for op in ops}
assert len(forms) == 4
neighbours = {
("VOP1", "v_log_f16"), ("VOP3", "v_log_f16_e64"),
("VOP1", "v_sin_f16"), ("VOP3", "v_cos_f16_e64"),
("DPP16", "v_rsq_f16_dpp"), ("DPP16", "v_exp_f16_dpp"),
("DPP8", "v_rsq_f16_dpp"), ("DPP8", "v_exp_f16_dpp"),
("SDWA", "v_rsq_f16_sdwa"), ("SDWA", "v_exp_f16_sdwa"),
}
for name in ("gfx1013.tsv", "rdna2.tsv"):
reference = fc.load_reference(name)
assert forms <= reference, (name, sorted(forms - reference))
assert neighbours <= reference, (name, sorted(neighbours - reference))
covered = fc.gfx_forms(pixel.ACCEPTED, reference)
assert forms <= covered, (name, sorted(forms - covered))
assert not neighbours & covered, (name, sorted(neighbours & covered))
# Without the rsq/exp fixtures none of the four forms is covered, not even through the other unary ones.
pixel.ACCEPTED.clear()
for body in pixel.F16_EXACT_EXTRA_PROGRAMS.values():
pixel.translate_f16(pixel.uncompressed_export(body))
assert not forms & fc.gfx_forms(pixel.ACCEPTED, fc.load_reference("gfx1013.tsv"))
finally:
pixel.ACCEPTED.clear()
pixel.ACCEPTED.update(saved)


def check_f16_log_trig_forms():
"""The six plain binary16 VOP1 logarithm, sine and cosine forms (e32 and e64 spellings of log, sin and cos)
count as covered once the translator accepts their fixtures; the DPP and SDWA spellings stay uncovered."""
import pixel_aot_check as pixel
saved = set(pixel.ACCEPTED)
pixel.ACCEPTED.clear()
try:
for key in pixel.F16_LOG_TRIG_PROGRAMS:
pixel.translate_f16(pixel.f16_log_trig_program(*key))
ops = ("log", "sin", "cos")
forms = {("VOP1", f"v_{op}_f16") for op in ops} | {("VOP3", f"v_{op}_f16_e64") for op in ops}
assert len(forms) == 6
neighbours = {
("DPP16", "v_log_f16_dpp"), ("DPP8", "v_log_f16_dpp"),
("DPP16", "v_sin_f16_dpp"), ("DPP8", "v_sin_f16_dpp"),
("DPP16", "v_cos_f16_dpp"), ("DPP8", "v_cos_f16_dpp"),
("SDWA", "v_log_f16_sdwa"), ("SDWA", "v_sin_f16_sdwa"), ("SDWA", "v_cos_f16_sdwa"),
}
for name in ("gfx1013.tsv", "rdna2.tsv"):
reference = fc.load_reference(name)
assert forms <= reference, (name, sorted(forms - reference))
assert neighbours <= reference, (name, sorted(neighbours - reference))
covered = fc.gfx_forms(pixel.ACCEPTED, reference)
assert forms <= covered, (name, sorted(forms - covered))
assert not neighbours & covered, (name, sorted(neighbours & covered))
# Without the fixtures none of the six forms is covered, not even through the other unary ones.
pixel.ACCEPTED.clear()
for body in pixel.F16_EXACT_EXTRA_PROGRAMS.values():
pixel.translate_f16(pixel.uncompressed_export(body))
assert not forms & fc.gfx_forms(pixel.ACCEPTED, fc.load_reference("gfx1013.tsv"))
finally:
pixel.ACCEPTED.clear()
pixel.ACCEPTED.update(saved)


def check_f16_minmax3_forms():
"""The three plain VOP3 binary16 three-operand min/max/med3 forms count as covered once the translator accepts
their fixtures."""
import pixel_aot_check as pixel
saved = set(pixel.ACCEPTED)
pixel.ACCEPTED.clear()
try:
for key in pixel.F16_MINMAX3_PROGRAMS:
pixel.translate_f16(pixel.f16_minmax3_program(*key))
forms = {("VOP3", "v_min3_f16"), ("VOP3", "v_max3_f16"), ("VOP3", "v_med3_f16")}
assert len(forms) == 3
for name in ("gfx1013.tsv", "rdna2.tsv"):
reference = fc.load_reference(name)
assert forms <= reference, (name, sorted(forms - reference))
covered = fc.gfx_forms(pixel.ACCEPTED, reference)
assert forms <= covered, (name, sorted(forms - covered))
# Without the fixtures none of the three forms is covered.
pixel.ACCEPTED.clear()
for body in pixel.F16_EXACT_EXTRA_PROGRAMS.values():
pixel.translate_f16(pixel.uncompressed_export(body))
assert not forms & fc.gfx_forms(pixel.ACCEPTED, fc.load_reference("gfx1013.tsv"))
finally:
pixel.ACCEPTED.clear()
pixel.ACCEPTED.update(saved)


def check_f16_fmac_ldexp_forms():
"""The two plain e32 binary16 forms v_fmac_f16 and v_ldexp_f16 count as covered once the translator accepts their
fixtures; their e64, DPP and SDWA spellings and the arithmetic they resemble stay uncovered."""
Expand Down Expand Up @@ -1803,6 +1901,9 @@ def check_f16_cvt_norm_forms():
check_f16_arith_forms()
check_f16_round_forms()
check_f16_rcp_sqrt_forms()
check_f16_rsq_exp_forms()
check_f16_log_trig_forms()
check_f16_minmax3_forms()
check_f16_fmac_ldexp_forms()
check_f16_cvt_int16_forms()
check_f16_to_int16_forms()
Expand Down
Loading
Loading