mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 15:28:37 +00:00
SHADER-340: require expected v_mul_f32 MODE sanity words
This commit is contained in:
@ -1,15 +1,19 @@
|
||||
"""CPU tests for tools/mad_denorm_probe.py (SHADER-340): RDNA1 mad/mac pre- and post-omod denormal flush.
|
||||
Standard library only; no GPU, no LLVM, no game files.
|
||||
"""
|
||||
import contextlib
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.dont_write_bytecode = True
|
||||
sys.path.insert(0, os.path.join(ROOT, "tools"))
|
||||
|
||||
import mad_denorm_probe as probe # noqa: E402
|
||||
from hw_oracle import runner as hw_runner # noqa: E402
|
||||
|
||||
|
||||
class TranslatorTests(unittest.TestCase):
|
||||
@ -35,6 +39,22 @@ class TranslatorTests(unittest.TestCase):
|
||||
self.assertEqual(by_what["subnorm * +inf + -1 -> -1"], probe.NEG_ONE)
|
||||
self.assertEqual(by_what["subnorm * qNaN + 1 -> 1"], probe.ONE)
|
||||
|
||||
def test_mode_sanity_rejects_broken_denorm_control(self):
|
||||
class BrokenModeOracle:
|
||||
device = "fake"
|
||||
arch = "gfx1010"
|
||||
|
||||
def run(self, kernels, words=1):
|
||||
return [[probe.POS_ZERO] for _ in kernels]
|
||||
|
||||
def close(self):
|
||||
pass
|
||||
|
||||
with mock.patch.object(hw_runner, "open_oracle", return_value=BrokenModeOracle()):
|
||||
with contextlib.redirect_stdout(io.StringIO()):
|
||||
rc = probe.main(["--oracle", "hw"])
|
||||
self.assertEqual(rc, 2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@ -292,6 +292,9 @@ def main(argv=None):
|
||||
print(f"MODE denorm32 sanity error: {sanity}")
|
||||
return 2
|
||||
print(f"MODE sanity (v_mul_f32 FLT_MIN * 0.5): denorm32=0 -> 0x{sanity[0]:08x}, denorm32=3 -> 0x{sanity[1]:08x}")
|
||||
if sanity != [POS_ZERO, SUBNORM_HALF]:
|
||||
print(f"MODE denorm32 sanity failed: expected [0x{POS_ZERO:08x}, 0x{SUBNORM_HALF:08x}], got {[hex(x) for x in sanity]}")
|
||||
return 2
|
||||
for wave in (32, 64):
|
||||
for name, mode in MODES:
|
||||
got = run_hw(oracle, CASES, wave, mode)
|
||||
|
||||
Reference in New Issue
Block a user