compute: indexed atomic UAV dispatch (takeover of #3417) #3454
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3454"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T13:07:36Z.
Takeover of #3417 by @Ammmae0x.
What is merged
9895ec1c,fa269a85,10d7d41b), unchanged.main:e1143678(merge of77d1ba4d),393b80eb(merge ofaf1cab5c, #3389) anda96d1f6b(merge of4b0586d4, #3398 and #3400). Head isa96d1f6b.mainise3f9a64f; its commits after4b0586d4touch no file of this PR.e1143678has one conflict, insrc/startup_stubs/d3d12_compute_dispatch.inl, at the slot setup intranslate_compute_natively. Both lines are kept:if (atomic) slots.back().atomic = true;from #3417 andslots.back().requires_identity_dst_sel = view.requires_identity_dst_sel;frommain. They set different fields.git show --remerge-diff e1143678shows nothing else.393b80ebhas one conflicting file,tests/native_compute_manifest_reasons.cpp, in two places. Both sides are kept in each:cases[], the twoindexed_atomic_uaventries from #3417, then thepacked_d16_x_uaventry frommain;publishedloop, theuav 0 atomic table 1 32block from #3417, then theuav 0 packed_d16_x table 1 32block frommain.One line is our edit and comes from neither side: the count in the final
printfis+ 3instead of+ 2. Each side had raised it from+ 1to+ 2for its own standalone block, and the merged file has both blocks. The count is only printed; the exit code of the test does not depend on it.git show --remerge-diff 393b80ebshows nothing else.a96d1f6bhas one conflicting file,src/startup_stubs/d3d12_compute_dispatch.inl, in the view loop oftranslate_compute_natively, which #3398 rewrote. Main's side is kept: theKindalias,texture_outputand the dimension switch, thesupportedlist andauto& slot. Three lines carry the atomic UAV:const bool atomic = view.kind == Kind::indexed_atomic_uav;, and|| atomicat the end ofoutput;|| atomicinsupported, aftertexture_input. Main refuses any kind missing from that list;slot.atomic = atomic;on main'sauto& slot, replacingif (atomic) slots.back().atomic = true;.The
volumeflag of the branch is dropped: main's dimension switch covers it.git show --remerge-diff a96d1f6bshows nothing else.Run
Full build of
a96d1f6b,devpreset with-DX2W_WITH_OPUS=OFF, in a fresh isolated environment with a hardware adapter (not the one in the PR) and the inbox WARP.The eight
startup_input_view_token*tests, not listed, pass too. The three skips are the WARP variants that need a 32-lane adapter.native_compute_manifest_reasonsoutput includesok UAV kind packed_d16_x_uav,ok publishes uav 0 atomic table 1 32,ok publishes uav 0 packed_d16_x table 1 32and0 of 32 manifest reasons wrong._hardwareoutput:The
native:line of that output, separately, as asked in the reviews of #3417 and of393b80eb:_warpdid not reach the dispatch. Its output hasnative_lane_range=4..4and ends with:_controlsoutput includesindexed atomic UAV published as `uav 0 atomic table 1 32`.Not covered
_warpskips before any dispatch and prints nonative:line._controlsand_hardwareget pastcompile_dxilat the same commits plus the merges.u0 root=... bytes=...line asked for on #3417 is not in the output of this test when it passes, so it is not posted._controlsto theprpreset (SHOULD 1 of the review) is not done here, because it editsCMakePresets.json.393b80ebare open:countdoes not decide the result, and u0 is the only atomic UAV. The test files are unchanged since393b80eb.Refs #3417
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T13:47:52Z.
Review of
393b80ebagainst mainc3cae611. Verdict: hold (one MUST). This checks the points from the #3417 review and the default native path.MUST
It conflicts with main again. #3398 (merged as
dc936253) rewrote the view classification intranslate_compute_natively:git merge-tree --write-tree origin/main 393b80eb→CONFLICT (content): Merge conflict in src/startup_stubs/d3d12_compute_dispatch.inl, and gh showsCONFLICTING. Restoringatomicinoutputisn't enough:supportedlist ("is not bound for a natively translated program"), soindexed_atomic_uavhas to be added there too;slot.atomic = truehas to move onto main'sauto& slot = slots.back();.If
supportedis missed, the in-process path still refuses the kind. Onlynative_check()on a 32-lane adapter would catch that: CI doesn't run it, and the inbox WARP skips. Please post thenative:line of_hardwareagain after the resolution.What this PR settles from the #3417 review
The old conflict is resolved in
e1143678.git show --remerge-diffof both merges shows only the resolutions in the description, and the+ 3count is right (21cases[]+ 4published[]+ 3 standalone blocks = 28).The default native path is tested.
native_check()setsX2W_NATIVE_SHADERSin a fresh work directory with no published manifest, so if the in-process translation refused, the readback check would fail. It assertstranslated natively: 2 entry values, 0 inputs, 1 outputs. It doesn't setX2W_NATIVE_SHADERS_ONLY=1the way the launchers do. That makes no difference here: after a successful in-process translation,load_compute_translationnever runs. Your hardware run at393b80ebhas thenative:line, so with the author's RTX 4050 that's two adapters.The Server 2025 red is still unexplained, but this code can't produce it:
10d7d41band393b80eb, the formatter publishesindexed_atomic_uavwhenarray_count == 1 && required_bytes == 4.indexed ? ComputeViewKind::indexed_atomic_uav : ComputeViewKind::raw_buffer_uav, 4, ®)._controls, which is the samecompile_dxilstep that failed there.My guess is stale binaries, but I haven't measured it. Binaries built from main would match both results: main's
compile_dxilprints exactlyUAV kind indexed_atomic_uavfor this binding (view_shape), and main'snative_compute_manifest_reasonshas none of the new cases, so it passes. Also, the full SHA quoted in that report (10d7d41b7740…) is not this commit's (10d7d41b77d4…).SHOULD
There is still no WARP dispatch at any head: the inbox WARP gives
native_lane_range=4..4and exit 77. If the Server 2025 run was at10d7d41b, its_warpand_hardwaregot pastmain()'s--shader-wave32probe and only then failed incompile_dxil. That environment may be the only one so far that can dispatch this test, so a re-run there by tedin7 at the resolved head would close this.The hardware report doesn't name the adapter, driver or Windows build, which AGENTS.md asks for in GPU reports.
CI still selects none of the four tests: a
re.searchof theprfilter givesFalsefor_controls,_warpandnative_compute_manifest_reasons. The description already says so.Two gaps from the #3417 approval review are still open:
countnever decides the result. The largest index is 124 and the smallest count is 160, soatomic_count = ~0upasses.atomic_registers.push_back(i)→push_back(0)survives.A wrapped stride-8 index and a u0-raw/u1-atomic layout would cover both.
NIT
ViewRecordfields and the one above theSetComputeRoot32BitConstantsloop. The code uses 2 plus the view's rank among the atomic UAVs, which is correct. The comments are wrong when a non-atomic UAV comes first.indexed_atomic_uavwithout the formatter'srequired_bytes == 4check, and the record path hard-codes 4 (ComputeViewBinding{..., 0, 0, 0, 4}). This can't happen today, since the translator always records 4, but a matching check would keep the two routes aligned.an indexed atomic output view has an unsupported stride or range.Not run here: build, ctest, WARP or GPU. This is a read-only review on Linux.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T13:54:34Z.
New head
a96d1f6b: merge ofmain4b0586d4(#3398 and #3400 included).git merge-tree --write-treeagainst currentmaine3f9a64fis clean.MUST 1
One conflicting file,
src/startup_stubs/d3d12_compute_dispatch.inl, in the view loop oftranslate_compute_natively. Main's side is kept (theKindalias,texture_outputand the dimension switch,supported,auto& slot). Three lines carry the atomic UAV, fromgit show --remerge-diff a96d1f6b:The branch's
volumeflag is dropped: main's dimension switch covers it. The remerge diff shows nothing else.Run
Full build of
a96d1f6b,devpreset with-DX2W_WITH_OPUS=OFF, in a fresh isolated environment with a hardware adapter and the inbox WARP.24 passed, 3 skipped. The skips are the WARP variants that need a 32-lane adapter:
startup_compute_indexed_atomic_uav_warp,startup_compute_dispatch_native_warp,startup_compute_dispatch_texture_native_warp.The tests from
mainthat go through the same function pass on hardware:startup_compute_dispatch_texture_warp,_texture_dims_warp,_two_mips_warpandstartup_compute_input_view_token_warppass too, as do the eightstartup_input_view_token*tests andnative_compute_manifest_reasons(0 of 32 manifest reasons wrong).The
native:line ofstartup_compute_indexed_atomic_uav_hardwareata96d1f6b:The rest of that output:
SHOULD
No WARP dispatch here either. The inbox WARP is 4-lane, so
_warpstops before any dispatch:A run on a 32-lane WARP has to come from another environment.
The run above is on a hardware adapter.
Unchanged:
CMakePresets.jsonis not edited by this PR, so theprfilter still selects none of these tests.Not addressed in this push. The three test files of the PR are identical at
393b80ebanda96d1f6b:countstill does not decide the result, and u0 is still the only atomic UAV.The NITs are not addressed in this push either.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T13:59:27Z.
SHOULD 2 on
393b80eb: adapter details for the 27-test run ona96d1f6b, as printed by the tests.Windows Sandbox on a Windows 11 host, build 10.0.26300. The debug layer was unavailable in the Sandbox, on both backends.
The earlier Sandbox runs posted here (
e1143678,393b80eb) used the same machine.Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T14:02:24Z.
Re-review of the delta
393b80eb→a96d1f6b(read-only, on Linux; no build or run here). Verdict: merge (0 MUST).git show --remerge-diff a96d1f6btouches onlysrc/startup_stubs/d3d12_compute_dispatch.inl. Main's view loop is kept, and the atomic UAV goes into all three places:output(... || half_typed || atomic), main'ssupportedpredicate (... || texture_input || atomic ||) andslot.atomic = atomicon main'sauto& slot. An atomic view leavesdimensionUNKNOWN andslot.texturefalse, as before. Dropping the branch'svolumeflag is safe: main'stexture_outputswitch maps dimension 2 to TEXTURE3D.393b80ebanda96d1f6b(7 files, +455/−7).git merge-tree --write-tree origin/main a96d1f6brc 0. Windows, Linux and gfx1013 CI pass ata96d1f6b. The hardware run ata96d1f6b(27 tests: 24 pass, 3 WARP capability skips) and the adapter table close SHOULD 2.These earlier SHOULDs remain open but do not block the merge: SHOULD 1 (no 32-lane WARP dispatch), SHOULD 3 (the
prpreset selects none of the tests) and SHOULD 4 (countdoes not decide the result, and u0 is the only atomic UAV). The NITs are unchanged.AI-assisted review.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T14:02:52Z.
Follow-up: the merge didn't go through. #3351 merged first (
0ed385dc), and the branch now conflicts withmainin one comment-only region.git merge-tree --write-tree origin/main a96d1f6brc 1 givesCONFLICT (content) … src/startup_stubs/d3d12_compute_dispatch.inl, with one conflict region: the header comment abovevolume_uav_range_error.srv <i> tex1d|tex2d|tex2da|tex3d|texcubearr table <param> <byte>(#3351 addedtexcubearr)texcubearr, followed by the indexed buffer atomic sentence (uav <i> atomic table <param> <byte>…matching the native compute pipeline.)Resolution: keep main's line with
texcubearr, then the branch's atomic sentence, then`smp`, `smpl` and `smpc` lines become static samplers. Entry. No code changes. Once that is pushed and CI passes, this is ready to merge. The review above (0 MUST) still holds.AI-assisted review.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T14:14:51Z.
Re-review of the delta
a96d1f6b→d3d0a657(read-only, on Linux; no build or run here). Verdict: merge (0 MUST).d3d0a657merges main0ed385dc(#3351 included), so the branch is current with main.git show --remerge-diff d3d0a657touches only the header comment ofsrc/startup_stubs/d3d12_compute_dispatch.inl: it keeps main'stexcubearrinput list and the PR's indexed atomic UAV sentence.a96d1f6bandd3d0a657(7 files, +455/−7). Theatomicflag still sits inoutput, in main'ssupportedpredicate and inslot.atomic = atomic.d3d0a657.The SHOULDs and NITs from the earlier reviews are unchanged and don't block the merge.
AI-assisted review.