Skip to content

Bmjask/ultra performance redesign - #2778

Closed
bmjask wants to merge 404 commits into
xcl-dev:mainfrom
bmjask:bmjask/ultra-performance-redesign
Closed

bmjask wants to merge 404 commits into
xcl-dev:mainfrom
bmjask:bmjask/ultra-performance-redesign

Conversation

@bmjask

@bmjask bmjask commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

What is in it

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release:
  • cargo test --workspace -- --test-threads=4: N passed, N failed, N ignored (SKIPPED GPU tests: …)

Regression run

main:

PR:

Not tested

AI use

  • none / tool and model, and what it did

bmjask added 30 commits November 25, 2026 22:19
Reserve null raw-UAV descriptors after the memory-window slots. Redirect ordinary out-of-layout loads and stores with a descriptor select, while retaining explicit guards for atomics whose return values require defined handling.

Keep runtime and GPU-test heaps on the same descriptor ABI and add a deterministic accessor-shape test. Adapted as the behavior-independent half of xcl-dev#2554; its upstream RTX 4090 investigation attributes about six seconds of a large cold compile to the duplicated guard branches.

Locally cross-checked with the GNU Windows target; Windows GPU execution remains untested here.

Assisted-by: Claude Code (model not disclosed)

Assisted-by: Codex (GPT-5.6-sol)
Capture registered texture destinations in immutable per-segment effects and publish them only after the native submission gate accepts that physical segment. Reset, discarded, failed, and unsent split continuations cannot mark a texture.

Track registration generations, writer-queue incarnations, monotonic GPU epochs, and known destination subresources without activating readback or synchronization. Preserve pre-submit lazy-level mapping preparation.

Locally cross-checked with the GNU Windows target; Windows execution remains untested here.

Assisted-by: Codex (GPT-5.6-sol)
Implement IDStorageQueueX1::EnqueueSetEvent as an ordered queue marker. The queue owns a restricted duplicate handle until every earlier request retires, then signals it; Close safely discards pending markers.

Adapted from xcl-dev#2569 with sequential auto-submit, parallel retirement ordering, caller-handle lifetime, and Close coverage. Upstream reports full Windows suite and retail smoke coverage.

Locally cross-checked with the GNU Windows target; Windows event execution remains untested here.

Assisted-by: Codex (GPT-6.2 Sol)

Assisted-by: Codex (GPT-5.6-sol)
Capture and persist the exact successful uncached pipeline result whose driver build crossed the slow threshold, even when bounded RAM-cache admission fails. Same-key builders reserve capture/publication, and disk-path turns prevent distinct RAM identities from racing one pathname.

Publish disk before RAM visibility, remember cap-refused persisted keys, clear that marker on cached-blob rejection, and preserve exact-generation invalidation plus AMD default-off policy. Adapted from xcl-dev#2574 after prerequisites xcl-dev#2577 and xcl-dev#2614.

Locally cross-checked with the GNU Windows target; Windows filesystem and driver execution remain untested here.

Assisted-by: Codex (GPT-5.6-sol)
Own title queues from creation, atomically transition a registry-only queue to Retiring, exclude it from every internal signal and submission producer, and enqueue a final fence marker. Marker/API/worker failure pins the owner permanently.

A worker sweeps exact completed generations, invalidates every audited raw-address cache, and only then drops the final registry owner. Pre-transition active snapshots delay retirement; retiring queues remain visible only to all-state ownership and diagnostics.

No overlapping queue-retirement PR was found. Locally cross-checked with the GNU Windows target; Windows runtime and GPU execution remain untested here.

Assisted-by: Codex (GPT-5.6-sol)
Keep exact single-sample colour render-target and UAV layouts in the title texture table without scheduling CPU uploads. This preserves address generations and submitted-write provenance needed by a later, ordered reverse-layout readback path while rejecting layouts that require conversion or unsupported metadata handling.\n\nAssisted-by: Codex (GPT-5.6-sol)
Assisted-by: Codex (GPT-5.6-sol)
…ker::Link

Fix two linked-compilation bugs in dxc.rs introduced alongside accessor-library linking (xcl-dev#174):\n\n1. Keep LINK_GATE open and propagate transient E_OUTOFMEMORY errors directly from compile_linked_or_fallback instead of permanently disabling linked compilation and falling back to the heavier compile_whole path under memory pressure. Deterministic non-OOM failures still close LINK_GATE once and fall back to compile_whole.\n2. Forward the shader optimization tier and caller extra arguments to IDxcLinker::Link, and reject library blobs whose length cannot be represented by the API.\n\nAdd unit tests for OOM gate retention, link argument boundaries, and live DXC argument forwarding.\n\nPart of xcl-dev#174\nPart of xcl-dev#1566\nPart of xcl-dev#1269\nPart of xcl-dev#1833\n\nAssisted-by: Google Antigravity (Gemini 4 Neon)\nAssisted-by: Codex (GPT-5.6-sol)
Assisted-by: Google Antigravity (Gemini 4 Neon)\nAssisted-by: Codex (GPT-5.6-sol)
cl_release dropped XCL state keyed by a PC command list address only after the runtime's final Release had freed the list. A list created on another thread could immediately reuse that address and lose its bind state, allocator, last submit, and DRED marks. Probe the final reference and forget keyed state before the freeing Release, matching the established resource-release pattern.\n\nA fake list whose Release reuses its address immediately verifies the new list keeps its state.\n\nAssisted-by: Claude Code (Claude Opus 5.5)\nAssisted-by: Codex (GPT-5.6-sol)
Replace sparse tile quarantine's process-lifetime command-queue references with temporary active-queue snapshots and independently owned completion fences. Include installed central retirement markers, wait through the short Preparing state, and fail closed when retirement cannot provide a trustworthy completion source.\n\nPrune raw queue keys only through the exact Stage C retirement callback before address reuse; in-flight batches retain their own fence clones.\n\nAdapted from xcl-dev#2638 after central queue retirement was active.\n\nAssisted-by: Codex (GPT-5.6-sol)
Assisted-by: Codex (GPT-5.6-sol)
Add a pure CPU helper that validates one exact D3D12 readback footprint and tiles its logical rows back into the matching XG subresource. It handles arrays, volumes, mip edges, and block formats while rejecting metadata planes, format conversions, malformed footprints, arithmetic overflow, allocation failure, and short buffers.\n\nThis is the conversion-only stage for ordered GPU-owned texture copyback; it performs no queue, COM, synchronization, or title-memory work.\n\nAssisted-by: Codex (GPT-5.6-sol)
Assisted-by: Codex (GPT-5.6-sol)
The console compute-stream projection dropped its FLAGS subobject, so stream-created pipelines always reached creation and the driver-blob cache key with zero flags. Forward type 20 exactly as the graphics-stream and legacy compute paths already do.\n\nAdd a synthetic stream test covering absent and nonzero flags.\n\nPart of xcl-dev#2607.\n\nAssisted-by: Devin (SWE-2 High)\nAssisted-by: Codex (GPT-5.6-sol)
Assisted-by: Devin (SWE-2 High)\nAssisted-by: Codex (GPT-5.6-sol)
The streaming effects fast path capped its initial instruction storage when it only needed to reject memory-writing shaders, but an early S_SETPC_B64 fallback still reserved for the entire shader before seeing a nearby store. Apply the same small initial capacity to the far-jump path and let it grow only when full analysis is required.\n\nFollow-up to xcl-dev#2656.\n\nAssisted-by: Codex (GPT-5.6-sol)
Validate WaitFrameEventX's signaled-index target as committed, unguarded, and writable without touching its pages. Replace ancillary and paced wait handle vectors with fixed stack storage, avoid the scheduled-handle Arc clone on the paced path, and use deques for bounded frame history eviction.\n\nAdapted from xcl-dev#2692.\nPart of xcl-dev#103.\n\nAssisted-by: Google Antigravity (Gemini 4 Neon)\nAssisted-by: Codex (GPT-5.6-sol)
Assisted-by: Google Antigravity (Gemini 4 Neon)\nAssisted-by: Codex (GPT-5.6-sol)
The deferred-call path ignored native Close failures both while reserving an empty segment and after replaying the call. Such a segment could reach ExecuteCommandLists and remove the device.\n\nReject a reservation whose initial Close fails. If replay Close fails, drop the call, restore arena ownership to the previous valid segment, and quarantine the still-open list until wrapper destruction so it can never be reused as a closed spare.\n\nCo-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>\nAssisted-by: Claude Code (Claude Opus 5.5)\nAssisted-by: Codex (GPT-5.6-sol)
Checked parsing retains a known graphics-stream prefix while marking unknown or truncated suffixes uncacheable. Thread that decision through synchronous and worker builds so projected descriptors cannot populate memory or driver caches when omitted state may affect identity.\n\nAlso preserve the legacy-representable RASTERIZER1 and RASTERIZER2 fields. Fractional depth bias and RASTERIZER2 line mode remain for the later native-stream stage.\n\nAdapted from PR xcl-dev#2621 by Decodere.\nAssisted-by: Codex (GPT-5.6-sol)
Run eligible split-wave64 compute programs as independent 64-thread hardware groups and scale the dispatch dimension, avoiding cross-wave spin coordination. Preserve console group/thread IDs in generated HLSL and keep direct-DXIL pipelines unremapped.\n\nBuild an unremapped worker fallback for indirect dispatch or dimension overflow, with OOM cooldown, stand-in resolution, and fail-closed skip behavior. Retain fallback device/root-signature ownership and drop cache entries outside their mutex to avoid reentrant Release deadlocks.\n\nAssisted-by: Codex (GPT-5.6-sol)
@SlopTart

Copy link
Copy Markdown

Wine-lane follow-up to my crash row above and ettehn's Windows control, at PR head 2c5c33d4 (heads keep moving, re-checked 2026-11-26):

  1. The fixture abort is still live upstream, unmerged-fix: --exact hle::d3d12x::alloc_pool::tests::released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing still hard-kills the Wine test host (exit status 9) on this head, matching ettehn's 0xc0000409 on Windows. Their BackingProbe::new AddRef diagnosis also fits our side exactly: the mock fence vtable in alloc_pool.rs is built from unexpected_call (line 1433) which is std::process::abort(), and abort() surfaces as c0000409/fast-fail. One fault, two platforms, confirmed.

  2. ettehn's remaining red reproduces on Wine too, same fixture as shipped, fresh process, no local changes:

cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --exact 'hle::d3d12x::alloc_pool::tests::submit_reservation_keeps_pre_reset_attribution_across_queues'
panicked at crates/xcl/src/hle/d3d12x/alloc_pool.rs:2025:9:
assertion `left == right` failed
  left: 4
 right: 0

That is the same fence-ref count (4 vs expected 0) ettehn reported on native Windows. A plain assertion failure with identical numbers on Wine/Linux and Windows/MSVC points at the allocator changes in this PR, not at mocks or Wine.

  1. Control: on main b49be183 the full lib suite completes green apart from the known baseline reds, and released_lists... was verified solo at 0.00s; submit_reservation... is among the passing on main in the full run.

Setup same as the row above (rig A: Ryzen 9 9900X, RX 7900 XT, Mesa 26.2.5 RADV, wine-11.0 Proton, rustc 1.94.0; CPU lane, gpu:: skipped). Not tested: the 0xc0000005 group abort ettehn saw, group runs on our lane die earlier on the fixture abort.

Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.

bmjask added 18 commits November 26, 2026 05:31
The coordinated batch transaction now owns acceptance, poisoning, and publication semantics. Preserve unwind, callback-order, and staging-ownership coverage on that implementation before removing the duplicate test-only protocol.

Assisted-by: Codex (GPT-5.6-sol)
The coordinated upload plan uses the shared page construction and validation primitives directly. Preserve intent, range, incomplete-build, and identity-validation coverage on those paths before removing the older claim-owning plan.

Assisted-by: Codex (GPT-5.6-sol)
SparseBatches now owns the guarded claim lifecycle used by coordinated uploads. Preserve ordering, reason merging, exact restoration, and stale-producer coverage on the shared ledger and batch model before removing the older guards.

Assisted-by: Codex (GPT-5.6-sol)
Keep one exact queue handle per restoration attempt so foreground demand can promote existing speculative work without compiling on the caller. Transfer an opaque recipe-bound published generation through the exact ticket, and report queue and build terminal states without substituting another attempt.

The private coordinator remains default-off and unwired.

Assisted-by: Codex (GPT-5.6-sol)
Exercise foreground promotion, coalescing, queue refusal and cancellation, build failure, worker panic, release, and exact attempt-token replacement. Deterministically evict after publication capture and verify the ticket keeps the recipe-bound generation, while final COM destruction occurs outside the coordinator lock.

Assisted-by: Codex (GPT-5.6-sol)
Publish an armed eviction token on its exact Build before a future policy may detach native owners. An uncommitted guard clears only its own token and poisons its ledger record, leaving resolver and policy wiring for a later stage.

Assisted-by: Codex (GPT-5.6-sol)
Exercise pre-detach visibility, rollback after failed generation revalidation, and stale-token clearing after bounded ledger slot reuse.

Assisted-by: Codex (GPT-5.6-sol)
Enable the existing opt-in submission timer during reproducible perf runs and include its threshold in the recorded environment. Compare the raw submission count and slowest CPU-side ExecuteCommandLists duration/list count while preserving missing report data as an explicit state.

Assisted-by: Codex (GPT-5.6-sol)
Retain a structured resolver decision over the original Pending, distinguish cold builds from exact eviction attempts, and carry the exact restoration ticket or native generation without starting workers or changing live bind behavior.

Assisted-by: Codex (GPT-5.6-sol)
Exercise retained Pending identity across title-address reuse, fail-closed missing eviction records, usable pins during speculative rebuilds, exact background promotion, and the publish-before-request race without inline driver work.

Assisted-by: Codex (GPT-5.6-sol)
Record exact total CPU time and a bounded log2 distribution for opt-in native title ExecuteCommandLists timing. Report mean and histogram-derived p95/p99 upper bounds without describing them as GPU execution time.

Assisted-by: Codex (GPT-5.6-sol)
Validate complete timing histograms, preserve legacy and missing reports explicitly, and compare aggregate CPU submission time and bounded tail estimates.

Assisted-by: Codex (GPT-5.6-sol)
Carry an opaque structured pipeline decision through command-list resets and split continuations without classifying or waiting in live paths. Replaced decisions are released after the bind-state lock so later native generation owners may re-enter bookkeeping safely.

Assisted-by: Codex (GPT-5.6-sol)
Exercise reset, clear, bind replacement, forget, split continuation identity, and title-address reuse. Final retained-decision destruction proves it can re-enter bind bookkeeping without the state lock held.

Assisted-by: Codex (GPT-5.6-sol)
Give the later bind integration one bounded coordinator and an opaque nonblocking classification seam. The accessor does not start workers, enable eviction, install bind state, or wait for restoration.

Assisted-by: Codex (GPT-5.6-sol)
Exercise stable singleton identity, bounded eviction-ledger exhaustion and reuse, and queue-shutdown refusal without running driver work on the classifier.

Assisted-by: Codex (GPT-5.6-sol)
Let paired performance runs build canonical feature sets in deterministic target directories and record the exact executable hash. Comparisons keep workload invariants strict while exposing different baseline and candidate build variants for allocator A/B measurements.

Assisted-by: Codex (GPT-5.6-sol)
Measure a bounded PSO-job-like mix of Box, Arc, Vec, and String allocations with a single-thread control and persistent worker threads. Thread creation stays outside measured iterations so allocator A/B runs report job throughput instead of startup cost.

Assisted-by: Codex (GPT-5.6-sol)
bmjask added 6 commits November 26, 2026 06:36
The resubmit fixture manually published LastSubmit without first capturing the exact list address lifetime that note_resubmits requires. Exercise the real begin-submit reservation path before publishing the synthetic incomplete submit so the Windows test checks the detector rather than a stale fixture.

Assisted-by: Codex (GPT-5.6-sol)
Use the 12,288-word compact table cap for every GPU now that nested compact dispatch is the default. The old 8,192-word wave64 gate selected the much larger plain form and left its CPU size-comparison test obsolete; the existing late-entry GPU test retains coverage above the old cap.

Preserve the branch's automatic atomic-candidate policy while removing the adapter-dependent translation API.

Assisted-by: Codex (GPT-5.6-sol)
Each translation already owns a 256 MiB-stack worker. Keep two translations concurrent to exercise separate thread-local and hash-map state, but remove redundant outer 64 MiB stacks and avoid crowding the other direct-DXIL tests in the four-thread suite.

Assisted-by: Codex (GPT-5.6-sol)
Run the no-GPU CI suite without output capture so a later native fast-fail cannot hide earlier Rust assertion or translator-spawn diagnostics.

Assisted-by: Codex (GPT-5.6-sol)
Reject direct-DXIL compute and mesh programs whose group barrier spans multiple hardware waves. The direct barrier waits for waves the console may allow to leave or bypass it; the HLSL fallback already uses the safe counted barrier. Keep the coherence test on a one-wave group so it continues to test handle properties rather than the fallback boundary.

Adapted from upstream commit fb55e49.

Assisted-by: Codex (GPT-5.6-sol)
Trivial-phi elimination could replace a loop-header phi with its sole distinct backedge value. That rewrote header uses to an instruction serialized later in the loop and tripped the direct-DXIL well-formed-use invariant after CFG simplification.

Only eliminate a phi when its replacement is already available before it in function order. Cover the self/backedge loop form that the branchy compute translation exposes.

Assisted-by: Codex (GPT-5.6-sol)

@Prime1997 Prime1997 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing this combined draft in its current form. At e9211ff4 it spans 404 commits across 80 files and conflicts with main 8b957bec in hle/d3d12x/real.rs, hle/d3d12x/real/two_pass_identity.rs, and shaders.rs. The PR description check failed with required testing and regression sections still blank.

Please continue the independently reviewable changes through #2787, preserving contributor attribution. The first focused drafts are #2820 for contiguous 2D tiling and #2821 for sparse upload staging timeouts. Each slice can then establish its own CI and, where required, matched title results.

AI use: Codex (GPT-6) reviewed the pinned changes and verified the reported evidence. Optional temporary Discord for coordinating contributor work, testing, and comparing results.

@Prime1997 Prime1997 closed this Nov 26, 2026
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.

6 participants