Skip to content

fix(translator): use atomic exchange for mesh alloc request - #8617

Closed
Cryptoteep wants to merge 1 commit into
ItsNotRexed:mainfrom
Cryptoteep:fix/shader-ms-alloc-atomic
Closed

Cryptoteep wants to merge 1 commit into
ItsNotRexed:mainfrom
Cryptoteep:fix/shader-ms-alloc-atomic

Conversation

@Cryptoteep

Copy link
Copy Markdown

Summary

Updates tools/rdna2spirv.py for mesh shader s_sendmsg(MSG_GS_ALLOC_REQ) to emit OpAtomicExchange into %ms_counts with Workgroup scope instead of guarding OpStore with local_index == 0.

Changes

  • In tools/rdna2spirv.py, replace the local_index == 0 conditional store with OpAtomicExchange %uint %ms_counts %c2 %c0 %m.
  • Eliminates SharedMemoryDataRace-RaceOnStore while ensuring that mesh shaders where wave 0 branches around the allocation request (or where wave 1 executes it) still store the uniform workgroup vertex/primitive counts correctly.
  • In tests/test_mesh_alloc_single_writer.py, update tests to verify OpAtomicExchange with Workgroup scope (%c2) and Relaxed memory order (%c0) under both native mesh and --mesh-compute.

Verification

  • python -I tests/test_mesh_alloc_single_writer.py passes.
  • python -m unittest discover -s tests/semantic -p "*mesh*.py" passes.
  • python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/test_mesh_alloc_single_writer.py passes with code 0.
  • Synthetic fixtures only, zero game data.

s_sendmsg(MSG_GS_ALLOC_REQ) previously guarded OpStore %ms_counts with
local_index == 0. In mesh shaders where wave 0 branches around the
allocation request, the count was never stored. Use OpAtomicExchange
with Workgroup scope so any executing wave stores the uniform request
without races.
@Cryptoteep

Copy link
Copy Markdown
Author

Superseded by #8608.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant