Skip to content

Shaders, GPU: add runtime stride table for structured buffers - #193

Closed
n-romanovich wants to merge 2 commits into
Marvisak:mainfrom
n-romanovich:feat/runtime-stride-channel
Closed

n-romanovich wants to merge 2 commits into
Marvisak:mainfrom
n-romanovich:feat/runtime-stride-channel

Conversation

@n-romanovich

Copy link
Copy Markdown

Implements the runtime stride channel described in #155 so structured-buffer accesses whose element stride is not recovered statically fall back to a host-maintained per-slot stride table instead of failing translation (a structured buffer of unknown stride).

Changes

  • victory-shader:
    • Added STRIDE_SPACE = 2 (t0), Shader::stride_table_handle(), and HostShader::stride_table: bool.
    • Added Lower::runtime_stride_offset for Loaded and Phi heap descriptors, reading stride from t0 (STRIDE_SPACE) at slot * 4 and emitting index * stride + off at all three structured-buffer idxen sites (load, store, atomic).
    • Updated Host::root_signature_for so standalone shader tests can bind the stride table.
  • victory-gpu:
    • Added stride_table serialization to shader_cache (bumped MAGIC to VSH2).
    • Declared the STRIDE_SPACE root SRV in pipeline/host.rs when t.stride_table is set and bound it in draw.rs.
    • Added a mapped UPLOAD StrideTable buffer (4 bytes per view-heap slot) to HostHeap in descriptor/host.rs, kept in sync across make_at, make_null, constant_at, and mirror.

Testing & Hardware Note

  • Added emit::tests::structured_buffer_unknown_stride_uses_runtime_stride_table covering buffer_load_dword ... idxen, buffer_store_dword ... idxen, and buffer_atomic_add ... idxen with stride = 0 in UsedResource.
  • Validated emitted DXIL with dxil.dll and ran on D3D12:
    • Microsoft WARP (VICTORY_WARP=1): passes with both Structured(12) and Raw descriptors.
    • NVIDIA GeForce RTX 5060 Ti: passes with Raw descriptors (107, 20), whereas dxil_kind = 11 (ByteAddressBuffer) reading a Structured(12) descriptor returns 0 on NVIDIA D3D12 (unlike WARP/AMD).
  • cargo clippy -p victory-shader -p victory-gpu --lib -- -D warnings: passed (0 warnings).
  • cargo xtask policy: passed (asset policy: 151 files ok).
  • cargo test -p victory-shader: 70 passed, 0 failed.

@DaviTostes

Copy link
Copy Markdown

Tested 4322b61 on Arch Linux x86_64, rustc 1.98.1: pass.

  • cargo test -p victory-shader: 57 passed, 0 failed (2 test binaries), including the {adds} test{'s' if adds != 1 else ''} this PR adds.
  • The shader crate is green; the GPU half of this PR is not covered by this run (I will check it against the host GPU separately).
  • The full workspace still needs Build: Linux workspace, contributor setup and CI #112 for the victory-gpu E0425.

No game data used.

@DaviTostes

Copy link
Copy Markdown

Follow-up on the GPU half: the test build does not compile, so the host-GPU side cannot be validated yet.

error[E0428]: the name `tests` is defined multiple times
    --> crates/victory-gpu/src/host.rs:1974:1
 252 | mod tests { ... }
1974 | mod tests { ... }

The shader crate is green (57 passed, 1 new test — see above), but the victory-gpu test target fails on every platform until the new test module is merged into the existing one in host.rs. This is the same rebase issue as #134/#135/#161/#175.

No game data used.

@Mesrine67

Copy link
Copy Markdown

I reviewed the current PR and agree this is a useful path for the unknown-stride failures. One failure path should be handled before dispatch: in crates/victory-gpu/src/draw.rs, when stage.stride_table is set but there is no host view heap or stride_table_gpu() returns None, the code logs and continues. The root SRV is then left unbound while the shader reads it; please make State::bind report failure and skip the draw/dispatch in that case.

