D3D12 Swin kernels: weight staging stores the last chunk from several threads

Open
#118 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active

Research direction

Start in clean/dx12/kernels/swin_block.hlsl, at the weight staging code for the partial row where threads past the last 16-byte chunk write to the same groupshared addresses, and compare it with the HIP version the issue cites. The change is a store guard on the chunk index against the chunk count, with the barrier kept. Done means the guard is in place, the bit-exact checks pass for every kernel built from the template, and the DXIL hash record is regenerated.

Written by the indexing model from the issue text.

Description

In the D3D12 Swin block template (clean/dx12/kernels/swin_block.hlsl, weight staging), when the number of 16-byte chunks is smaller than the thread count of the group, the threads past the last chunk all store that last chunk to the same groupshared addresses. The stored values are identical, and no wrong output has been observed, but the HIP version has exactly one writer per address and the D3D12 version should match it instead of relying on how the driver treats overlapping stores.

Applies to every channel count, including Model M's shipped kernels and the C = 32 block of Model L (#117).

Fix: in the partial row, store only when the thread's chunk index is below the chunk count; keep the barrier. Because this changes Model M's shader binaries, the change needs the bit-exact checks and the DXIL hash record redone for all kernels built from the template.

Found in review of #117. Refs #89

Dominant language
C++
Stars
12
Forks
2
Avg merge
3h 10m
Merged PRs (30d)
171

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from phantoslayer21/wronggpu

All issues in phantoslayer21/wronggpu

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.