Repository navigation
startup: keep the wave size in the in-memory compute request - #3519
Conversation
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed babe3170 by reading the diff; not built or run. I also checked one of our existing native-only runs against it.
Verdict: approve. put now derives wave32 with the same expression as the disk reader, and ComputeRequest::wave32 was the only field the in-memory copy left at its default. No MUST.
Our run backs the claim. Native-only run446: main 44a3ad5a + #3506 #3516 #3464 #3521 #3097 #3527 + local profiling counters; 190 s fresh start; Windows 10 19045. It logged compute request snapshots: hits 58, so the frozen path was used. It refused 16 slot-67 keys natively, and 12 of them as unbound numeric SGPR sN (11 on an odd SGPR, the high half of a pair). For all 12, state block A has bit 20 of dword 4 clear (wave64). Several have 32 threads (8×4), which is the narrow-wave64 case. I did not rerun with this change.
- NIT Say in the body that the result depended on the path: the same key got wave64 analysis on a frozen-pool miss (disk reader) and wave32 on a hit. That explains why a key could translate in one run and refuse in the next.
- Checked, no finding:
- Old wrong-wave live translations leave nothing stale behind. Only the runtime used the frozen copy, and it publishes no
.csiror manifest. Offlinecompile_dxiland pack entries went through the disk reader. The DXC bytecode cache is keyed by the new IR. compute_request_wave32returnstruefor a non-28-byte block, but every caller validates the shape (takepath atd3d12_compute_dispatch.inl:495, the disk reader before the call).- The container path takes the wave size from the stage record, not from this field.
- Old wrong-wave live translations leave nothing stale behind. Only the runtime used the frozen copy, and it publishes no
Tests: native_frozen_request now puts a wave64 and a wave32 request through the real put/take path and checks each, and the two mutations show both are reached. CI did not run it (not in the Windows pr filter), although it needs no GPU. The only result is the author's local run.
Refs #3224 (part 1 of our claim there).
Draft, held under our open-PR cap (#3514).
Why
The in-memory compute request copy (
FrozenComputeRequests::put, called fromsrc/startup_stubs/d3d12_draw.inl:879) did not setComputeRequest::wave32, so the field kept its default oftrue. The disk readerread_compute_requestderives it from state block A, dword 4 bit 20 (sa[18] & 0x10; set = wave32, clear = wave64).Wave64 programs taken from the in-memory copy were therefore analysed as wave32 and refused natively with "unbound numeric SGPR" on the high half of a 64-bit compare pair.
In one long local run of the application, most compute dispatches left without a translation came from such programs. No counts were recorded.
What
src/shader_compute_request.cpp:335: newcompute_request_wave32(state_a)(declared atsrc/shader_compute_request.h:59). Same expression as before. It returnstruewhen the block is not 28 bytes; shape validation rejects that case.src/shader_compute_request.cpp:322:read_compute_requestcalls the helper aftervalidate_compute_request_shape. Behaviour unchanged.src/frozen_compute_requests.h:38:putderiveswave32fromrequest.sabefore taking the lock. Its only caller builds the request withoutwave32, so nothing is overwritten.wave32was the onlyComputeRequestfield the in-memory copy omitted:true(before this change)Tests
native_frozen_requestnow puts one request with bit 20 clear and one with it set through the production put/take path, and assertswave32on each aftertake.Mutations, each run against
native_frozen_request:request.wave32 = true== 0)Regression run, dev preset with
X2W_WITH_OPUS=OFF:ctest -R '^native_frozen_request$': passed.ctest -R '^(startup_compute_|native_compute_)' -j 4: 212 tests, 198 passed, 11 skipped, 3 failed.The 3 failures also occur with the base sources (ff9dcef) rebuilt in the same tree:
startup_compute_builder_gate_runtime(builder mode exit 3)startup_compute_dispatch_cube_warp("debug layer not enabled")startup_compute_dispatch_cube_hardware("debug layer not enabled")Not covered
No long-run re-measurement of the application with this change yet.