Repository navigation
Upstream: 10 fixes taken from upstream's rewrite commits (stacked on #716) - #767
Open
coderanonymus wants to merge 160 commits into
Open
coderanonymus wants to merge 160 commits into
coderanonymus wants to merge 160 commits into
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
- indirect.rs: the timing rig kept the written depth view it never reads after setup; drop the field. - draw.rs: the scissor census sorts by a reversed key. - resource.rs: placed_filler_twins is read only by the diagnostics build's copystat; allow it to be dead without the feature, as shadow and pipeline do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… frames A frame that ends in a packet where no frame begins (the tail of a frame that crossed packets, then padding) left the next frame pointing into that padding, which ended the stream early. Now the next frame is found by following each packet's skip to the next packet with frames. (cherry picked from commit ba42db6)
… now Our own completions looked their call up again by block address: after a provider's DoWork returned, after a cancel, after a failed begin, and when queued DoWork ran. A provider usually ends its call itself (XAsyncComplete from DoWork or Cancel), and once it has, the title may begin a new call on the same block, from its completion routine or from a thread that polls the status. The lookup then found that new call: - the old call's DoWork result (S_OK, size 0) or cancel (E_ABORT) ended the new call before it had done anything, ran its cleanup and fired the completion routine a second time; - DoWork still queued for a canceled call ran the new call's DoWork. Each queued DoWork now carries the call that scheduled it and runs only while that call is still the block's, and DoWork, cancel and begin complete that call. A call that is already over ignores a second complete, so nothing reaches the next call. XAsyncComplete itself still goes by block, as providers name their call by its block. (cherry picked from commit d01b170)
Fail when a requested scan root cannot be opened. Report traversal errors below a readable root alongside the other skipped inputs. (cherry picked from commit b1bdd89)
A callback submitted with a delay waited on a thread of its own and was delivered when the delay ran out, whether or not the queue had been terminated meanwhile. XTaskQueueTerminate only canceled what was already in the ports, so a pending delayed callback was not canceled: it ran later as live work (canceled = false), after the termination callback, by which time a title may have freed what the callback uses. The queue now keeps its delayed callbacks in a list until their delay runs out. Terminate cancels them along with the queued ones, before it calls the termination callback, and a delay that runs out after that finds nothing to deliver. A submit racing Terminate checks `terminated` under the list's lock, so the callback is either canceled or refused. (cherry picked from commit b9ff219)
`victory run GTA6.exe`, run from the game folder, gives an exe path with
an empty parent, and that empty folder was mounted as G:. An empty path
cannot be made absolute, so the root stayed empty and G:\x64\a.rpf
became \x64\a.rpf: the root of the current drive. The title then found
none of its files.
An empty root is now the current directory, which is what an empty
folder means everywhere else (`Path::new("").join("x")` is `x` in the
current directory). Passing a path with a folder in it is unaffected.
(cherry picked from commit 01ae55a)
imdct_half worked out every pre- and post-rotation with sin_cos on each call (n of them per subframe) and ran its FFT on two fresh Vecs. The rotations, the bit-reversed order and the butterfly rotations now come from a table built once for 128, 256 and 512 samples; the work buffers live on the stack. Every value is computed with the same expression (the butterflies with the same running product), so the output is bit for bit what it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 4eb0898)
Decoder::decode took the caller's bit count as the end of the frame. Past the data the bit reader returns zeros, and a stereo tile header reading only zeros gives the subframe to no channel, so it never moves on; with a count beyond the data it never overreads either, and looped for good. Clamp the end to the bits the data holds. A frame from read_frame always holds its bits, so its decoding does not change. Add deterministic noise tests (xorshift64, fixed seeds, as BCPack's): buffers of noise packets, streams of noise frames with clean and damaged headers, frames in mono and stereo at each sample rate, bit counts past the data, and read_frame and packet at any offset. Every walk is bounded and every decode must give one frame of samples. The bit-count test hangs without the fix; the others pass on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit d4d1822)
GetModuleFileNameA/W on the host clears the thread's last error when the name fits, and code tells a truncated name from a whole one by it (grow the buffer while the last error is ERROR_INSUFFICIENT_BUFFER; or fail if it is, also when the name filled the buffer exactly). Our answer for a title image set the error when the name was cut and left it alone otherwise, so after one call with too small a buffer, or after any earlier call on the thread that left 122, a whole name still read as truncated. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> (cherry picked from commit 3c7d845)
When a frame ended a loop, decode cut it at the loop's end subframe, set the loop's skip (the subframes of the loop's first frame that lie before the loop) and then took that skip out of the frame in hand: the loop's last. So the head of the last frame was dropped instead, and the first frame played from its start, with the audio before the loop in it. The number of samples came out the same; the seam did not. The pending skip is still applied to the frame in hand, and the loop's skip is set after it, for the frame decoded next. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> (cherry picked from commit 985d8d4)
The source resolver's rule (local files only) knew a share as `\..`, `//..` or `file://server/..`. The host knows more spellings: any two leading separators (`/\server\share`), the object manager's prefix (`\??\UNC\server\share`), and a `file:` URL with no host whose path starts with two separators (`file:////server/share`, `file:\server\share`, also percent-encoded). Those fell through as relative paths or drive-less local files and went to the host's resolver unchanged. They are refused now, naming the server. Paths with one leading separator, a drive after the slashes or the prefix, and the path of a URL that names this machine pass as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> (cherry picked from commit 11ca3ce)
(cherry picked from commit e57e76a)
Stack dumps (VICTORY_STACKS, diagnostics builds) read another thread's TEB right after NtQueryInformationThread and suspended it only later: a thread exiting in between frees its TEB, and the read faults. The thread is now suspended first and resumed on every way out. The dump times went through Duration::from_secs_f64, which panics on `inf` or `1e20`, killing the dump thread (the crash hook logs it as a crash). They are parsed by `schedule` now, which leaves out NaN and times no Duration holds. 1 new test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit acdcc41)
Calls are filed by their block's address, and a call that succeeded with a result stays filed until XAsyncGetResult takes it. XAsyncBegin refused any block whose address had a call filed. So when a title never took a result and freed the block, the next block it was given at that address could not begin a call: E_INVALIDARG, every time, with the old call's provider never cleaned up. A zeroed block is a new one: the block of a result left behind holds the result's size, so it never reads zero. XAsyncBegin now ends a finished call filed under the address of a zeroed block (its provider gets its cleanup) and begins the new one. A call still in flight keeps its address, and a block still holding a result is refused as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> (cherry picked from commit 5cff000)
… forever The decoder fills an XMA voice's output ring until the write block (word 0, bits 27-31) comes round to the title's read block (word 9, bits 0-4). The write block wraps modulo the ring size (word 0, bits 22-26), and so does a read block moved on by command 18, but a read block the title set up at or past the ring's end was compared as it was: no write block ever equalled it. With a stream that loops forever the pass never ended, holding that voice's lock, so the title's next command on the voice (advance, disable) waited for good, and releasing the context arrays did too. Take the read block modulo the ring size as well, as the write side already does. A test sets up read block 6 on a ring of four with an endless loop and requires the pass to end within seconds, with blocks 0 and 1 filled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 1054fe8)
No graphics object's interface list holds IUnknown, so QueryInterface for it (and every call that hands out an object by interface id) said E_NOINTERFACE and returned null. COM code asks for it to compare two pointers for identity, to keep an object as a plain reference, or to pass it on to an API that takes any object. object::is, which all of those go through, now also matches IUnknown. The DXGI device answers with the D3D12 device, which it already stands for: one pointer whichever of the object's interfaces is asked. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> (cherry picked from commit 92f2c60)
XStoreQueryPackageIdentifier documents E_INVALIDARG for a store id that has no installed package. We returned XPackage's 0x89245208 instead. (cherry picked from commit e3bef08)
host::module held the module cache's lock while it called LoadLibraryExA. Loading a DLL that is not loaded yet takes the OS loader lock, and title code runs under that lock too (a title DLL's thread attach, TLS callbacks run as threads start), where it can need the cache: any first use of a host! function, or a late-bound title DLL. One thread holding the cache and waiting for the loader lock, another holding the loader lock and waiting for the cache: the process hangs, and cannot even exit, as ExitProcess needs the loader lock too. The cache is now looked up, then unlocked for the load, then locked again to keep the handle; a thread that loaded the same DLL meanwhile got the same module, which stays loaded. (cherry picked from commit c6959ac)
(cherry picked from commit 93a24b7)
The MicrosoftGame.config reader ended a tag at its first '>', but XML allows '>' unescaped inside an attribute value. A value with one (DefaultDisplayName="A > B") cut the tag short: its '/>' was never seen, so the element stayed open and every element after it was read as its child. Game/TitleId and the storage quota were then not found, and the title ran as id 00000000 with no storage quota, its saves and temporary files in that folder, without a warning. A tag now ends at the first '>' outside quotes. (cherry picked from commit d549b63)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit e6ebec9)
XGameUiShowTextEntryAsync documents a 1024-character maximum on console, 1024 for a maxTextLength of 0, and 1024 for the Password scope whatever the title asks. 0 meant no limit here, larger limits were kept and the scope was ignored. (cherry picked from commit 936e5e5)
A slice may not start at null, even an empty one, so asking for a title image's name with (NULL, 0) was undefined behaviour; a debug build aborted the process. A null buffer is now no buffer: nothing is written, 0 is returned and the last error is ERROR_INSUFFICIENT_BUFFER. (cherry picked from commit c000581)
A literal is 32 bits; in a 64-bit operand the hardware sign-extends it when the operand is signed (i64) and zero-extends it otherwise (LLVM's AMDGPU operand rules). Every literal was zero-extended, so v_cmp_lt_i64 v[1:2], -100 compared with 4294967196, and so did the other i64 compares, v_ashrrev_i64 and s_ashr_i64. Literals of operands of i64 instructions are now sign-extended, in the vector and the scalar paths. (cherry picked from commit 7d04943)
…nd invalid enum values (cherry picked from commit e6fe8ec)
…IResult slot (cherry picked from commit 2c22e2b)
(cherry picked from commit a3f89ed)
(cherry picked from commit 75fe6c0)
…mit 59035de) A list's scratch chunks now grow: each new chunk is twice the last, at least what is asked, at most SCRATCH_CHUNK, instead of every chunk after the first being 4 MiB. A length whose 256-byte rounding overflows gets None instead of a debug-build panic or a wrapped, empty allocation. Diagnostics builds log each chunk taken (target victory_gpu::scratch), and a new chunk's buffer name carries its size, now that chunks come in several sizes. Port notes: reimplemented by hand; the fork's scratch is a different design (chunks shared between lists through the Spare pool and given back on reset, a 256 KiB first chunk, VICTORY_SCRATCH_POOL=0 for 4 MiB chunks kept by their list). The growth applies to the shared chunks only and starts from the fork's SCRATCH_FIRST rather than upstream's 64 KiB; sizes are powers of two (upstream: multiples of 64 KiB) so that the pool, which matches sizes exactly, keeps few size classes. VICTORY_SCRATCH_POOL=0 keeps 4 MiB chunks as before. The fork already skipped chunks that do not fit with a while loop, so upstream's if-to-while change was present. Upstream's test is adapted: chunk sizes follow the fork's policy, and after a reset it checks that shared chunks went back (their addresses can be taken by other lists in between) or, without the pool, that the list's own first chunk is used again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The GPU shader tests dropped Host::new's error, so a machine without a usable device printed only "no SM 6.6 hardware device; skipped". On Windows 10 without the Agility SDK (fxceless#84) the hardware adapter reports SM 6.5 and WARP SM 6.2; the 15 VALU and waterfall tests then fail with "neither hardware nor WARP SM 6.6 device available" and nothing says the runtime is the cause. The seven skip sites now print the error: no SM 6.6 hardware device (the device supports SM 0x65 only); skipped no SM 6.6 warp device (the device supports SM 0x62 only); skipped Checked on Windows 10 22H2, RTX 3060 + RTX 3090: both clippy runs of CI pass; the victory-shader tests give the same 105 passed / 15 failed as before, now with the reason. (cherry picked from commit 100de0e) Port notes: the fork's valu_tests run_cases_on loops over a `devices` slice instead of upstream's fixed hardware/WARP pair; the conflict was resolved by keeping the fork's loop and taking upstream's match. The fork has six more skip sites with the same `let Ok(host) = ... else` shape (intersect_tests, rect.rs, four in wave64_tests, the latter saying "not run"); they print the error the same way. The two sites that skip silently (valu_tests' wave-size f64 case, mod.rs' optional run after validation) are left as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit e52777a) Port notes: the fork already passed the initial pipeline into new_list and set it in the list's draw state (with its own doc comment and the fork's `earlier`/`gate` list fields); what was missing is the `pipeline::bound` call after a successful hand-out, so a pipeline first bound at list creation now logs its "first bind" like set_pipeline and reset do. The fork's `#[cfg(not(windows))] let _ = pipeline;` is gone since `pipeline` is now used on every target. Upstream's test is kept as is; the fork's create_compute, ComputeHead and pipeline::bound match upstream's for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit f096774) Port notes: the fork's Host also carries the adapter (for the video memory budget) next to the presenter, and its resize path first settles presents sent ahead and logs the new buffers and video memory. Kept all of that; the settle_now(WHY_SYNC) wait moved inside the throttled closure, so a frame skipped by the retry wait does not stall on the GPU. The fork's video-memory logging around swap-chain creation stays as is. Upstream's test was added next to the fork's existing host tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ted() GetCopyableFootprints does not pad the final row of the final subresource to RowPitch, so pitch * rows * depth in Staging::detile can exceed the mapped upload buffer size (UB in from_raw_parts_mut). committed() also used unchecked p + len (wrapping to end < p in release) and ignored PAGE_NOACCESS / PAGE_GUARD. - Keep Staging.size unconditionally and clamp subresource slice length to size - footprint.Offset via subresource_len(). - Check overflow with checked_add / saturating_add and reject PAGE_NOACCESS / PAGE_GUARD in committed(). - Add regression tests for both. (cherry picked from commit 4fc9d70) Port notes: the fork's Staging already keeps the buffer's size unconditionally in `bytes` (the same `total` from GetCopyableFootprints that sizes the upload buffer), so detile clamps against `self.bytes` and the diagnostics-only `size` field stays as it was. The fork's committed() asks QueryWorkingSetEx page by page by default (saturating, no wrap) and only uses the VirtualQuery walk (committed_by_query()) under VICTORY_COMMITTED_QUERY=1; upstream's overflow and PAGE_NOACCESS / PAGE_GUARD hardening goes there. The regression test runs against both committed() and committed_by_query(), next to the fork's title_memory_tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge flags) (cherry picked from commit c0228d9) Port notes: the fork's emit_indices also culls a primitive whose corner names a vertex past the written count (min of max_vertices and the lane count), so on the fork the 10-bit mask did not read out of range but made every edge-flagged triangle (index 512 or more) vanish. The conflict was only that rewrite: the fork's loop is kept and its mask is now 0x1FF, so the bounds cull sees the real index. Upstream's tests are taken as they are (the fork's host helpers match); the translation test's comment says the old mask culled the primitive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f E_NOTIMPL ID3D12Device::GetDeviceRemovedReason "gets the reason that the device was removed, or S_OK if the device isn't removed" (Microsoft D3D12 reference). Slot 37 (0x128) in the device function table was left on the default handler, returning E_NOTIMPL (0x80004001) on a healthy device, which a title checking FAILED(GetDeviceRemovedReason()) takes as a lost device. Wire slot 37 to removed_reason, which queries the host device's GetDeviceRemovedReason() and returns S_OK on Ok (or when there is no host device) and the error's HRESULT otherwise. Add a unit test verifying slot 0x128 returns S_OK on a healthy device. Co-Authored-By: Gemini 4 Neon <noreply@google.com> (cherry picked from commit 13185f5) Port notes: the conflict was only positional. The fork has its own unknown_pipeline handler where upstream's removed_reason lands, and the test module's tail differs: upstream's context carried shader_model_and_wave_options_are_the_consoles from an earlier upstream commit the fork does not have, which is left out. removed_reason, the slot 37 entry and the new test are upstream's unchanged; slot 0x128 was unset on the fork as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The f16 interpolation always wrote the low destination half via low_half() and dropped the VOP3 output modifiers. Write through write_half() (op_sel[3], SDWA) and apply omod then clamp to the f16 result in f32 so the conversion rounds once, matching write_f()'s order. Addresses VIC-BT-029 from audit #1242. Validation: - cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests - cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings - cargo xtask policy (cherry picked from commit e29391f) Port notes: the fork's interp() evaluates a packed half as an f32 and narrows it once (to_f16) instead of upstream's narrow16 per half, and it lowers v_interp_p1ll_f16 (an f32 result) separately. So half_modifiers() here takes that f32 and applies omod then clamp before the single legacyF32ToF16, rather than round-tripping f16 bits through legacyF16ToF32 as upstream does; the fork's p1ll and flat-dword paths are unchanged. The mod.rs conflict was upstream test context the fork lacks (emit_pixel, rows, texcoord and the tests using them); only the new dump_dxil helper and test were taken, with the test's p2 comment fixed to the encoding's real operands (v2, v1, attr0.x, v2). The test is Windows-only (dxc -dumpbin). Its "low write keeps the high half" check (-65536) cannot hold on the fork: bitcode::opt folds the merge away because the old v2 is the constant 0. It checks instead that the low write is masked to 65535 and not shifted. The emitted, optimized module (disassembled on Linux) holds that (low), a shl by 16, the 2.0 multiply and dx.op.unary opcode 7 (high), and no saturate in the low variant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the console, whole-quad mode puts a pixel shader's helper lanes in EXEC, so a waterfall loop (read the first lane's value, run the lanes with that value, take them out of EXEC) serves them too. On the host, wave operations leave helper lanes out: once only helper lanes are left in such a loop, WaveReadLaneFirst reads no lane, no lane matches, and the loop runs to the iteration limit in each of them. In a retail title's world, draws took 0.3 to 1.3 s each until a submission passed the host's 2 s limit: DEVICE_HUNG about 200 s into the world. A helper lane now takes its own value, so it matches in the first pass and leaves. What it computes only feeds derivatives; its stores are dropped already. Waterfall reads the proof already turns into per-lane reads are unchanged. (cherry picked from commit 0601955) Port notes: the fork's generic v_readfirstlane_b32 arm reads through first_lane (a ballot of the guard where the instruction is guarded) and, for compute programs split into two exchanging host waves, through the halves exchange; the helper select is applied to that arm's result, after the fork's logic. The fork's own_bits and waterfall-read arms already give each lane its own value and are unchanged; the exchange paths are compute-only, where the helper never applies. Upstream's helpers_read context next to read_lane is not on the fork and was not taken. The doc comment notes that the fork's pixel loop limit is its own (128 by default) rather than LOOP_LIMIT; upstream adds no tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ted from upstream commit ed0dbfd) Shadow::update skipped the ranges an earlier list of the same submission declared as written by shaders, so the title's writes there (constants, sizes) stayed stale in the copy for the whole submission; on an RTX 4050 Laptop a dispatch read its sizes as zeros and looped until the device was removed. None of the submission's own shaders has run when it refreshes: update_busy copies the pages the title wrote there since they were taken, and puts the same bytes into the snapshot, so copy-back neither takes them for the GPU's nor puts them back over a later title write. Test: title_writes_under_a_busy_range_are_copied fails without this and should pass with it. Port notes: reimplemented by hand, the fork's Shadow differs too much for the cherry-pick (no Tracked::take, a whole-copy snapshot instead of segments, copies in the card's memory). The fork also sends submissions ahead (late/relay, on by default), so `pending` can hold ranges of flights still on the card, and upstream's premise (the previous submission is done) does not hold for those. So the port records, per copy, the parts the submission being prepared declared that no earlier declared range held (`own`, in `writing`), refreshes only those through the fork's write-watch path (update_free/copy_stale, with the copied runs also written into the snapshot), and clears them when the submission goes to the card (`writes_sent`, called in Host::submit after take_snapshots). Ranges a flight holds keep the fork's handling (stale_under_flights/merge_under_writes). For copies in the card's memory the refreshed runs go up with the dirty upload before the lists and are hashed after it, as other refreshes. With wide_back (the default) the snapshot is taken after the refreshes anyway; the sync keeps the other snapshot modes right. The test is adapted: a write-watched VirtualAlloc instead of upstream's watch::tests::pool, read_host/write_host test helpers added, take_snapshots/writes_sent/copy_back_done called as Host::submit does, and one more assertion that a sent range is left alone. It is Windows-only and needs a host GPU (it returns early otherwise). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`Instruction::name()` binary-searches the opcode table, and the pipeline asks about every instruction eight times per translation: `ir::build`, `structure`, `resource` (which has the most call sites), `io` and `lower`. The answer cannot change - the encoding and opcode are decoded from the words and never rewritten - so resolve it once when the instruction is built and read the field after that. Measured with the synthetic bench from fxceless#1002 (no game data), sixteen interleaved rounds per arm, best of each, nanoseconds per instruction, at 256/1k/4k/16k instructions: resource 17 -> 9, 15 -> 7, 24 -> 16, 23 -> 15 (0.47-0.67) lower 511 -> 479, 428 -> 411, 440 -> 401, 477 -> 428 (0.90-0.96) io 27 -> 23, 26 -> 21, 26 -> 22, 30 -> 22 (0.73-0.85) whole 926 -> 881, 920 -> 874, 958 -> 921, 1019 -> 939 (0.92-0.96) `decode` pays the one search it used to be spared (112 -> 115 at 16k, inside the run-to-run spread); every stage after it reads a field. 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. (cherry picked from commit 146dfef) Port notes: the fork rewrites decoded instructions in ir::unspill (a scalar parked in a VGPR lane becomes s_mov_b32/s_mov_b64 or s_nop), which built the struct by hand in another module. With the name cached in a private field, that rewrite now goes through a new crate-internal Instruction::new that resolves the name, and decode uses it too, so a rewritten save or restore is not left named v_writelane_b32 / v_readlane_b32. Added ir test parked_scalars_become_moves_with_their_names for that path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Based on fxceless#34 by ka1qux (commit faa0a9a), rebased over fxceless#45, which added the same flag and register helpers for clwb loops; the duplicates are merged into gpr/cmp_flags/CMP_FLAGS. clzero: the two loops compilers build around it are done whole in one exception, leaving registers and flags as the last pass would. Anything else around it is one line and the next instruction. rdpru: returns the time-stamp counter for MPERF and APERF, 0 for other counters, and leaves the flags as they are: a Ryzen 7 5800X3D running it natively in user mode changes none, for known counters or not. Added over fxceless#34: - loop 1 rejects cmp rax, rax (it fell into the loop and left wrong flags); - tests that go through the emulation on any CPU (both loop shapes, the rax-rax and wrong-neighbour fallbacks, rdpru with both flag states), since on an AMD host the native tests never enter the handler. Port notes: crash.rs took the change as it is, but on the fork the vectored handler first gives every illegal instruction to console_insn::emulate (the emulator ported from XCL), which decodes clzero, the `clzero; add rax, 0x40; cmp rax, b; jb` loop and rdpru itself; emulate_amd_only only sees what it declines (a line that is not writable, such as a block the GPU write watch guards). Its loop arm left rax at the limit and the flags as they were, and zeroed nothing for a loop that ends after one pass (cmp rax, rax), so upstream's native test would fail on an Intel host. It now zeroes the lines the passes zero (still region by region, as Windows reports them writable) and steps over the clzero alone with rax at the last pass: the CPU runs that pass's add, cmp and jb, and leaves rax and the flags as the real loop does. Spans of 2 GiB or more keep the fork's old shortcut. A plain clzero whose line is writable now goes to crash::clzero (pub(crate)), so the `mov rax, a; add a, 0x40; clzero; cmp a, b; jb` loop runs whole on the live path too; its lines after the first are not checked (one that is not writable faults inside the handler, as the fallback's unchecked writes already did). rdpru on the live path stays console_insn's (QueryPerformanceCounter for MPERF and APERF, 0 for other counters, flags kept); upstream's TSC version is the fallback. Added a console_insn test of the live path. (cherry picked from commit 0de9efc) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port notes: applied as it is. These tests call emulate_amd_only directly, so they cover crash::clzero, which on the fork also does the second loop shape for console_insn's live path. (cherry picked from commit 514927d) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the ported fixes, crates/victory-shader/src/emit/lower.rs reached 525,703 bytes. That is past the asset policy's 512 KiB limit for one file, so xtask's repository_passes_policy failed. Its test module moves, unchanged apart from one level of indentation, to emit/lower/tests.rs, which leaves lower.rs at 497,625 bytes. Upstream has also begun moving parts of lower.rs into emit/lower/ (bvh.rs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A console wave64 program can run on host waves of 32 that do not exchange (halves set, exchange None). There lane_bit takes the host lane, so both host waves test the low dword of a mask held as a number: console lanes 32-63 get the bits of lanes 0-31. The ported v_cndmask_b32 change refuses this for its own paths. A review of the stack found that a mask in Structured::masks still reaches lane_bit through atom(), for example a compare ANDed with a constant (s_and_b64 s[0:1], vcc, 1) or with a pair written apart. That hole was already on main. atom() now refuses an opaque mask there, and a constant one unless its two dwords are equal (the host lane's bit is then exact). The test a_constant_select_mask_on_host_halves_is_refused gains three cases: a compare with a constant, a compare with a pair, and a constant pair in Structured::other. Without this change, they translated. Also corrects helper_reads_own's doc: on the fork a pixel loop stops after 128 passes, not at LOOP_LIMIT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ported mesh primitive test (c0228d9) dropped Host::new's error. The other skip sites print it since 0dde6f9. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…amps it image_sample_d and _d_cl on a cube were sampled at a level taken from the longer face gradient in texels, but the log of it was multiplied by log2(e) as if DXIL's Log (23) were the natural logarithm. It is base 2, so the level came out 1.44 times too high (true level 2 sampled at about 2.9, level 4 at about 5.8): cube lookups with explicit gradients were blurrier than on the console. The _cl form's minimum level, read with the other addresses, was never applied. The level is now Log2 of the longer gradient in texels, then FMax with the clamp for _cl. (ported in part from upstream commit 4f57f46) Port notes: the fork already lowered these samples to SampleLevel with its own gradient reads (addr_packed, so a16 works) and lengths; only the two fixes are taken, not upstream's 0.5 log2(max(|d|^2) w^2) form, its View::MippedCube test host or its GPU diff test. The shortcut comment now also says a sampler's LOD bias applies after the clamp. The new lowering test reads the emitted module through a test-only copy Shader::finish keeps (shader::WRITTEN) and Module::call_args, which writes a call's arguments out as expressions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
s_min_{i32,u32} and s_max_{i32,u32} left no SCC of their own, so SCC fell
to the generic `result != 0`. The RDNA2 ISA sets SCC to whether the first
operand was chosen (the compare the select uses), so an s_cselect or
s_cbranch_scc* after one went the wrong way, e.g. s_min_u32 0, 1 gave SCC 0
instead of 1. The compare now becomes the SCC.
v_cmp_f_{f32,f16} and v_cmp_tru_{f32,f16} lowered to `fcmp false` and
`fcmp true`, which remove the WARP device. They now give the constant
false or true lane mask, as the integer v_cmp_f/v_cmp_t already do.
(ported in part from upstream commit 77053a0)
Port notes: only these two items of 77053a0; its discard-as-helper
lowering, f16 rounding and MODE tracking, denormal flushes, med3/omod/
cndmask/cvt_flr/rpi changes and the host FMA probe are left out. The
fork's float compare drops the FALSE/TRUE match arms that upstream keeps
(they cannot be reached), and pred::FALSE is marked as not emitted, like
ONE. Upstream's tests run on a GPU; the new lowering tests run natively:
constant operands let the module clean-up fold the select, so a wave read
on the side not taken leaves no wave operation in SFI0 (on the old
lowering every case keeps it).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the slice A pixel program that kills lanes (v_cmpx on EXEC, an alpha test) and then exports several targets runs every export under that guard. The done export lowers its guard to a discard, but export() refused any other guarded pixel export with "a conditional export", so the whole program (a common alpha-tested MRT pattern) failed to translate and its draws were dropped. When every lane outside the export's guard runs the done export later in the same block without that export's guard holding, those lanes are discarded there and what they write is lost. discarded_at_done checks this with Bools::meet, and such an export now stores in every lane. Any other guarded non-done export is still refused. image_get_lod (op 81) read every coordinate register, the array slice included, although calculateLOD takes only the spatial coordinates. A slice register holding a value with no DXIL form failed the query, and on an array texture the slice went into a coordinate DXC leaves undefined. The query now reads only the spatial coordinates. Tests in emit/lower/tests.rs, with a new lower_pixel helper: an_export_before_the_discarding_done_export_stores_unguarded (also checks that restoring EXEC before the done export keeps the refusal) and a_level_query_skips_the_array_slice. Without this change they fail with "a conditional export" and "a pixel system input". (ported in part from upstream commit 13091f6) Port notes: only discarded_at_done with its guard change in export(), and the op 81 slice skip, are taken from 13091f6. Both match upstream's code: the fork has the same Structured::guards, Bools::meet and exports map. The rest of that commit (interpolation through reused i/j registers, low16, first-fit 16-bit packing, same_mode_per_row, signature row order, never_taken, the meet_in memo) is not part of this port. Unwritten VGPRs read as zero on the fork, so the slice test puts the ancillary input, which has no DXIL form, in the slice register instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A shader that picks a constant buffer from the view heap by an index it computes read zeros. Its slot was never made: the title's write left it null for later, as buffer views are, but view_stride gave no stride for View::Constant, so the slot stayed out of the stride table and of the buffer slots heap_buffers makes and brings up to date. And a slot that did get made was refused (left null) unless its host address was on 256 bytes, which the title's 16-byte-aligned constant buffers mostly are not. Constant buffers in title slots are now raw R32_TYPELESS views of their host copy, made through buffer_srv like the heap's other buffer views (its checks refuse what the host would not take), with a null raw buffer view for one that cannot be made. view_stride gives them 16, so the translated s_buffer_load takes its raw branch (nonzero stride) and heap_buffers makes the slot and refreshes its range; buffer_range (and so buffer_copy) gives the constant buffer's address and size. Tables holding a constant buffer are unaffected: they are still made afresh with the data copied (constant_at), and root constant buffers do not use title slots. (ported in part from upstream commit c75fdba, and step 1 of 683ad7a) Port notes: only the heap-slot part. Upstream's per-heap registry, the heap index clamp and its shader-side reading of heap constants as raw are not brought in: the fork's shader already reads a heap-picked slot raw when its stride is nonzero. Upstream gives constant buffers stride 4 (its raw stride); the fork's strides are the console's (raw is 1), and 16 is the row the fork already takes for a constant buffer read by index per lane, so indexed per-lane reads of a heap constant buffer agree with those of a table's. Upstream clamps the view to the end of the copy; here the copy is found by the constant buffer's whole range, so it always holds it, and buffer_srv refuses a view past the host buffer. Reading table constants in place (the rest of 683ad7a) is not done. Test: heap_constant_buffers_are_raw_views_at_any_alignment (Windows; the stride and range part fails without this on any host, the made view part needs a host GPU). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ir::build named every VGPR from a v_movrel*/v_swaprel_b32's encoded
register up to the program's VGPR count as read (and written, for an
indexed destination), whatever M0 can be. The lowering selects over all
of them, so a shader that indexes a small register array through M0
and keeps descriptor words or lane masks in higher VGPRs was refused
("a descriptor's address or format read as data"), and its draw or
dispatch dropped. An unbounded v_movreld also redefines every higher
VGPR, which costs phis and select chains, and makes those VGPRs
ordinary ones for unspill, so scalars parked there were not recovered.
The new range module proves an upper bound on M0 at each relative move
on the per-lane form: constants, s_mov/v_mov, an unguarded
v_readfirstlane, unsigned min/and/max/med3, adds that cannot wrap, and
phis whose incoming values are bounded on their edge, including by an
unsigned v_cmp/s_cmp the edge's lanes passed (loop counters). It finds
the bounds as an induction (assume each move reaches only its first
register, widen until the assumption implies itself), then builds the
IR again with ir::build_bounded, so each move names base..base+bound.
Anything unproven keeps the full range. Bools::decides gives the value
an atom has in every lane meeting an edge's facts.
(ported in part from upstream commit e0034c2)
Port notes: range::build returns the program only. It is called from
spill::build, the fork's one production entry (emit::translate and the
app's translate tally both go through it), before user_data rewrites
the spilled table loads; the callers structure the result as before, so
neither changes. Upstream's check that the unbounded program structures
is left out: the proof does not depend on it, and it would cost every
program a structurisation. The bound also reaches the fork's unspill
(both effects() calls in build_bounded); unspill's decisions are part
of the assumed IR, so the induction covers them. ir::operand_reads
(io.rs, own_bits.rs) keeps only registers the instruction reads, so it
does not widen a bounded move again. Compares with neg/abs modifiers are
not taken as bounds. lower_wave in emit/lower/tests.rs now builds
through spill::build. The new lowering test,
relative_moves_reach_only_what_their_clamped_index_can, adapts
upstream's GPU test (v8-v11 indexed, descriptor words in v12-v15) and is
refused without this change; upstream's three range unit tests come
along. The GPU test and the valu_tests harness change are not ported.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
image_gather4_l(_o) on a 2D view is done as four textureLoads at the level, and each texel coordinate was clamped to [0, size - 1] whatever the sampler said. The title's culling sampler clamps x and y to a transparent black border, so on the console a texel outside the view reads 0 (far, with reversed Z) and occludes nothing. Clamped to the edge texel, a meshlet that straddles the screen edge was tested against the edge's depths and could be culled: geometry missing or popping at the borders. Through an immediate sampler whose x and y address modes are clamp to border (word 0 & 0x3F == 0x36) and whose border is transparent black (word 3 bits 30-31 == 0), texels are now kept within [-1, size]: one outside reads 0 on the host as well (a D3D load outside a view returns 0), and the float stays in range for the integer conversion (infinities included; a NaN reads as -inf, so the border). Other samplers (from memory, other address modes or border colours) keep the edge clamp. gathers_at_a_level_read_a_black_border_outside lowers the gather with that sampler and with a clamp-to-edge one, counting the modules' kinds through the census (census::TEST_CENSUS switches counting on for a test's thread): four loads and the same bounds either way, and two subtractions (size - 1 per axis) fewer for the border. Without this change both count the same and the test fails. (ported in part from upstream commit 0b35b7f) Port notes: only the black-border part of upstream's gather_at_level, on the fork's four-load structure; upstream's check of the sampler word is the same for x, y and the border colour. Upstream refuses every other sampler and a level not proven whole, clamps the level to the sampler's LOD limits and the view's last level, and finds the first texel with exact 1/256-texel rounding (gather_first, NaN as 0); none of that is ported here: the fork still rounds the level to the nearest whole one, reads the edge texel for other samplers, and floors u * size - 0.5 in f32, as the shortcut comment at the gather says. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lds it create_stream walked the title's pipeline stream while a subobject's 8-byte header fit in the stream's size, then read the whole subobject at its table size: a shader's bytecode at +8, or a 48-byte rasterizer, a 336-byte blend state, an input layout's element pointer. A stream whose size ends inside its last subobject (truncated, or a type the size table sizes larger than the title does) was read past its end, into whatever memory followed: a stray shader or state could end up in the pipeline, or the read could fault. A subobject is now read only when all of it lies inside the stream; one that does not ends the walk with a warning, as an unknown type already does. (ported in part from upstream commit 9c58a1c) Port notes: only the bounds check is taken. Upstream added it inside a read_stream it factored out of create_stream for its pipeline pre-build (Prebuild, shader-pack pipelines, prebuilt list); none of that is ported, so the check sits in the fork's create_stream loop. Unlike upstream it logs a warning, so a size-table entry that is too large for a real stream shows up instead of silently dropping that subobject. The new test streams_end_at_their_size gives a 16-byte stream over a whole pixel shader subobject; without the check the shader is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A submission's refreshes go into a Batch, merged per copy and done before a step that writes title memory, before a step that gives a range to shaders (flush_one) and before the lists run. A flush forgot what it had brought up to date, so every later list of the submission that asked for the same copy refreshed it again: most lists of a world submission ask for the big heap's copy, and one that is not write-watched is copied whole on every Shadow::update. The Batch now keeps, per copy, the range brought up to date since the last title write (the union if it touches the one kept, else the larger, the copy held so its address names no other); a refresh inside it is not queued. title_written clears it, as it clears the textures. What the title's threads write meanwhile is for later submissions, as with the one write-watch asking (crate::watch::once). The ranges shaders may write (declared_writes, and its copy in card_before) were gathered with a linear search per GpuWrite step over the copies and over each copy's ranges, and dispatches declare the same few ranges thousands of times a submission. They are now found through a map of copies and a set of the ranges seen, same order and content; card_before takes declared_writes and keeps the copies in the card's memory. (ported in part from upstream commit 6d021fe) Port notes: only Batch.current and the hashed dedupe of declared ranges are taken. Upstream's Batch has no flush_one; here the copy flushed alone before a GpuWrite step is recorded as current too, and the wide refresh path records its copies before they go to the threads. Upstream's page table per view heap, Step::Memory, view pairs, bindless hulls, alias links and diagnostics counters are left out: the fork replaced that machinery (crate::memory, heap_buffers, no alias resolver). The new test runs on Windows with a host GPU only; here it was type-checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ole's float mode The fork had no test of single instructions against a model of the hardware, and none of the control-flow shapes the title's compiler emits (divergent loop exits with values read after them, break/continue, switch, short-circuit conditions, branches on wave-wide tests, discard and derivatives). valu_tests covers a few instructions, and diff_tests covers none of those shapes. semantics_tests.rs adds hand-assembled compute probes: VOP1/2/3/3P/C, SDWA, SOP, DS bytes and halves, 64-bit shifts, v_cvt_pk_u8_f32, and masked and else lanes. Each probe is lowered as a title's program is, then run on the hardware adapter and on WARP over edge inputs. The results are checked against a CPU model of RDNA2 in the console's float mode, and the two adapters must agree. flow_tests.rs compiles 8 compute and 3 pixel HLSL shapes with the console's dxc and with the PC dxc, and compares the results bit for bit. Both need a Windows GPU host (and flow_tests needs VICTORY_CONSOLE_DXC plus a PC dxc), so they are cfg(all(test, windows)). Known defects stay as ignored tests named after them. Upstream's ten all carry over, because the fork lowers those instructions with the same code: FMad for v_fma/fmac/fma_mix, omod multiplied on the host, denormal operands of min/max/selects, legacyF32ToF16 narrowing (the fork's f16_nearest is off unless VICTORY_F16_NEAREST=1), f16 math in f32, s_min/s_max SCC from the result, v_cvt_flr/rpi, med3 with plain FMin/FMax, constant compares, and quad reads after a discard. (ported in part from upstream commit 328eec1) Port notes: flow_tests.rs is upstream's file unchanged. In semantics_tests.rs, lower_program builds the fork's HostShader: no memory, memory_writes or view_addresses, and root_indexed_views from resource::track. Every probe was lowered natively on Linux with a scratch copy of the harness (lowering only, no GPU). Three instructions that upstream lowers are refused here: v_dot4_i32_i8 and v_dot4c_i32_i8 ("not supported"), v_pk_fmac_f16 ("a packed 16-bit operation is not supported"), and src_scc as a vector operand ("a special operand"). byte_dot_products_match_the_hardware is now ignored. The v_pk_fmac_f16 and src_scc probes show a new defect, REFUSED, so the passing tests leave them out. They run in the new ignored test defect_refused_instructions, and defective() keeps them out of the other defect tests. Everything else lowers. For each probed instruction, the fork's lowering code (valu_op, valu16_op, packed16, integer, compare, sop, ds, med3, write_f) was compared with upstream's at 328eec1. The differences change no probed result: med3's NaN test reads bits, the low16_src shortcuts are gone, and the fork has its own DS byte/half code. So upstream's passing and defective input sets are kept as they are. The measurement credits name no outside project ("by others"). Nothing ran on a GPU here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A lane mask that holds lanes outside EXEC where it is written (the complement of a ballot, `s_not` of a compare, or `s_orn2` against EXEC) has bits no ballot in that block can give: the lanes they stand for do not run there. Read as a number (a bit count, a store) in a block where not every lane runs, mask_dword refused it with MASK_ELSEWHERE. In a console wave32 compute program, which has no exchanging host waves, the ballot path for such a mask never applied, so the pipeline was refused and its dispatch dropped; only the wave64-on-32 retry forms could help the others. With console lanes (MaskData::Console, not a half-wave lowered on its own), mask_dword now tries Lower::mask_number first: the scalar operation writing the mask (s_mov, s_not, s_cselect, s_and, s_or, s_xor, s_andn2, s_orn2, s_nand, s_nor, s_xnor, _b32 or _b64 by the console's wave size) applied, dword by dword, to its operands' numbers, placed in the block that writes it. Those operands are read as numbers in turn (their ballots, exchanged halves, or the same rule again), so the result is the console's mask bit for bit. Any other writer, or an operand without a number, still refuses as before. (ported in part from upstream commit 8af0472) Port notes: only upstream's mask_number is taken, folded into the fork's MASK_ELSEWHERE branch of mask_dword instead of upstream's "lanes elsewhere" check; the 64-bit and f16 whole-wave section changes, the s_mov_b64 split (the fork moves each dword by itself already) and the diff-test case are left out. Differences from upstream: it returns an Option and any failure falls back to the old refusal, unchanged (the blocks its operands' exchanges asked for are dropped from the widen-retry needs again); it is guarded by `balloting` against a mask whose number needs itself; it is skipped under local half-waves; a Bit-valued operand is refused rather than widened at the current block (which need not dominate the writing block); a 64-bit operation does not take float inline constants (they would be doubles). The phi check is not needed: no instruction writes a phi, so it refuses anyway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The semantics tests carried upstream's list of known defects. Two of them no longer hold here, because the commit that gives s_min/s_max their own SCC and lowers v_cmp_f/tru as constants comes earlier in this stack: - s_min/s_max taking SCC from the result. Its probes now run on every input, and its ignored defect test is gone. - v_cmp_f/tru removing the WARP device. Its ignored test is now a plain test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
coderanonymus
force-pushed
the
upstream-pieces
branch
from
November 25, 2026 07:14
c15c1d4 to
167e1d5
Compare
PiloteCode
added a commit
to PiloteCode/victory-fork
that referenced
this pull request
Nov 25, 2026
…witch, its lowerings of instructions the title does not run, and 16-bit results by MODE Ported from Marvisak/VIctory into emit/official.rs, a child module of the lowering; lower.rs and the instruction modules (valu, valu16, salu, buffer, interp, image, export) only call it (lower.rs: 129 bytes more, for the module and the round-mode state). On by default, `VICTORY_<NAME>=0` gives the translation as before (each is part of the shader cache key): - VICTORY_MESH_EDGE_FLAGS (#1718, c0228d9): a mesh primitive's corners are 9-bit indices, the edge flag above each (bits 9, 19, 29) no part of it. Ours took 10 bits, so a flagged corner named vertex 512+ and the triangle was culled as naming a vertex past the program's count. Every mesh program's DXIL (the mask constant). - VICTORY_NORM_ENDS (fxceless#169, 645391b): a normalized buffer format's ends load as exactly 1.0 and -1.0 whatever the host's division gives there (vertex fetch, typed-format loads of compute programs): 9,764 programs. - VICTORY_CUBE_GRAD_LEVEL (4f57f46; the same fix as 9ee9adf of fxceless#767, flagged by amdsh): a cube sample with gradients takes log2 of the longer gradient in texels (DXIL's Log is base 2, ours multiplied it by log2(e) again: 1.44 times the level, blurrier cube reads), at least the _cl clamp: 29 pixel programs. - VICTORY_SMINMAX_SCC (77053a0's scalar part): s_min/s_max set SCC to whether the first operand was chosen (RDNA2 ISA); ours set result != 0. - VICTORY_INTERP_F16_MODIFIERS (#1696, e29391f): v_interp_p2_f16 honours op_sel[3] (the high half), omod and clamp; only an instruction that has one of them translates differently (the title's have none). - VICTORY_DEAD_PHI_LATCHES (#1471, be3202d): an empty loop latch whose phis are all unread folds as an empty one does. - VICTORY_BRANCH_FALLTHROUGH (#1282, 1ed26e5): a conditional branch to the next instruction is a jump. As a branch it gave its block the same successor twice, and the join's phi the wrong value (the official test fails on ours without it, on WARP). Off by default: - VICTORY_OMOD_ZERO=1 (77053a0): an output multiplier reads a denormal operand as a zero of its sign and gives +0 for a zero product, as RDNA2 measured with IEEE mode off. Compilers fold every x2, x4, x0.5 into one: 12,276 programs would gain its eight instructions, for the sign of a zero. - 16-bit results by MODE (77053a0), under our VICTORY_F16_NEAREST=1: every f32 to f16 result of a VALU operation (v_cvt_f16_f32, v_fma_mixlo/hi_f16, packed and scalar f16 arithmetic, f16 interpolation) rounds as the console's MODE says where it is: toward zero after `s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3` (the title writes it 6,694 times, around its 16-bit interpolation), to nearest even elsewhere; the switch covered 16-bit arithmetic only, at nearest even everywhere. Without switches (no program of the title runs them): s_quadmask_b32/b64 (#1443), v_cvt_off_f32_i4 (#1391), v_sad_u8/hi_u8/u16/u32 and v_msad_u8 (fxceless#162), v_mul_hi_u32_u24/i32_i24 (fxceless#156), tbuffer_load_format_d16_* packed two channels a VGPR (fxceless#169, c430b1d), a signed 64-bit operand's literal sign-extended (fxceless#447, 7d04943), v_cndmask_b32 on an inline constant mask or a mask the structurisation keeps among its other masks (#1221, 67c4f53; Structured::other exported), and v_cmp_f/tru as constants (`fcmp false/true` removed the WARP device; 77053a0). format_load and write_half became pub(super), for official.rs. Tests: the official ones of these (valu_tests on the hardware adapter and WARP: quad masks, cvt_off, tbuffer d16, normalized ends, i64 literals, branch to fallthrough), its instruction tests fxceless#1052, fxceless#1050 and fxceless#990 (they pass on ours unchanged), CPU models of the SAD, 24-bit high multiply and s_min/s_max SCC results, and the MODE rounding under VICTORY_F16_NEAREST. Census (CPU, against wave5's own): with every switch off, every program's DXIL is byte for byte as before; with the defaults, 10,711 programs change (Ms 8,765, Cs 1,077, Vs 840, Ps 29) and none is lost or gained (25,953 of 25,953 pass either way).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #716, which is stacked on #653. This PR's own commits are the 11 after #716.
Rebased on main (a26859f)
Rebased with #653 and #716 onto a26859f. The owner's two newest commits already do two of the pieces, so they're dropped here, together with the three commits that only supported them:
A read-only review checked every remaining commit against the owner's two commits for duplicates and clashes, and found none. Heap constant buffers as raw views now meet the owner's byte-copy sync: every CBV record the sync mirrors becomes a buffer slot that
heap_buffersmakes and refreshes. Before, it was nulled. That's more correct, at a cost not yet measured.Clippy passes with and without
--all-featureson a clean build, Linux tests (274) pass, and so does the asset policy.Why
Upstream's maintainer landed large commits that re-implement parts of this fork's own work in upstream's way: title memory through a page table, FidelityFX, view copies, the shader pack. They can't be merged here. A read-only triage of each one still found specific fixes inside them that the fork lacks. This PR takes those pieces, each rewritten for the fork's design.
What
Each commit says which upstream commit it is "ported in part" from, keeps the upstream author, and has a Port notes paragraph.
Shaders
image_sample_d/_d_clon a cube):_clread its clamp but never applied it.s_min/s_maxnow set SCC from their compare (RDNA2: whether the first operand was chosen), not fromresult != 0.v_cmp_f/v_cmp_trulower to constants.v_movrel*) reach only what a proven upper bound on M0 allows (upstream'srange.rs). Programs that keep descriptor dwords or masks above a small indexed array are no longer refused.s_notof a ballot) is computed from its scalar op, not refused.image_gather4_lthrough a clamp-to-black-border sampler: a texel outside the view reads 0, as on the console. The fork clamped it to the edge texel, so meshlets at the screen edge culled against the wrong depth.GPU
Mine, from the stack's review
s_min/s_maxSCC andv_cmp_f/v_cmp_tru. Their checks now run.Left out
Two pieces were rejected after their repair round, and I didn't take them:
How it was made and reviewed
Ultracode workflow:
SHADER_HEAPSlock. The lock review found that the heap sync takesSHADER_HEAPSundersubmitted, then leaf locks only, so the order stays acyclic with GPU: hold SHADER_HEAPS while a shader-visible heap is used (port of upstream 628b95d) #668. The two branches merge cleanly.Verification
Checked in a dedicated worktree with fresh target directories:
cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with--all-features, forx86_64-pc-windows-msvc: clean.emit/lower.rsis under its 512 KiB). formats, core, pipeline and game pass.No game data used; the game isn't named in the tree.
🤖 Generated with Claude Code