An unimplemented import with the default Trap policy printed its name
and aborted. abort() is a fast fail: it skips the exception handlers
and the panic hook, which are what append to crashes.log, so the most
common bring-up crash left nothing there, not even which import it was.
The trap now reports through log_crash, which prints the same line,
appends it to the crash log and adds the title's last debug output.
cargo test --workspace does not compile on main: host.rs declares
#[cfg(test)] mod tests twice, once near the top for the warp adapter test and
once at the end for the Batch::texture_due tests, so rustc rejects the crate
with E0428 before running anything:
error[E0428]: the name ests is defined multiple times
--> crates\victory-gpu\src\host.rs:1974:1
The second block only touches Batch, so it becomes mod batch and keeps its
two tests. cargo test -p victory-gpu --lib goes from "could not compile" to
43 passed, 0 failed, 1 ignored, and cargo test --workspace compiles again.
Nothing else changes: one line, no test bodies touched.
Both returned no carry, so SCC was missing and a branch or select on a 64-bit scalar add or subtract failed to translate. They now share the carry logic of v_add_co_ci_u32 and v_sub_co_ci_u32.
A title texture's staging refresh ran as a host step of every list that
sampled it. When several lists in one submission sampled the same
texture, it was checked again for each of them. In physical-page memory,
which cannot be write-watched, each check is a VirtualQuery walk and a
blake3 hash of the whole texture. Every list's GPU copy reads the same
staging buffer after all submission-time steps have run, so checks after
the first one in a submission did nothing unless title memory had been
written in between.
Texture refreshes are now their own step. The submission's Batch, which
already merges buffer refreshes, records the staging buffers it has
refreshed. A Copy into title memory or a Run step (work that may write
title memory) clears that record, so a texture is checked again after
any such write, as buffer refreshes are.
A synthetic benchmark (ignored test, release build, 12 lists sampling
48 textures of 4 MiB): 576 hashes in ~690 ms before, 48 in ~60 ms
after (~11x).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The write-fault handler opens the guarded block under the guard lock,
then, if it found none, asks whether the address is writable without
it. Between the two, another thread's fault could open the block and a
copy could guard it again: the handler then saw a read-only block that
is in fact ours, declined the fault, and the title crashed on a plain
write (seen 1-3 minutes into the world under Wine, where exception
dispatch is slow enough to hit it every run).
The lock is now held across both checks, so a block that is not ours
while it is held really is not ours.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
XMemAllocatePhysicalPages makes SEC_RESERVE sections and commits their
pages one view at a time. Under Wine each commit is a wineserver request
that scans every range committed so far, so wineserver ran at full load
while the title's threads waited on it, and loading hardly moved.
Under Wine (detected by ntdll's wine_get_version export) the sections
are now SEC_COMMIT and the per-view commit is skipped. Wine backs a
committed section with a sparse file, so untouched pages still cost
nothing. Windows keeps SEC_RESERVE, since a busy host may be unable to
commit the 6.1 GiB the title asks for in one go.
Tested: Linux (Wine 11.21), i7-12700K, RTX 4070. wineserver load drops
after the first seconds and the title gets to its loading screen,
drawing and dispatching.
Use the descriptor count already validated by the PE parser, so the directory size need not include the null terminator. Check the OS-assigned static TLS index on a mapped test DLL.
Expanding a rectangle list makes the fourth corner from the other three,
element by element. An element that reaches past the vertex stride (the
input layout allows it to overlap the next vertex) was read and written
past the vertex's bytes, which panicked at submission. Only the
components inside the vertex are computed now; the rest keep the first
vertex's bytes, as unknown formats already do.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With indirect execution the world's first frame asked for over 1,200
pipelines at once and took more than 30 s, so the title's own GPU
watchdog ended the run. Host pipelines are now made by worker threads: a
first use waits at most 0.5 s per title frame, and that pipeline's draws
are dropped until it is ready. The world presents frames again, and
indirect execution is the default (the switch is gone).
Pipelines are cached across runs:
- every host pipeline goes into a pipeline library saved under the cache
folder (named by a hash of the translated code, our root signature and
the state; a blob the device rejects starts an empty library);
- the pipelines drawn with are remembered and started during loading on
the next run.
One cold and one warm run: the last pipeline was ready 38 s after the
world's first frame cold, 1.4 s warm; the first world frame took 3.2 s
cold, 0.37 s warm.
Also:
- Copy-backs of shader-written ranges return only the bytes the GPU
changed; they used to overwrite what the title's CPU wrote meanwhile,
which crashed the title.
- Indirect dispatch records are bounded (group counts were not), and the
console's single-dispatch argument type runs as a dispatch.
- Per-shader counts of dropped draws in the diagnostics log; a switch
that submits and times each list alone.
Not working yet: the world shows no geometry, and runs end on a GPU page
fault after at most about 55 s.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
write_physical mapped, committed and unmapped a view for every 64 KiB
page it wrote, and DirectStorage decoded each page-destination request
into a zeroed buffer first, then copied it. Every unmap flushes every
core's TLB, so with all the workers loading at once these writes were a
serial cost per page.
Pages are now looked up once and grouped into runs of consecutive slices
of one section (how titles allocate them), and each run is written
through one view. When a request's pages form a single run, DirectStorage
inflates or unpacks straight into that view instead of a buffer; pages of
several allocations still go through the buffer, written run by run.
Synthetic release benchmark (16 MiB destinations, Ryzen 9 5900X):
8 threads 3.5 -> 7.8 GiB/s; one thread, buffered then copied 0.96 GiB/s
vs in place 2.1 GiB/s.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add lowering for v_xnor_b32 and v_swap_b32 (seen in GTA VI world compute shaders), and record v.dst as a read in ir.rs for v_swap_b32 / v_swaprel_b32 since both operands are read before being swapped.
When a title creates a null buffer view (resource == 0, ViewDimension == BUFFER), buffer_bytes(0) returns None, so null_for() fell through to null_like() / null_view() (or a 2D texture UAV) and emitted a 2D texture descriptor into a slot where a shader expects a buffer.
Check desc[1] == 1 (D3D12_SRV_DIMENSION_BUFFER / D3D12_UAV_DIMENSION_BUFFER) in null_for() for both View::Shader and View::Unordered so null buffer views get a matching null buffer descriptor.
find_input matched each input element with
`(row and channel in the element).then_some((id, channel - e.col))`.
then_some evaluates its argument first, so the subtraction ran for every
element, also those whose first channel is past the one asked for. In a
build with overflow checks (tests, debug runs) a pixel shader reading a
channel below any element that starts at z or w panicked, whichever row
that element was in, and packed inputs such as a float2 in .zw are
common. Release builds wrapped and threw the value away.
then() computes it only when the element holds the channel.
Found with a random-input harness over pixel, vertex and mesh programs
with matching signatures. The new test panics without the fix.
Windows 10 maps the prepared image with both entries empty. The binder already retains the original slot RVAs, so preparation need not locate a linker-provided terminator.
Fixes a real-hardware NVIDIA bug in fract() from 36eb0b4 and adds synthetic GFX10 -> DXIL -> GPU/WARP regression tests for the RDNA2 VALU lowerings from #2:
- fract(): select(OGT(r, k), k, r) is folded by NVIDIA's DXIL compiler into FMNMX (minNum), which swallows NaN and turns v_fract_f32(NaN) into 0x3f7fffff (and v_fract_f16(NaN) into 0x3bff). Comparing with pred::OGE against a distinct threshold (1.0 for f32, 1 - 2^-12 for f16) prevents the minNum fold and preserves NaN and +/-inf -> NaN on both NVIDIA hardware and WARP.
- valu_tests.rs: builds minimal synthetic GFX10 compute shaders, lowers them through the full pipeline (ir::build -> resource::track -> io::raise -> structure -> lower), validates with dxil.dll when present, and executes them via Host::dispatch on both hardware GPU and WARP without requiring console dxc. Covers v_fract_f32/f16, v_med3_f32/f16, v_sin/v_cos_f32/f16, and v_bfe_i32/u32 + s_bfe_i32.
Co-authored-by: BlueKaiman <[email protected]>
Removes the print-only dbg_tls test in image.rs (TLS presence is already asserted in parses_own_test_binary) and switches layout.rs offset helpers (read_u32, read_u64, optional_header_offset, file_header_offset, data_directory_offset) to checked arithmetic so extreme offsets return None instead of overflowing.