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>
Owner
|
Thanks for documenting the dependency on #3042. New translator PRs target |
Contributor
Author
This was referenced Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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'.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, 174 assertions (122 before), 11.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 duplicate slot; a missingdwordline; a two-channel typed load.alsolines, a byte window, a formatted byte window, and a plaintbufferload.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