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
6 changes: 5 additions & 1 deletion src/gfx1013_direct_mesh.inl
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,11 @@ NativeComputeShader lower_mesh(const string &code, const MeshStageLayout &layout
if (op.enc==Encoding::Smem) {
for (unsigned j=0;j<memory_count(op);++j) writes.insert(op.dst+j);
} else if (scalar && op.dst<=107) {
writes.insert(op.dst); writes.insert(op.dst+1);
// A 32-bit SALU result writes one SGPR. Lane masks (compares, b64 forms) and anything else
// still count as a pair.
const bool salu=op.enc==Encoding::Sop1 || op.enc==Encoding::Sop2 || op.enc==Encoding::Sopk;
writes.insert(op.dst);
if (!salu || name.find("64")!=string::npos) writes.insert(op.dst+1);
}
}
if (mask_copy_at && !outer.contains_child)
Expand Down
11 changes: 11 additions & 0 deletions tests/native_direct_mesh_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,17 @@ def saveexec_open(then, other):
'mesh SAVEEXEC else arm is not vector-only'),
):
saveexec_skip(name, saveexec_open(then, other), f'+0x{at:x}: {reason}')
# A 32-bit scalar write in the then arm writes one SGPR: the else arm may read its neighbour.
text = saveexec_skip('saveexec-then-b32-neighbour',
[0xbe9e0383] + # s_mov_b32 s30, 3
saveexec_open([0xbe9d0387, 0x7e02021d], # s_mov_b32 s29, 7; v_mov_b32_e32 v1, s29
[0x7e02021e])) # v_mov_b32_e32 v1, s30
assert re.search(r'= phi i32 \[ 7, %mesh_then_end\d+ \], \[ 3, %mesh_else_end\d+ \]', text), text
# A 64-bit one still writes both.
saveexec_skip('saveexec-then-b64-pair',
[0xbe9e0383] + saveexec_open([0xbe9e0480], # s_mov_b64 s[30:31], 0
[0x7e02021f]), # v_mov_b32_e32 v1, s31
'+0x40: mesh SAVEEXEC else arm reads a scalar the then arm writes')
no_inverse = saveexec_open(then_v1, else_v1)
no_inverse[5] = 0xbf800000 # s_nop 0 in place of the inverse
saveexec_skip('saveexec-no-inverse', no_inverse, '+0x2c: mesh SAVEEXEC else arm lacks the saved-mask inverse')
Expand Down
Loading