Skip to content

Shader: table reads the code computes mark their heap slots - #2822

Open
kais7654 wants to merge 1 commit into
Marvisak:mainfrom
kais7654:shader/table-reads-the-code-computes-mark
Open

kais7654 wants to merge 1 commit into
Marvisak:mainfrom
kais7654:shader/table-reads-the-code-computes-mark

Conversation

@kais7654

Copy link
Copy Markdown

A texture at a slot a computed table entry names — the program walks a table at
an offset it computes (a dynamic term in the descriptor's address, or a waterfall
loop's per-lane entry) — kept no read mark: only the reads of the resource heap
itself did. Lowering marked texture_reads for heap-direct sources
(is_heap_direct) and left every table read to the host, which makes the slot for
a fixed entry (the draw's table ranges) but nothing for a computed one — the
placed texture at that slot stays null forever. Fixes #2722 (the issue's analysis
of handle, in emit/lower.rs, names the exact seam — found by reading the code;
the issue author's analysis was assisted by Claude Code).

The gate is now marks_its_reads: a source marks its reads when it is heap-direct,
or when a loaded/fetched leaf's address comes from a Table root and is
computed — dynamic.is_some(), or the load is a waterfall loop's per-lane read
(waterfall::loads). A table read at a fixed offset still marks nothing, for the
draw makes that slot; a computed one lowers its runtime heap index (the index
heap_index already produces for the handle) and marks that, which the host
already materializes from the marks.

Tests: table_texture_reads_at_an_offset_the_code_computes_mark_their_slot
(emit) — a synthetic GFX10 compute program reads a texture through a table at a
fixed offset (marks nothing, as before) and through a table whose offset the code
adds (s_or_b32 s20, s4, 0; s_add_u32 s6, s4, s20, then s_load the descriptor
from s[6:7]): the lowered shader now carries the read mark, DXIL-valid.

Generated with Mistral Vibe.

A texture a placed table names at an offset the program computes (a
dynamic term in the descriptor's address, or a waterfall loop's per-lane
entry) kept no read mark: only the reads of the resource heap itself did,
so the host never learned which slot the program reads and the placed
texture there stayed null forever. Such reads now mark their heap index
like the heap's own; a table read at a fixed offset still marks nothing,
for the draw makes that slot.

Generated by Mistral Vibe.

Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
@fuzeofficlal

Copy link
Copy Markdown
Contributor

Verified 03914d9d on Windows 11 (RTX 5090 + WARP + Windows SDK 10.0.26100.0 dxil.dll):

@kotekompotek kotekompotek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right fix for the null-placed-texture gap: a fixed-offset table read is named by the draw's table ranges so the host makes that slot — but a dynamic offset or waterfall per-lane entry has no host-visible name, so it must go through Read marks like a heap-direct read. marks_its_reads keeps the fixed case unmarked (marking would cost without adding info) and the s_load-a-dynamic-term test covers both sides. LGTM.

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

This PR no longer merges cleanly into main: it conflicts in crates/victory-shader/src/emit/memory_tests.rs. Its content will be reviewed once it is rebased onto current main.


Generated by Claude Code

@futurepro62

Copy link
Copy Markdown

Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head 03914d9 (on its base 13f91ca).

Tested

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shaders: a texture read at a computed table entry sets no read mark, so a placed texture there stays null (since 2d6c0df)

5 participants