I also ran an equivalent synthetic D3D12 implementation on PC-MIKE (Windows 11, Radeon RX 6750 XT) and WARP: an idxen store to element 1 of a structured UAV with stride 8 wrote to byte offset 8 on both. This was my local implementation based on d2a4bae, not a run of this PR's branch. The targeted test and workspace suite passed (265 passed, 0 failed, 4 ignored); the release build and strict library Clippy also passed. This confirms the offset logic on AMD/WARP but does not validate the game's rendered output or this exact diff.

AntoninMichelq pushed a commit to AntoninMichelq/VIctory-forkAMD that referenced this pull request Nov 24, 2026
…uctured buffers (Marvisak#155)) into the integration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
AntoninMichelq pushed a commit to AntoninMichelq/VIctory-forkAMD that referenced this pull request Nov 24, 2026
Shader PRs 136, 163, 164, 160, 176, 193, 177, 180, 138, 139, 145, 154,
156, 157, 162, 166, 168, 169, 179, 200, 226 and 25.

Marvisak#193's runtime stride table is combined with the runtime PRs:
- descriptor/host.rs keeps Marvisak#135's retire-on-keep, dynamic pool and
  sampler cap, Marvisak#185's Slots (made + directly indexed SRVs) and Marvisak#206's
  raw fallback for structured views off their host copy's elements. The
  stride table still holds the title view's element stride: a raw view
  made by Marvisak#206 starts at the same byte (raw_window never rounds), so the
  shader's index * stride + offset reads the same bytes.
- Slots Marvisak#193 did not know about now write their stride: a directly
  indexed SRV (Marvisak#185) when its record changes, and make_null_kind's
  typed null views (0).
- draw.rs keeps bind() returning whether it bound (with the stride table
  root SRV set inside it) and the bounded indirect argument copy.
- pipeline/host.rs keeps the per-stage subobject stream; the stride
  table root parameter merges cleanly.
- depth_bounds_test's HostShader gains stride_table: false.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
@gw1337x

gw1337x commented Nov 24, 2026

Copy link
Copy Markdown

In-game test on an RX 7800 XT (Windows 11 26200), diag build with VICTORY_D3D12_DRED=1. Build: main d2a4bae + #135 + #242 + #230 + #124 + #130 + this PR. The merge conflicts were formatting only, plus the new strides field in HostHeap::new next to #135's dynamic: extra.

Result: the host device is removed with 0x887A0001 (invalid call) at the first world frame, about 40 s after start. The same build without this PR reaches the opening cutscene and runs about 177 s; on this PC it has never ended in an invalid call.

host GPU device removed after a submission of 1 lists; breadcrumbs (done/count, list) []; list 0 of 1, of its 6:
dispatch 23x1x1 [compute 91b10a73e48b2192] | 91b10a73e48b2192: u4=0x12fffc0 [heap 622590: Placed(true, [1, 0, 0, 0, 5772, 0, 1, 65537, ...
device removed: The application made a call that is invalid. ... (0x887A0001)

An invalid call (rather than a hang or page fault) suggests a view description the host refuses, possibly one of the structured views this PR now makes. I don't have the D3D12 debug layer installed, so I can't name the call. I can rerun with a diagnostics switch if you add one.

@r4tedx

r4tedx commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Review question on the fallback path. When the stride is not known statically, the three idxen sites now take a raw handle and compute the byte offset themselves:

let byte = self.runtime_stride_offset(src, index, off)?;
(self.handle(site, src, false, (11 | u, 0))?, [byte, iu, iu])

The heap slot that handle resolves to still holds the view the title created, which for a structured buffer is a structured view (descriptor/host.rs mirrors the title's view as given). The description says of exactly that combination:

dxil_kind = 11 (ByteAddressBuffer) reading a Structured(12) descriptor returns 0 on NVIDIA D3D12 (unlike WARP/AMD).

So as far as I can read it, on NVIDIA these accesses would now read zeros where they were refused before, which is harder to notice than a dropped draw. Is there a place where the host makes a raw view for slots that are read through this path (I did not find one in the diff), or could the fallback be limited to slots known to hold raw views?

a structured buffer of unknown stride is the third row of #293 (about 276 draws per frame), so a before/after from a tester on both an NVIDIA and an AMD card would settle it. From reading only; I have no copy of the title.

@EduAzevedo

Copy link
Copy Markdown

Measured 4322b61 on the retail shaders (v1.0.2.1, Series X package), offline with victory translate --jobs 8 --list against main d2a4bae, same 26,148 programs:

  • a structured buffer of unknown stride: 117 → 0.
  • 71 of the 117 now translate (69 compute, 1 mesh, 1 pixel). The other 46 stop next at a lane-mask join of an untracked mask (22), a lane mask read as data (18), a descriptor read only as data (4) and a lane mask holding lanes elsewhere read as data (2).
  • No program that translated on main stopped translating.

This is translation only; it does not exercise the runtime stride table in a game run.

AI-assisted.

@AnoHunted

Copy link
Copy Markdown
Contributor

Tested 4322b61 merged onto main d2a4bae on NVIDIA GeForce RTX 5080, Windows 11, Rust 1.98.1, with dxil.dll validation on: pass.

  • cargo test -p victory-shader -- --test-threads=1: main 69 passed / 0 failed; this PR 70 passed / 0 failed (new tests: emit::tests::structured_buffer_unknown_stride_uses_runtime_stride_table).
  • cargo test --workspace -- --test-threads=1: main 264 passed / 0 failed / 4 ignored; this PR 265 passed / 0 failed / 4 ignored.
  • The new test passes on the GPU, but it only binds raw views (Stride::Raw / RawUav) to the slots read through the fallback. The PR description says the same combination with a Structured(12) descriptor read as ByteAddressBuffer (dxil_kind = 11) returns 0 on NVIDIA. In the game the slot holds the structured view the title built (descriptor/host.rs mirrors it as given), so the fallback would read zeros on NVIDIA rather than being refused. This matches the question above; the test does not catch it because it never uses a structured view. (From reading the diff; I did not run a structured-view variant.)
  • Suggested fix, untested: give the fallback a raw alias of each structured slot instead of the title's view. In HostHeap::make_at/mirror, for a structured buffer view in slot i, also write a RAW view of the same bytes (DXGI_FORMAT_R32_TYPELESS, Flags = RAW, FirstElement = first * stride / 4, NumElements = count * stride / 4) into slot i + N (N = view heap size, heap allocated at 2 * N). In runtime_stride_offset's callers use heap_slot + N for the dxil_kind = 11 handle, while stride is still read from table[slot]. Then add a Structured(12) case to the test, so it covers what the game does.
  • Separately, as noted above: when stage.stride_table is set but stride_table_gpu() returns None, draw.rs logs and continues with the root SRV unbound; skipping the draw would be safer than reading garbage.

No game files used.

@Mesrine67

Copy link
Copy Markdown

AMD validation on PC-MIKE (PR head 4322b61)

Hardware: AMD Radeon RX 6750 XT, driver 32.0.21045.29003. VICTORY_WARP and VICTORY_D3D12_WARP were unset.

  • cargo test --locked -p victory-shader structured_buffer_unknown_stride_uses_runtime_stride_table -- --nocapture --test-threads=1 passed. I confirmed the test created a D3D12 device with shader model 6.6, then ran the dispatch and assertion on the default hardware adapter.
  • cargo test --locked -p victory-shader -- --test-threads=1 passed: 70 passed.
  • On the unmodified PR head, cargo test --locked -p victory-gpu --lib -- --test-threads=1 fails to compile: crates/victory-gpu/src/host.rs defines mod tests at lines 252 and 1974. This commit renames the existing mod batch at the latter location to mod tests. Renaming that second module back to batch locally allowed the suite to build and pass: 43 passed, 1 ignored.

Please restore a unique module name for the latter block before merge. These are synthetic D3D12 tests; they do not yet verify the in-game world render.

@marquezinii

Copy link
Copy Markdown
Contributor

Ran 4322b61 merged with main (d2a4bae) on an NVIDIA RTX 5070 (driver 621.24), Windows 11, the SDK's dxil.dll validating: cargo test -p victory-shader 70 passed, cargo test -p victory-gpu 43 passed. Then a probe through the runtime-stride path: a compute program that loads [index, offset] from slot 0 and writes the loaded dword to a raw UAV, over data dwords 100..111, with the table entry and the bound view varied. Every module validates.

slot 0 view, table entry, index, offset RTX 5070 WARP console
raw view, 12, 2, 4 107 107 107
structured view (12), 12, 2, 4 0 107 107
typed RGBA32F view, 16 0 0 109
static path, structured (12), as on main 107 107 107
raw view, 0 101 101 101
raw view, 6, 1, 4 102 102 0x00670000

So the hardware confirms the concern raised above about the raw handle: the fallback's handle(..., (11|u, 0)) is a raw handle over whatever view the title put in the slot, and over a structured view NVIDIA returns 0 (WARP happens to return the data), over a typed view both return 0. The programs this lets translate would read zeros on NVIDIA instead of being refused. Limiting the fallback to slots that hold raw views, or a raw alias slot as suggested above, would avoid it. Stores and atomics through a structured UAV take the same handle; the test harness has no structured UAV, so I could not run that.

A second case, not raised yet: the condition now also lets a known stride that is not a multiple of 4 (2, 6, ...) take the runtime path, where it used to be refused. The runtime path issues a rawBufferLoad with alignment 4, which drops the low address bits, so stride 6, index 1, offset 4 reads dword 2 (102) instead of bytes 10..13. The table can hold such strides: view_stride falls back to the format size for typed views. Keeping the refusal for a nonzero static stride that is not a multiple of 4 would be safer.

Also: StrideTable::new returns None without a log line when it fails, which would make an unbound table (the point raised above about draw.rs) hard to see in a report.

An index whose index * stride passes 2^32 wraps on both GPUs, but the existing static structured path wraps the same way, so that is not new here.

Not covered: the title (no game data here).

@upipibi

upipibi commented Nov 24, 2026

Copy link
Copy Markdown

Independent check of head 4322b61 merged onto main d2a4bae. I read the comments above first. The main problem is already stated (the fallback takes a raw handle over whatever view the title put in the slot); I can confirm it on a third NVIDIA card, and I have one correction and two smaller points that are not above.

Confirmed on an RTX 3070 (driver 616.56): the PR's own test structured_buffer_unknown_stride_uses_runtime_stride_table, with only the SRV in slot 0 changed:

slot 0 view value loaded (want 107) atomics (want 20)
raw (as in the PR) 107 20
structured, stride 12 0 20
typed RGBA32F 0 20

So on this card too the programs this lets translate would read zeros from the structured views the title creates. The test binds only raw views, so no run of it shows this; and per the table posted above WARP returns the data through a structured view anyway, so a WARP-only runner would not show it even with a structured case.

A correction on the stride-6 case raised above (stride 6, index 1, offset 4, where the runtime path reads dword 2). By the RDNA2 ISA (30-November-2020), 8.1, p. 64, that is what the hardware does in its default mode: "For Dword or larger reads or writes of non-formatted ops (such as BUFFER_LOAD_DWORD), the two LSBs of the byte-address are ignored, thus forcing Dword alignment." (It is configurable: SH_MEM_CONFIG.alignment_mode DWORD / DWORD_STRICT / STRICT / UNALIGNED, same page.) So rawBufferLoad at byte 10 reading dword 2 agrees with the ISA unless the console runs in UNALIGNED mode, which I cannot tell. I would not refuse strides that are not multiples of 4 on that ground alone.

Against the ISA otherwise

  • The offset itself is right: 8.1.8, p. 65, buffer resource, "linear (stride * index + offset)", with stride from the descriptor; the PR computes index * stride + off.
  • Bounds differ within an element. ISA 8.1, p. 62: OOB = (index >= NumRecords() || (offset+payload > stride)) when the stride is not 0, and "Reads that go out-of-range return zero ... Writes that are out-of-range do not write anything." Through a raw handle an off at or past the stride reads or writes the next element instead. Only programs that address past their element hit it; worth a shortcut: comment.
  • A slot whose table entry is 0 (a null or unmirrored view, a texture) gives index * 0 + off: every index reads element 0, silently.

Smaller points not raised above

  • Source::Phi is handled by heap_slot but no test reaches it; the three sites in the test all use a Loaded descriptor.
  • The victory-gpu part reformats whole files that main does not keep rustfmt-clean (cargo fmt --all --check on main reports diffs in them): most of the 43 lines removed from descriptor/host.rs, draw.rs and pipeline/host.rs are line wraps unrelated to the change. That is what made the merges reported above conflict; leaving those lines alone would make this much easier to stack.
  • Merged onto current main, cargo check -p victory-gpu --tests compiles here, so the duplicate mod tests reported above is a matter of rebasing onto d2a4bae.

Run on hardware. NVIDIA RTX 3070, driver 616.56, Windows 11, Rust 1.98.1, dxil.dll from the Windows SDK 10.0.26100 validating; cargo test -p victory-shader -- --test-threads=1: 70 passed, 0 failed (main: 69). The two extra view kinds in the table above are a local change to the PR's test, run once each.

Verdict from here: the stride table and the offset are right; the handle is the problem. As it stands this turns a refusal into zeros on NVIDIA, so it should not go in without the raw alias (or a fallback limited to raw slots) suggested above, and a structured-view case in the test.

Not checked: the title (no game files here), AMD hardware, stores and atomics through a structured UAV.

AI-assisted (Claude Code).

@aycow

aycow commented Nov 24, 2026

Copy link
Copy Markdown

@n-romanovich I’m independently checking the descriptor-kind issue reported by @marquezinii on AMD, NVIDIA and WARP. The original synthetic matrix will cover typed and structured SRVs, UAV stores and atomics, differing strides and bounds, and descriptor and stride-metadata lifetime across a fence. Are you already implementing a raw-view alias or versioned stride metadata? I’ll bring the results back here so the fixture or fix can support your PR.

@aycow

aycow commented Nov 24, 2026

Copy link
Copy Markdown

I ran an original fixture using DXIL generated by 4322b61. AMD Radeon Graphics, RTX 5070 Laptop and WARP matched the complete CPU readback with the debug layer and full GPU-based validation using both native structured views and separate view-bounded raw aliases. This covered 8/12/16/20/32-byte strides, mixed strides, a typed RGBA32F SRV, structured UAV stores and atomics, and unchanged sentinel words.

In a separate characterization of the original descriptor-kind mismatch, NVIDIA read zero through both structured and typed SRVs. WARP read the structured data and returned zero for the typed view. The fixture also showed that flat address calculation can cross an element boundary within the view. The stride-6 control dword-aligned the address on all three adapters, so the console reference depends on the instruction's alignment rule. A fence-gated run returned the right results with immutable descriptor and metadata pairs. A dispatch using mutable shared stride storage observed the replacement value.

The test-only branch is based on your head. Compile with cargo test --locked -p victory-shader --no-run, stage the Agility SDK 1.620.2 DLLs under the test executable's D3D12 directory, then run the ignored tests structured_stride_alias_matrix, structured_stride_bounds and structured_stride_fence_lifetime separately with --nocapture. Exact fixture

Jarrrk pushed a commit to Jarrrk/VIctory that referenced this pull request Nov 24, 2026
…stride

Structured buffers whose element stride shader analysis cannot recover
now read it from a runtime stride table (a GPU buffer of u32 strides
indexed by view-heap slot) instead of failing translation. The GPU layer
allocates and binds that table and fills each slot when it makes a view.

Ported from Marvisak/VIctory Marvisak#193.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
suirentakamura referenced this pull request in suirentakamura/victory-suiren Nov 24, 2026
main moved under #193 and this branch. One conflict, in
HostHeap::new (descriptor/host.rs): #336 tries the heap with DYNAMIC
dynamic slots, then with MIN_DYNAMIC, then capped, and records the range it
got in `dynamic`; this branch puts ALIASES raw-view slots after the dynamic
ones. Both kept: each attempt asks for the alias slots too, the capped
count leaves room for them, the lease bitmap has `extra` entries as on
main, and `alias_base` stays `count + extra`. A merge rather than a rebase
so #193's commits keep their ids.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
suirentakamura referenced this pull request in suirentakamura/victory-suiren Nov 24, 2026
#193 moved: buffer views are clamped to what is left of the host copy, a
shader that reads the stride table without a host view heap is not run,
and a known stride that is no multiple of four is refused. Conflicts were
with main, not with this branch's change: `bind` already returns whether
the draw may run (#336), with its doc comment and the dropped counter, and
main already renamed the second test module in host.rs. main's side kept
in all three; #193's `return false` in the stride-table branch is in.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
MamaLeVrai added a commit to MamaLeVrai/VIctory that referenced this pull request Nov 24, 2026
…-together merge

Three hunks needed a choice: the dynamic-slot warning in descriptor/host.rs and the
blend/mask subobjects in pipeline/host.rs keep the all-together side (free-space
diagnostic, host_blend); buffer_srv keeps both the raw-start check and the
NumElements clamp of Marvisak#704.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
itsonlysimbo pushed a commit to itsonlysimbo/VIctory that referenced this pull request Nov 24, 2026
mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
…sak#709 on Marvisak#1077's root UAVs

Marvisak#709's test used Marvisak#294's Root::Uav; this host binds a zeroed root UAV
(SetComputeRootUnorderedAccessView) and reads it back after the views' UAVs.
Also the fork's track() signature, and stride-0 structured accesses keep the
fork's runtime stride-table view (Marvisak#193/Marvisak#704) after Marvisak#709's structured().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Marvisak Marvisak closed this Nov 24, 2026
simnJS added a commit to MiamiGame/XTP that referenced this pull request Nov 24, 2026
…, bounded (VIctory #193, #704)

A program that reads a buffer by element (idxen) without a stride known
at translation was refused ("a structured buffer of unknown stride",
three sites in emit/lower/buffer.rs): 179 programs of the pack (177
compute, 2 pixel), 210 draws and dispatches a frame in the Series S
world. With XTP_STRIDE_TABLE=1 they translate and read the view the
title binds at run time.

Shader side: Target.stride_table (off in Target::ANY, in Target::key);
the host's table at t0/space2 (STRIDE_SPACE), one StrideEntry of 8 bytes
per view-heap slot; RawWindow::covering; stride_entry and runtime_view
in descriptor.rs; loads, stores and atomics by element read the entry of
the slot they compute and access the raw view it names.

GPU side: each view heap keeps the table (upload memory) and 2^16 more
slots for raw views, counted in NVIDIA's 1,000,000 (taken from the
title's part of a capped heap); every descriptor write writes the
slot's entry with it, a structured or typed buffer view gets a raw view
of the same bytes; a root SRV at t0/space2 in each stage that reads it;
draw.rs binds it at each bind and drops the draw or dispatch when the
view heap has no table; shader cache VSH2 with the field.

Critical review (what was changed, not ported as is):
- An entry of zeros meant "the slot itself" upstream: a null, texture or
  constant slot (and every slot of a table of zeros) was read through a
  raw handle, a kind mismatch the hardware does not survive in general.
  Here zeros hold no view: the access is not made (loads 0, stores and
  atomics dropped). Raw views name their own slot.
- Bounds (producers' item 1, watch.md item 84): upstream accessed
  index*stride + off + bias unchecked, so an index whose product wraps,
  or off + width > stride, reached the bytes the raw view holds before
  the view (up to 12) or the next element. The entry now carries the
  view's element count (low dword: count, bias/4; high dword: stride/4,
  raw slot), and an access is made only at an element below it and
  inside the element (a raw view: inside its bytes), as the console's
  range checks do.
- Table races (item 2): upstream wrote the two dwords of an entry apart
  from the CPU while lists read them, and remade a raw view in place or
  for another slot at once. Here an entry is one 64-bit store, a changed
  view gets a raw view in another pool slot, and a raw view given back
  waits (with its host buffer held) until every recording that read the
  table before has gone, after its submissions (StrideHold, per heap,
  taken at the first bind). The slot's own descriptor and entry are
  rewritten in place, as the title's descriptor is.
- Release order: entries and raw views of dynamic slots are cleared
  before the slots are free (#704, 4e03086 by MichaelSmithAI).
- Buffer views are cut to their host copy and refused when the host
  would refuse them (past its end, no elements, a stride over 2048 or
  off 4, typeless without the raw flag): VIctory #193's f99b792 clamp,
  whose remaining count ignored the title's first element, and the
  buffer_view_ok of fxceless's VIctory fork (commit 578d459).
- #704 logged and ran a draw without the table; dropped here, as #193's
  head does.
- A raw view in the slot reads at the offset alone (stride 0: the
  console's descriptor of no stride), not index * 4.
- Switch off by default (item 4): no upstream run was safe (DEVICE_HUNG
  after 111 s; zeros on NVIDIA with #193 alone).
- Not fixed here: slots reached only by an index loaded at run time
  stay null views until a draw names them through a table (mirror zeros,
  item 3; r4tedx's gpu/run-time-indexed-views); the PCIe cost of reading
  the table from upload memory is not measured yet.

Tests (WARP): emit/stride_tests.rs (strides 4, 12, 16, 20, typed, raw,
views off 16 bytes, range checks with a wrapping index and the next
element, an entry of zeros, a slot loaded at run time, the switch);
descriptor/host.rs (entries follow the views, raw views kept while a
list may read them, views cut to their copy, a translated program run
through a real heap's table); draw.rs (a missing table drops the draw).

Mechanical fixes outside the task's files: the new Target field in
literals of apps/xtp/src/survey.rs, apps/xtp/src/translate.rs,
emit/lane_read_loop_tests.rs, emit/loop_limit_tests.rs,
emit/lower/tests.rs, emit/lower/uniform.rs, emit/mesh_tests.rs,
emit/split_tests.rs; the new HostShader field in emit/valu_tests.rs and
emit/waterfall_tests.rs.

Ported from Marvisak/VIctory#193 (head f99b792) by n-romanovich
Ported from Marvisak/VIctory#704 (head 1f3c184) by r4tedx, with its
release-order fix 4e03086 by MichaelSmithAI (its test, fb8ea43, is not
ported: here the entries are cleared in release_all itself, before the
slots' lock, so no other list can lease them in between)
Ported from fxceless's VIctory fork (commit 578d459) by fxceless (its
buffer_view_ok's checks, in fit_view)
alex3112 pushed a commit to alex3112/VIctory that referenced this pull request Nov 25, 2026
…d only through their descriptor) into the integration

Our descriptor data keeps its skewed and twin loads and the runtime stride table of Marvisak#193; the PR's new case (a four-dword structured buffer the program only counts the records of) joins our image-only case in the branch for descriptors nothing else uses. Parts gains psv; the PR's emit-based test helper replaces the hand-built one in valu_tests and names the target.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.