Repository navigation
Conversation
A program that reads some GPU-selected heap slots raw and others with a one-channel typed load was refused under both heap view contracts: raw_buffer refuses the typed load, typed_dword the raw load. HeapViewContract::raw_and_typed_dword now lets the kind of each heap load pick its path: buffer_load_format_* (typed_buffer_srv) takes the typed_dword rules, every other kind (tbuffer included) the raw_buffer rules, byte windows included. Which heap index feeds which load stays the caller's guarantee; the comment and the doc say so. .views gains zero or more "also <slot> <type>" lines: further selections of the same dispatch, selector word k = selection k. The decoder refuses a slot named twice. refuse_global_srv_selections checks every selection; global_srv_contract returns raw_and_typed_dword when raw and typed selections are both present. compile_dxil and the fixture map the contract with a switch, and compile_dxil reports also=<slot>:<type>. The fixture's record takes --also SELECTOR TYPE (selector word 1), dispatches every selected slot and compares against the sum of the slot data (N+M in replay). Tests: native_global_srv_heap_replay_check.py section 11 records, compiles (fresh frontend cache, then a cache hit) and replays a mixed program for raw slots 0 and 1 with typed slot 3, checks a cross-slot mismatch, a refused typed selection, three replay refusals, nine compile refusals and four compile-only cases (two also lines, byte window, formatted byte window, plain tbuffer under the mixed contract). Refs R0Y00#3023 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for documenting the dependency on #3042. New translator PRs target |
|
Thanks, the contract split by load kind reads cleanly, and the limits are written down. I checked this from Linux
This comment was AI-assisted. |
|
Thanks. Working on all four points now; update with a new commit soon. AI-assisted. |
The selector word k is selection k, so two words can pick the same slot. The decoder now accepts a slot named again with the same view type and refuses only a slot named with two view types, so a file record writes decodes. An also line with trailing fields is unreadable. A bad --also selector in the fixture returns 2. Section 11 gains the second-also, repeated-slot, two-type and trailing-field cases and a raw+raw record, compile and replay of one slot picked by both words. The stride-read comment now names all three contracts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Done in 64513f2.
AI-assisted. |
R0Y00
left a comment
There was a problem hiding this comment.
Independently tested 64513f26 on cpp-migration a0f67731 (clean trial tree 80c5c815). I built compile_dxil native_global_srv_heap_replay and ran ctest --test-dir <build> --no-tests=error -j1 -V -R '^native_global_srv_heap_replay_(warp|hardware)$' in Debug and Release /O2. Each build passed all 196 assertions on RTX 4060 Laptop (driver 32.0.16.1656, Windows 11 26200.9974, debug layer off). Inbox WARP 10.0.26100.9818 returned 77 for lack of wave32. The repeated 0+0 selector round-trips, 0+1 gives the required mismatch, and the second also and conflicting-type controls refuse. Please update the old duplicate-slot wording in the PR body to reflect the new same-type behavior. The typed_dword contract still lives on the migration branch, so the previously agreed #3034/#3042 port order still determines when this can target main.
pigalot
left a comment
There was a problem hiding this comment.
Independently reviewed 64513f26 integrated over cpp-migration a0f67731 (tree 80c5c815), the PR's base. The merge is clean and git diff --cached --check origin/cpp-migration is clean.
What I traced.
- In
native_global_srv.h, selection 0 isselect/needand selection k is the k-thalsoline, in file order. - The decoder now refuses only a slot named with two view types. A slot repeated with one type is accepted, so a dispatch whose two selector words pick the same slot has a valid
.views. refuse_global_srv_selectionschecks every selection, and the first refusal wins.global_srv_contractreturnsraw_and_typed_dwordonly when at least one selection is raw and one is typed. Every captured typed slot must still be a one-channel 32-bit buffer.- In
heap_resource,raw_and_typed_dwordtakes the typed path only fortyped_buffer_srvloads. Every other kind stays raw, and the byte-window tracking applies as underraw_buffer.
JohnConnorNPC's findings, checked at this head.
- Duplicate slots: addressed.
- The raw+raw case records with
--also 0 raw_buffer, decodes and compiles. - The comparison with slot 0+0 matches. The comparison with slot 0+1 reports
mismatch word 0: got 0x40000000 expected 0x50000000 (reference slot 0+1).
- The raw+raw case records with
- Untested rules: addressed. Each rule now has a case that fails when the rule is mutated (table below).
- Coverage note: the GPU report now gives the head and the debug-layer status. My run below covers section 11 on a second GPU.
- Small items: addressed.
- The stride-read comment and the other heap comments name all three contracts.
- A non-numeric
--alsoselector exits 2. - An
alsoline with a trailing field is refused.
What I ran. I built native_global_srv_heap_replay compile_dxil in dev and release, then ran:
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^native_global_srv_heap_replay_(hardware|warp)$'native_global_srv_heap_replay_hardwarepasses in Debug and Release/O2on the RTX 5090 ("all checks passed", about 11 s). The output includesmixed_also_same_slot,mixed_also_twiceand "record with a non-numeric --also selector exits 2".native_global_srv_heap_replay_warpreports a capability skip (77) in both presets, by design.- Regression set, the selection from JB2WIN's GPU report:
ctest --test-dir out/build/dev --no-tests=error -j 1 -R '(native_|startup_compute_dispatch|compute_heap)'. 147 tests in Debug.- 140 pass.
- 4 report capability skips (77):
native_comparison_pso_warp,native_heap_handle_probe_warp,native_global_srv_heap_replay_warpandstartup_compute_dispatch_native_warp. - 3 fail:
native_cvt_pk_u8_hardware,native_sdwa_f16_irandnative_sdwa_f16_hardware. All three also fail oncpp-migrationa0f67731built alone, so they come from the base, not from this PR.
Mutants in src/startup_stubs/native_global_srv.h. Each was applied alone, the targets rebuilt in dev, the _hardware test run, and the source restored afterwards (git diff --quiet clean).
| Mutant | First failure |
|---|---|
| a repeated slot refused even with the same type | mixed_also_same_slot: refused instead of compiled |
| the two-types check removed | mixed_two_types: not refused with "slot 0 selected with two view types" |
the duplicate check covers only select/need |
mixed_two_types_also: not refused with "slot 3 selected with two view types" |
refuse_global_srv_selections checks only the first also |
mixed_second_also_wrong_type: not refused with "slot 2 has view type texture" |
global_srv_contract checks only the first also |
mixed_second_also_texture: not refused with "view type texture is not raw_buffer or typed_buffer" |
trailing fields on an also line accepted |
mixed_trailing_field: not refused with "unreadable also line" |
Verdict: approve on 64513f26. The base is cpp-migration, so this is a review only. I am not merging, and R0Y00's plan to retarget after #3034 and #3042 reach main stands.
Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029; the debug layer is off in the fixture.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on 64513f26.
This reply was AI-assisted.
|
I tested a clean local trial of Release on Windows 11 26300.10075, DXC 1.9.2602.17, RTX 4070 (32.0.16.2124) and app-local WARP 1.0.22 with Agility 1.620.2: cmake --build --preset release --target compile_dxil native_store_replay native_global_srv_heap_replay
ctest --preset release --no-tests=error -R '^(native_mtbuf_hardware|native_global_srv_heap_replay_(hardware|warp)|native_direct_container)$' -VAll four tests passed. Each heap replay emitted 217 passing assertions including the raw+typed selections 0+3 and 1+3, repeated 0+0, cold/warm identical DXIL, and the metadata refusals. On both adapters, the deliberate 0+1 reference for the 0+0 dispatch failed at word 0 (0x40000000 vs 0x50000000). This verifies the source-built compiler/replay stack on a main-based tree. The live heap contract remains tracked in #3023. |
|
Thanks for the quick turnaround on 64513f2. All four points from my earlier comment are addressed, and I think this is ready to merge into It can't target Should fix: the duplicate-slot wording that R0Y00 asked to update on the review is still in the body ("The decoder refuses a slot named twice, even with the same type"). GraphQL Notes, none blocking:
Opcodes: the diff adds no DXIL op ( This comment was AI-assisted. |
…for mixed reads Review note on R0Y00#3063: under raw_and_typed_dword the selection types come from the capture, not from the shader, so the header comment now matches HeapViewContract and the doc's Limits. Comment only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks. Done:
AI-assisted. |
Change
Target branch
cpp-migration. Refs #3023. Follow-up to #3042 (merged asa0f67731).Programs that read some GPU-selected heap slots raw and others with a one-channel typed load were refused under both heap view contracts:
raw_bufferrefuses the typed load ("a GPU-selected heap slot is read as a raw buffer SRV only"),typed_dwordthe raw load ("… read as a typed dword buffer SRV only"). This adds a third contract class for that mixed case.src/gfx1013_compute_native.h:HeapViewContract::raw_and_typed_dword, with its caller guarantee in the comment. The old clause "a program with two heap loads from different selectors is outside what one captured selection covers" is replaced by an explicit limit for every contract.src/gfx1013_direct_compute.inl,heap_resource: under the new contract the kind of each heap load picks the path.buffer_load_format_*(typed_buffer_srv) follows thetyped_dwordrules, including the one-channel limit. Every other kind,tbuffer_load_format_*through a plain or rewritten descriptor included, follows theraw_bufferrules: raw handle, byte windows and the loop guard. One line of logic changed; refusal texts are unchanged.src/gfx1013_compute_native.cpp: the byte-address rewrite of a heap descriptor is tracked underraw_bufferandraw_and_typed_dword.src/direct_compute_cache.cpp: cache identity/heap-view/raw_and_typed_dword.src/startup_stubs/native_global_srv.h:.viewsgains zero or morealso <slot> <type>lines, each a further selection of the same dispatch. Selector word k is selection k (select/needfirst). The header stays version 2; an older decoder refuses such a file withunknown line 'also'.slot N selected with two view types).refuse_global_srv_selections()checks every selection in order.global_srv_contract()returnsraw_and_typed_dwordwhen raw and typed selections are both present.tools/startup/compile_dxil.cpp: maps the contract with aswitchand uses the plural check at both sites. The report line gainsalso=<slot>:<type>.tests/native_global_srv_heap_replay.cpp:record … [--also SELECTOR TYPE]writes selector word 1.N+Mreference in replay).type_from_argumenthelper is shared by--needand--also.Why this step: on a local start-up capture (
compile_dxil --refusals, 2,689 slot 67 requests, counts only), 895 of the 906 programs with a typed heap load also read another heap slot raw. With this contract forced by an uncommitted switch, compiled requests go from 392 to 397. The others now stop at general refusals: 717unbound numeric SGPR sN, 460direct indexed descriptor load shape, 291direct descriptor address outside bound table. That is an upper bound for what translation allows. No runtime producesalsolines or binds heap slots under a contract yet; that is stage 3 of #3023.Verification
Environment: Windows 11 build 26200, NVIDIA GeForce RTX 3080 (driver 32.0.16.2124), MSVC 14.51.36231, Windows SDK 10.0.26100 DXC. Base
cpp-migrationa0f67731.native_global_srv_heap_replay_hardware: passed, 196 assertions (122 before), 12.5 s (11.25 s before). New section 11 uses a source-built mixed program: two selector words, a rawbuffer_load_dwordthrough one heap descriptor and abuffer_load_format_x idxenthrough another, with the sum stored..viewshasalso 3 typed_buffer.compile_dxil --requestswith a fresh frontend cache: compiled withfrontend_cache_hit=0, then=1with the same.cso..cso: the mixed program under the raw-only and the typed-only.views;alsowith a texture, wrong type, unknown slot, unreadable line, or a trailing field; a slot named with two types (the selected slot and analsoslot); a secondalsoof another type than its slot; a texture secondalso; a missingdwordline; a two-channel typed load.also, analsonaming the selected slot again with the same type, the samealsotwice, a byte window bybuffer_load_dword, one bytbuffer_load_format_x, and atbuffer_load_format_xthrough a plain heap descriptor.compile_dxiland the fixture built ata0f67731passes the 122 earlier assertions and fails at the first mixed record (the old fixture has no--also).compile_dxilrefuses a mixed.viewswithunknown line 'also'; the new one compiles it.typedset to false): the first mixed record fails.native_cvt_pk_u8_hardware,native_sdwa_f16_ir,native_sdwa_f16_hardware).compile_dxil --refusalson the local capture without a contract: identical to the base.Evidence and follow-up
clang -cc1as -triple amdgcn-amd-amdhsa -target-cpu gfx1013 -show-encoding); fixtures are source-built.docs/experiments/native-global-srv-heap-replay.md):raw_bufferconditions for every slot a raw load can select, and thetyped_dwordconditions for every slot a typed load can select.tbuffercounts as raw.Checklist
AI-assisted.
🤖 Generated with Claude Code