GetResultSize and GetResult only treated S_OK as success, so a provider finishing with S_FALSE and a payload left the caller's buffers untouched and the call registered forever. Any nonnegative HRESULT is a success code; return the size, let the provider write the result, report bytes used, and release the call. Add a regression completing with S_FALSE and an eight-byte payload.
v_cmp_lg_{f32,f16} ("less or greater") is ordered and not equal: false
when either operand is a NaN, on RDNA2 hardware as in the ISA. It was
lowered to `fcmp one`, which says the same, but the AMD D3D12 driver runs
`fcmp one` as unordered and returns true for a NaN. NVIDIA and WARP get it
right. It now lowers as `olt | ogt`, which all three run alike.
New GPU test v_cmp_lg_is_false_for_nan covers both widths: NaN on either
side, both NaN, a signalling NaN, +0 against -0, inf against inf and
against -inf, and junk in the unread high halves for f16.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
rustdoc warns that the module docs link to the private const MICRO
(rustdoc::private_intra_doc_links). Plain code formatting keeps the
reference without the broken link.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Its only callers (stub_pipeline_is_created, constant_color_validates)
are #[cfg(windows)], so on macOS/Linux the helper is dead code and
cargo check --all-targets warns 'function constant_color is never used'.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
describe looked only for a host texture, so every UAV over a buffer printed 'uav None' in device-removed reports and drop traces, though the view is made. It now prints the buffer's title range, as a buffer shader view does.
The previous commit proves that a loop's compares select the lanes of
the access and that its retry keeps exactly the lanes still waiting.
Every failure of that proof was reported with one reason. They now say
which part failed:
- the access is in no single-block loop ending in s_cbranch_execnz;
- the loop is nested in another or split over blocks;
- the compares do not select the access's lanes;
- the retry does not keep the lanes still waiting.
Without the per-lane form the proof cannot run. Nothing is emitted then,
and that failure is the one reported, as before.
Tests, all hand-assembled:
- the case ifBars reported on upstream PR #566 (the compares never
narrow EXEC), an access under a further mask, a retry that keeps other
lanes than those waiting, a wave64 retry of one half: refused, each
with its reason;
- the waterfall LLVM writes for GFX10 and later (a v_cmpx_eq chain, the
retry as todo & !EXEC, also folded into s_andn2_wrexec) is accepted in
wave32 and wave64, and each lane samples its own texture on the GPU;
- one loop per operand, the sampler's inside the resource's, is refused
by name. The console gives each lane its own pair there; following the
outer loop's reads into the inner block is left for later.
Other per-lane work in a waterfall loop is still taken to run once for
each lane; marked as a shortcut.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
image_sample_o was refused by name. Its offset dword (x in bits 0-5, y
in 8-13, z in 16-21, signed) becomes sample's immediate offsets when it
is a constant within DXIL's -8..7; a computed or wider offset is still
refused, now saying so. Module::int_value reads an integer constant.
translate --validate on shaders.rpf: vertex/pixel 12172 -> 12176
validated (all four).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fill_phis treats a phi no one read directly as dead and fills a value
with no DXIL form (an unsupported s_memtime result, say) with zero. When
that value reaches a read through two joins, the first phi is only read
by the second, so it was never marked read: the read lowered with a
zero where the same value read directly is refused with "a scalar
memory read as data".
Mark the incoming phis of every read phi as read, transitively, before
the phis are filled. The reproducer from #604 now agrees for the direct
and the joined read, and the dead control (the timestamp replaced by a
group id) still lowers.
'victory config' displays game_dir, cache_dir, and test_titles, but omitted data_dir (where saves, persistent local storage, and crashes.log are stored). It also omitted data_dir from the runtime asset-policy check loop in show_config().
Include data_dir in the output and policy check, and add a unit test in victory-core asserting that a data_dir inside the repository is refused.
Pixel programs that write SV_DepthLessEqual or SV_DepthGreaterEqual
failed validation: "Interpolation mode for PS input position must be
linear_noperspective_centroid or linear_noperspective_sample when
outputting oDepthGE or oDepthLE". The position is now declared
linear_noperspective_centroid in those programs, as DXC declares it;
without multisampling the value is the same.
translate --validate on shaders.rpf: vertex/pixel 12172 -> 12186
validated; the error is gone from the list.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A waterfall loop whose descriptor dwords are VGPR phis stopped with "a
descriptor read from the first lane of a phi" (294 programs of the
title on #307, all at if/else joins of two s_load_dwordx4 descriptors
copied into VGPRs). An EXEC if/else leaves two phis per dword: the
flow block's joins an arm's dwords with what lanes that skipped the arm
held before (inputs, unrelated loads and arithmetic in the title), the
join after the other arm picks per path. Only lanes that never read the
descriptor bring those other values, so tracing every edge fails.
Tracing (resource::track now takes the program's per-lane form):
- per-lane phis of one block are traced on each edge into it that the
lanes accessing the descriptor can take, from structure's lane
conditions (new Structured::reach, the exits' conditions, and
Bools::meet, a read-only satisfiability check); the trace starts from
what holds in the access's block. Edges no such lane takes are None
in the new Source::LanePhi { block, args };
- every per-lane write it follows (v_mov_b32 copies, v_cndmask_b32,
global_load_dword*) must run in all those lanes: a guarded one fails
with "a per-lane descriptor written where some lanes may keep the old
one". On #307 an else arm without its s_cbranch_execz traced as the
second descriptor for every lane;
- a loop header's phi fails with "a descriptor read from the first lane
of a phi at a loop header", words defined after the join with "a
descriptor partly joined by control flow"; without the per-lane form
(structurisation failed) the join is refused.
Lowering computes each traced edge's heap index at its predecessor's end
(through lane_heap_index, so loads, per-lane loads, choices and nested
joins work), joins them with a phi (0 on untaken edges) and makes the
handle non-uniform. The waterfall compares need no change.
Tests: the if/else of two loaded image descriptors, a join of a per-lane
load and a v_cndmask choice, nested arms choosing a buffer descriptor
with lanes that skip both and do not load (pruned only by the access's
condition), a loop header phi, and an unskipped else arm. On #307's head
the three join programs fail with "...of a phi" and the unskipped arm is
traced as one descriptor for all lanes. On an RTX 5070 and WARP, each
lane reads its own arm's texture or buffer; the shaders pass dxil.dll
1.8.2502.11. Reversing the phi's inputs fails validation, flipping the
heap index fails the GPU check.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A descriptor read with v_readfirstlane_b32 was traced to each lane's
own dwords wherever it was, so a first-lane read outside a loop, or one
without the v_cmp_eq that hands every lane its turn, sampled for lanes
the program skipped (reported on the PR with the back edge of the
fetched waterfall test replaced by s_nop).
Now:
- a compare counts only when it and the v_readfirstlane it reads are in
one loop (each block reaches the other);
- every descriptor read from the first lane needs each of its dwords
compared that way, or translation stops with "a descriptor read from
the first lane outside a waterfall loop".
Two tests cover the missing back edge and the missing compare.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
A host that refuses the title's slots plus 2^18 dynamic ones (NVIDIA's
1,000,000-view cap) now gets 2^16 dynamic slots, as before, instead of
losing mirrored title slots to the larger range: at the cap, 2^18 left
737,856 title slots against 934,464, and titles were seen to index slots
up to 917,140. The cap itself is unchanged. Hosts that take the larger
heap (RX 9070 XT) keep 2^18.
v_max_f32, v_min_f32, their three-operand and f16 forms and the packed
v_pk_max_f16/v_pk_min_f16 were lowered to DXIL's FMax and FMin. DXIL
specifies those as a compare and select, so with a -0 and a +0 either
zero can come out, depending on the operand order and the host; RDNA2
orders -0 below +0, so max(-0, +0) is +0 and min(-0, +0) is -0 in
either order. A -0 that should have been +0 then turns, say, a
following reciprocal square root's +inf into -inf.
A new helper keeps FMax/FMin for everything but two zeros, which it
resolves by their sign bits.
The resource tally in `victory translate` matched every `Source` variant
by hand, so the new `Select`, `Fetched` and `Lanes` kinds left it
non-exhaustive and `cargo check -p victory` failed. A fetched descriptor
is counted with the loaded ones; selections and per-lane choices are
never leaves.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
`cargo test` now and then never finishes: the seven emit::valu_tests
that run on the hardware adapter and on WARP start together on the
test threads, none of their dispatches completes, and the test binary
keeps one core busy until it is killed (the waits spin on the fence).
Any other GPU test running at that moment is stuck with them.
On an RTX 5070 with a Radeon iGPU, `valu_tests` alone in a loop on
main d2a4bae: 3 of 30 runs hang. With `run_cases` behind a
process-wide lock: 0 of 60, and the seven tests take under 7 s.
The lock is poison-tolerant, so one failing test does not fail the
rest.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Compute programs read SGPRs the hardware does not initialize when two
branches make the paths look like they allow a read before a write, even
though the branch that skips the write does not reach the read. That stops
translation with 'a hardware SGPR input is not supported' and drops the
program's dispatches.
ComputeIo::initialized_sgprs() counts the user SGPRs, the enabled system
ones and the scratch wave offset. A read of a general SGPR (0..=105) at or
above that count holds whatever the previous wave left, so no program can
depend on its value: read it as zero, as unset VGPRs already are. Reserved
registers (VCC, trap temporaries, M0, EXEC) keep their current handling.
An update that fit the user's 256 MB quota but not the host disk failed
with E_GS_QUOTA_EXCEEDED, which tells the player to delete saves. The
documentation keeps the two apart: E_GS_OUT_OF_LOCAL_STORAGE is the
device out of room and can come before the quota is reached. The disk
check also no longer credits the blobs an update replaces, since the
new version is written before the old one is removed.
XGameSaveReadBlobDataResult lists E_GS_PROVIDED_BUFFER_TOO_SMALL among
its errors, and the synchronous read already returns it; the result
passed on XAsyncGetResult's E_NOT_SUFFICIENT_BUFFER instead.
Alt or F10 sends WM_SYSCOMMAND SC_KEYMENU, and the default handling runs
a modal menu loop on the thread that owns the window, which is the
title's. The title stops drawing and reading input until a key ends the
loop, with nothing on screen to say so, and Grand Theft Auto VI aborts
itself about half a minute later (the deliberate write to 0 at
+0x23cf683). The window procedure now drops SC_KEYMENU, next to its
SC_CLOSE handling. The mouse can still open the window menu.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
They went through a 32-bit conversion, so an f16 past the i16 range
(32768 up to 65504) wrapped, and infinities and NaN were undefined. The
value is now clamped in f32 to the 16-bit range first (every f16 is exact
there) and NaN gives 0, as the hardware's conversions do.
exp mrtz's channel y is lowered to an SV_StencilRef output, but the
module's shader flags never had StencilRef (bit 11) and SFI0 never had
D3D_SHADER_FEATURE_STENCIL_REF (0x200). DXC sets both for a pixel
shader whose output signature has the stencil reference, and the
validator checks the flags against the module.
Both are now set when a pixel shader outputs SV_StencilRef.
The pipeline state validation part left PSInfo.SampleFrequency at 0.
DXC sets it when a pixel input is interpolated per sample (modes 6 and
7, which our lowering gives to PERSP_SAMPLE and LINEAR_SAMPLE
barycentrics) or is SV_SampleIndex, and the validator compares the
whole runtime info with what it derives from the module.
The flag is now set for such pixel shaders.
The f16 source (with abs/neg) is clamped to [-1, 1] or [0, 1], scaled by
32767 or 65535 and rounded to nearest even once from the exact product;
NaN gives 0. The product is formed in integers from the f16's bits,
because in f32 it has up to 26 significant bits and would round first.
Frame dumps decoded DXGI format 11 (R16G16B16A16_UNORM) as half floats,
so 0x8000 came out as -0 and 0xffff as -inf, and 12-14 were not handled.
Format 89 (R10G10B10_XR_BIAS_A2_UNORM) went through the B8G8R8A8 swap.
XPersistentLocalStorageGetPath documents E_FAIL for a pathSize smaller
than the path on Xbox devices; ERROR_INSUFFICIENT_BUFFER is the PC
result, which put_string gave us.
When HostHeap::dynamic ran out, State::tables skipped the fresh table and
the stage's user data fell back to the title's table offset. Constant
buffer tables are always made fresh and never mirrored, so the shader read
whatever host descriptor sat at those slots as a constant buffer; on AMD a
texture or null descriptor read as a buffer gives a wild base address and
the device is removed (#59: faults at 0x7000037xxxxx, 0x8000037xxxxx,
0x33c4000, a different pipeline every run, about 60 s in).
bind now reports that a table could not be made, and the draw, mesh
dispatch, dispatch or indirect execution is dropped. The dynamic range grows
from 2^16 to 2^18 slots, which the world did not exhaust on an RX 9070 XT.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
RtlVirtualUnwind and RtlCaptureContext want a 16-byte aligned CONTEXT,
and windows-sys 0.61 declares the x64 CONTEXT without align(16). In a
debug build the by-value copy in unwind_into, and the test's stack
context, landed 8 bytes off (an address ending in ...838), so
unwinds_like_the_system_walk crashed the whole victory-loader test binary
with a stack-overflow message and STATUS_ACCESS_VIOLATION. Aligning only
the test's context was not enough: the copy in unwind_into, which the
crash handler and stacks.rs also unwind with, faulted as well.
unwind_into now copies its context into an Aligned16 wrapper and unwinds
that; the test captures into one.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A descriptor held in VGPRs is used through a waterfall loop: each pass
reads the first active lane's dwords with v_readfirstlane_b32, compares
them with every lane's own (v_cmp_eq), runs the access with the lanes
that match and repeats for the rest. Tracing stopped at the readfirstlane
results ("a descriptor neither loaded nor built").
The tracer now follows the read lanes' dwords to where each lane gets its
own: global_load_dword* from a table or heap at a per-lane address (an
image descriptor's two x4 loads lined up), or a v_cndmask_b32 choice per
lane between such sources (e.g. two s_load descriptors). Other sources
fail naming them (LDS read, buffer load, phi, input, computed VGPRs).
The loop's compares of those reads with their own dwords are recorded.
Lowering gives the access each lane's heap index (its load address over
the descriptor size, or a per-lane select of indices) with
createHandleFromHeap's nonUniformIndex set, lowers the recorded
readfirstlanes as the lane's own dword and their compares as true, so
the loop runs once with all lanes. Wave32 and wave64 are tested.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
A descriptor picked without a branch, as the compiler does when it
hoists both loads (invariant memory) and turns the if/else into a
select, reaches the resource instruction through s_cselect_b64 per half
(or s_cselect_b32 / s_cmov per dword). None of its dwords is then a
load, so tracking stopped with "a descriptor neither loaded nor built"
and the whole program, and every draw using it, was dropped.
Such words are now split by the SCC value they all read: what each is
when SCC is set (S0) and when it is clear (S1, or the old destination
for s_cmov), with words not selected the same on both sides, and each
side traced on its own into a new Source::Select. Selections with
different conditions stop, and a choice that mixes two descriptors
still stops as "a descriptor changed after loading". The lowering picks
the heap index of the two loaded descriptors by SCC and creates one
heap handle, as a phi of loaded descriptors already does per edge.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66