mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 09:08:38 +00:00
Merge pull request #894 from qhukz13/cont/nsa-vlist-liveness
tests/semantic: NSA address lists are live-ins of read_before_write_vgprs and reg_reads_writes (TEST-NSA-VLIST-LIVENESS)
This commit is contained in:
@ -15,6 +15,24 @@ class StoreLiveIns(unittest.TestCase):
|
||||
self.assertEqual(rdna2spirv.reg_reads_writes([ins]), (reads, set()))
|
||||
self.assertEqual(rdna2spirv.read_before_write_vgprs([ins]), reads)
|
||||
|
||||
def test_nsa_address_list_registers_are_sources(self):
|
||||
# An NSA image op names each address register on its own ([v2, v5, v9] parses as one "vlist" operand), so
|
||||
# the registers need not be contiguous: a range from the first one would read v2..v4 and miss v5 and v9.
|
||||
sample = "image_sample v0, [v2, v3], s[0:7], s[8:11] dmask:0x1 dim:SQ_RSRC_IMG_2D"
|
||||
load = "image_load v[4:7], [v2, v5, v9], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_3D unorm"
|
||||
for op, reads, writes in ((sample, {2, 3}, {0}), (load, {2, 5, 9}, {4, 5, 6, 7})):
|
||||
with self.subTest(op=op):
|
||||
ins = parse_line(op)
|
||||
self.assertEqual(rdna2spirv.reg_reads_writes([ins]), (reads, writes))
|
||||
self.assertEqual(rdna2spirv.read_before_write_vgprs([ins]), reads)
|
||||
|
||||
def test_nsa_list_register_written_first_is_no_live_in(self):
|
||||
# v5 is written before the image op reads it, so of the list only v2 and v9 come from shader entry.
|
||||
insns = [parse_line("v_mov_b32 v5, 0"),
|
||||
parse_line("image_load v[4:7], [v2, v5, v9], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_3D unorm")]
|
||||
self.assertEqual(rdna2spirv.read_before_write_vgprs(insns), {2, 9})
|
||||
self.assertEqual(rdna2spirv.reg_reads_writes(insns), ({2, 5, 9}, {4, 5, 6, 7}))
|
||||
|
||||
def test_branch_exports_live_barycentrics(self):
|
||||
fixture = Path(__file__).parent / "fixtures" / "ps_flat_store_livein.asm"
|
||||
program = fixture.read_text(encoding="ascii").splitlines()
|
||||
|
||||
Reference in New Issue
Block a user