Skip to content

Port upstream correctness wave 6 (18 PRs: descriptor-as-data naming, uniform phis, GPU workers) - #6

Merged
devin-ai-integration[bot] merged 54 commits into
mainfrom
devin/correctness-wave-6
Nov 24, 2026
Merged

devin-ai-integration[bot] merged 54 commits into
mainfrom
devin/correctness-wave-6

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Wave 6 of the upstream port campaign: 18 PRs from Marvisak/VIctory merged into the fork (+4534/−604, 31 files): #1021, #1033, #1129, #1185, #1224, #1182, #1112, #1084, #1083, #1081, #1014, #1015, #1012, #1022, #1013, #1065, #1191, #1213.

Highlights:

  • Descriptors-as-data (descriptor_data in emit/lower.rs, #1083): a scalar load read only for its numbers now names what each dword holds instead of a single blanket error. uses collects every resource descriptor whose source leaves name the load; each Fields::Smem use writes per-dword Val::Missing with a reason (smem_reason), and the kind is inherited from a same-entry load used as a resource. Field-level reasons come from descriptor_field(image, rel) ("a buffer descriptor's stride or high address read as data", ...). A load through a root view's address errors as a root view's memory read with scalar loads; a table load with no use still reads the bound console descriptor words (#1198 behavior preserved for ray tracing).
  • Phi uniform heap indices (#1012, #1084): uniform_heap_index's Source::Phi arm recurses per-predecessor with cur_edge tracking so v_readfirstlane/sampler phi sources resolve correctly; mask_cond handles Scalar masks, i32 lane bits with wave64 hi, and Const via resource::inline decode.
  • GPU worker/pipeline machinery (#1191, #1065): dedicated ensure_workers() + WORK queue in pipeline/make.rs, budget() early-out, PIPELINE_STACK restored; GPU_RANGES + near_heaps report nearby heaps on DRED page faults.
  • Texture detile (#1014, #1015): UploadFootprint/footprint_size per-subresource detile loop with changed overlap filtering.
  • Net exports (#1213): union of export lists; test allows FALLBACK names (WSAConnectByList, GetAddrInfoExA, WinHttpGetProxySettingsEx) missing on the runner.
  • Tests ported: container.rs tail rebuilt (PSV0/signature sorts incl. rows_of_one_register_keep_element_order_not_column_order), bvh_tests/image_atomic_tests/root_view_tests/valu_tests gains, resource.rs joined-descriptor partial-write cases.

Notes:

  • All three lower.rs expectations from the conflict were reconciled: field-specific reasons replace generic OTHER; the s_buffer_load_dword buffer-view arm was dropped per #1083; the root-view scalar-load test now asserts success since root_view_smem (#1055/#1056) handles it.
  • Parts initializers gained crumbs: None (breadcrumb plumbing).
  • Clippy -D warnings and cargo fmt clean. Local tests pass except ~45 that require an SM 6.6 device (absent on this VM; they pass on the GPU CI runner).

Link to Devin session: https://app.devin.ai/sessions/39a24dfe2c184165b42b2108a96286b6
Open in Devin Desktop: https://app.devin.ai/desktop/session/39a24dfe2c184165b42b2108a96286b6?variant=devin
Requested by: @Personed

CaravelaLabs and others added 30 commits November 24, 2026 14:06
SDATA on s_atc_probe and s_atc_probe_buffer is a 7-bit immediate, the buffer resource is four dwords, and GLC/DLC are not operands of either.
…port when the device is removed

With `VICTORY_SHADER_BREADCRUMBS=1` in a diagnostics build, every loop of a
translated shader stores its iteration count (`atomicMax`) in a host buffer:
1,024 slots of 8 words, a shader's slot taken from its container's digest.
The buffer is a shared (system memory) one, so what the GPU wrote survives a
device removal; it is cleared before each submission. The shader reaches it
through a UAV in the last dynamic slot of each host view heap, at the index
the host passes in the first user-data dword past the console's: no new root
parameter and no per-draw binding. When the device is removed the failure
report names the five loops that counted most and the pipelines of their
slots, which says which shader's loop ran away where the removal data only
names a command.

Off, nothing changes: not the DXIL, nor the root signature, nor the shader
cache's key. On, the census translates and validates the same programs (the
validator accepts the extra UAV in vertex, pixel, compute and mesh shaders;
140,150 loop stores emitted in the 25,902 programs).

Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
…st lane, one atomic a wave

The breadcrumb of a loop was one `atomicMax` a lane a back edge: a wave of 32
or 64 lanes made that many atomic operations on the same word every
iteration. The loop count now goes through a wave maximum (`WaveActiveMax`,
unsigned) and the first active lane stores it, so the word still holds the
largest count any lane reached, with one atomic a wave. The store ends the
block of the back edge, so the block the loop's phis take as the edge's source
is the one where the edge ends.

The census (25,902 programs, validator) is unchanged with the switch on:
the same programs validate as with it off.

Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
The host driver compiles pipelines on our worker threads. On an RTX 5080
(driver 32.0.16.1692) NVIDIA's compiler (nvgpucomp64.dll) recursed past
the default 2 MB stack while creating a world compute pipeline
(c7d7a6283fad3cd6): "thread 'victory-pipelines-4' has overflowed its
stack", 0xc00000fd, then the pipeline was refused with E_OUTOFMEMORY and
its dispatches dropped. A 64 MB stack is reserved address space, committed
only as the compiler uses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The census's largest refusal row (771 programs at ffe310e) came from
three different places under one reason, so a census could not tell
which one to lower. Each now names what the program reads:

- a descriptor that scalar buffer loads (s_buffer_load_dword*) use
  first: its record count (dword 2) by the view's kind (raw,
  structured, constant buffer, other), or its address or format;
  "used by scalar loads before a vector access" when a vector access
  later decides the view;
- s_memtime and s_memrealtime as timestamps,
  s_get_waveid_in_workgroup as the wave's index in its group;
- scalar stores, scalar scratch loads and cache instructions.

A load through a root view's address now says it reads that view's
memory rather than "a descriptor read only as data".

Only the reasons change: every read stops the program as before, no
IR is emitted for them, and what translates today is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e a buffer view

A descriptor fetched from the resource heap by index has no used-resource
entry, so a scalar buffer load (s_buffer_load_dword*) through it was
lowered through a 64 KiB constant buffer handle. When vector buffer loads
read the same descriptor, the slot holds a buffer SRV (the title made it
one), and reading it through a CBV handle is a descriptor of the wrong
type, which D3D12 leaves undefined. Such loads now read the slot as a raw
buffer, as table SRVs already do. A descriptor also written through
(a UAV) and one only scalar loads read are unchanged.

In the title's shaders.rpf this changes 38,829 scalar loads in about 1,900
of 26,084 programs; emit and validation counts are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A descriptor every lane shares, chosen by an if/else nested in another,
reaches the outer join with an edge that is itself a join. Such an edge
was refused with "a descriptor chosen by control flow": each edge had to
be a heap load. The heap index is now computed recursively: a load's
index, or a phi at the join of what each predecessor computes at its end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The validator rebuilds ISG1/OSG1 from the module's signatures and
compares bytes. It sorts rows by register, then by semantic name offset
(DXC's sort_sig), not by column: with validator 1.6 every arbitrary
semantic has its own name, so rows of one register keep element order.
We sorted them by column, and a register whose elements come in another
order (a w channel declared before the xyz of the same register) failed
with "Container part 'Program Input/Output Signature' does not match
expected for module".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ir::build fills every instruction's register lists twice. `effects()`
collects `Vec<Reg>` (two allocations), and the caller immediately maps
each one into `Vec<(Reg, Value)>` (two more), freeing the first pair. For
lists that are almost always two to four entries, that is four
allocations and two copies per instruction, on every instruction of every
program.

Have `effects()` and its helpers collect the `(Reg, Value)` pairs
directly, with the placeholder the SSA pass fills in. Two allocations per
instruction instead of four; `Inst` and everything downstream are
unchanged.

Measured with the synthetic bench in #1002 (no game data), ten
interleaved rounds per arm, nanoseconds per instruction, at 256/1k/4k/16k
instructions:

  ir::build   308 -> 269, 375 -> 324, 407 -> 340, 402 -> 353  (0.835-0.878)
  translation 898 -> 872, 898 -> 825, 951 -> 875, 956 -> 912  (0.919-0.971)

gfx10::decode, structure, lower and the rest are unchanged. The emitted
DXIL is byte-identical at all four sizes.

cargo test --workspace --locked: 342 passed, 0 failed, 7 ignored.
Both clippy configurations clean; cargo xtask policy ok.
v_cndmask_b32 and v_*_co_ci_u32 refused when their scalar mask was not one
structure followed (a plain SGPR number). In compute with console lanes the
lane now tests its own bit of the register (pair in wave64); inline 0 and -1
masks are constants. Taken from upstream PR #585 (mask part only; its
descriptor-dimension hunk is left to the resource work).

Offline corpus (26148 programs): "a select on an untracked mask" 288 -> 0, no
new refusal text; those programs now stop at later refusals (descriptor read
as data +205, unknown stride +32, descriptor address/format +33), so compute
programs emitted only 1441 -> 1443. Synthetic test on hardware: fails before,
passes after. WARP cannot pin a wave size, so the test skips it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A descriptor dword the translation cannot rebuild from the host view
stopped the program with "a descriptor's address or format read as
data" (92 programs at ffe310e), whatever the dword. Each now names what
it holds: an image's address, array pitch or mip limits, compression
fields or metadata address; a buffer's address, stride or high address,
or format and swizzle. A census can then tell which ones a program
needs, as a buffer's stride, say, can come from the used-resource list.

Only the reasons change. Dwords past the descriptor keep the old one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Flag exactly DXC's gradient-op classification in non-mesh compute:
the implicit-derivative samples (60/61/64), the LOD query (81), and
the explicit derivatives (83..=86). Validators before 1.8 reject all
of these outside the pixel stage. Bfi and the dot products (53..=56)
are arithmetic and stay on 1.6; SampleGrad/SampleLevel (62/63) take
explicit gradients and are already accepted in compute.
The first commit left a heap descriptor of no listed kind that a vector
buffer store or atomic also uses on the constant buffer path, which is a
CBV handle on the UAV the title made. Scalar loads through it now read a
raw UAV (11 | 0x1000), as #1055 does for a table's UAV; read-only use
stays a raw SRV. The test's store case now expects no CBV handle.

In the title's shaders.rpf no program has this case (all 38,829 changed
loads are the read-only one); emit and validation counts are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-shader/src/emit/waterfall_tests.rs
#	crates/victory-shader/src/resource.rs
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-shader/src/emit/mod.rs
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
#	crates/victory-shader/src/emit/valu_tests.rs
Personed and others added 11 commits November 24, 2026 19:23
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-gpu/src/descriptor/host.rs
#	crates/victory-gpu/src/host.rs
#	crates/victory-gpu/src/lib.rs
#	crates/victory-gpu/src/pipeline/host.rs
#	crates/victory-shader/src/emit/lower.rs
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-shader/src/emit/container.rs
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-gpu/src/pipeline/make.rs
#	crates/victory-shader/src/structure.rs
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-shader/src/emit/shader.rs
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-gpu/src/texture.rs
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/victory-hle/src/modules/net.rs
…s, GPU workers

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Personed and others added 12 commits November 24, 2026 19:44
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…e-ops compute pipelines

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…line

Upstream's own DXIL for this shader is rejected by real adapters at
CreateComputePipelineState (E_INVALIDARG) on hardware and WARP alike;
upstream CI has no GPU, so it never ran. Revert the diag probe; run the
cases on whichever backend accepts, and report when none can.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration Bot added a commit that referenced this pull request Nov 24, 2026
…uniform phis, GPU workers)

Covers upstream PRs merged into devin/correctness-wave-6 (#6). The
untracked-mask v_cndmask test now tolerates adapters that reject the
emitted pipeline: upstream's own DXIL for it is refused at
CreateComputePipelineState on hardware and WARP alike, and upstream CI
has no GPU to ever see that.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot merged commit a566e8f into main Nov 24, 2026
4 checks passed
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.