Skip to content

Hot Path Shortcuts

OpenAI Codex edited this page Nov 1, 2026 · 7 revisions

Hot-Path Shortcuts

Reviewed: 2026-11-01 · Source: b7140848 · Availability: current main; stable/main boundaries are stated below.

Current implementation/defaults and stable/main availability are maintained in Current status, Current register and Controls. Dated observations below retain their own source and evidence boundary. Current Avoid ordered vertex copies is delivered by#89: unread-page direct writes and bounded immutable private versions preserve ordered fallback; live Vulkan permission defaults On. Vertex lifetime.

Lifecycle indexes: Implemented · Researched · Unproven

Scope: Guarded bypasses and special-case fast routes only.

For the broader performance catalog—including caches, prepared work, structural optimizations, resource policies and alternate execution—see Performance Optimization Catalog.

A hot-path shortcut is not simply code that is faster.

It is a route that avoids work performed by a more general, maintained implementation because a narrow condition, capability, constant or state proof says that work is unnecessary for this operation.

Shortcut anatomy

flowchart TD
    A[Operation enters hot path] --> B[Evaluate narrow guard or assumption]
    B -->|Not proven| R[General correct route]
    B -->|Proven| S[Skip, fold, reuse or substitute work]
    S --> V[Validate required result/order]
    R --> V
    V --> Z[Guest-visible outcome]
Loading

The general route is important. It is both:

  • the correctness fallback when the shortcut is ineligible; and
  • the controlled reference path used to prove whether the shortcut still matters.

What qualifies as a shortcut

A mechanism belongs on this page when most of the following are true:

  • it has a slower/general route that is already correct;
  • it explicitly skips, folds, reuses, substitutes or returns before that route completes;
  • a cheap guard or special case selects the shortened route;
  • a stale or incomplete guard can cause wrong output, wrong ordering, missed invalidation or unsafe lifetime;
  • the reference route can be forced without disabling unrelated correctness behavior.

A magic number or hard-coded threshold may be part of a shortcut, but is not required. Conversely, using a magic number does not make an allocation policy a shortcut.

What is not a shortcut

The following are performance work, but they are classified elsewhere:

Mechanism Correct classification Example
Better allocation and lifetime management Resource-management policy Transient-Buffer Growth
Copy only required data Structural optimization Bounded Vertex Uploads
Reuse an exact keyed result Cache/prepared work Shader Caching
Move fixed computation to initialization/build Precomputation Audio Attenuation Lookup
Maintain an index instead of rescanning Prepared metadata Surface Coverage Index
Use another complete semantic implementation Alternate execution/fallback Hybrid Ubershader

A switch in Advanced settings does not change any of those classifications. The switch exists for isolation and regression recovery.

Implemented shortcuts

Command and register processing

Shortcut General route Bypassed work Guard / special case Primary failure if wrong
Bulk Packet Processing Scalar per-word method dispatch Repeated packet dispatch/bookkeeping Supported packet form plus whole-packet preflight Partial mutation, wrong method order or malformed-packet handling
Fast Fence Polling Locked PGRAPH MMIO read pgraph.lock acquisition for every poll Exact fence register and exact 32-bit access Stale/unordered fence publication

Vulkan renderer shortcuts

Shortcut General route Bypassed work Guard / special case Primary failure if wrong
Skip Unchanged Shader Work Full shader/pipeline route evaluation Repeated route/key/pipeline preparation No relevant register/program/non-register/selection change; complete executable remains valid Wrong shader or pipeline stays bound
Color-Download Folding Separate download submission and wait Extra command-buffer boundary and wait Eligible color download already ordered after its producer CPU sees incomplete or wrongly ordered surface data
Clean Texture Stages Normal per-stage create/update/bind work Reprocessing a clean stage after another stage caused slow binding Binding/source/dirty/overlap/DMA-address checks Stale texture, palette or surface source
Unchanged Scanout Fresh render_display() conversion/submission Complete display conversion and submission Full completed-output key plus lifetime and upload guards Stale or incomplete presented image

Host and representation shortcuts

Shortcut General route Bypassed work Guard / special case Primary failure if wrong
Windows Short Waits Busy-spin short-wait compatibility route Active CPU spinning Windows, eligible timeout range, policy, timer creation/arm state Missed event readiness or worse wake tails
Windows QPC Conversion Generic muldiv64() General multiply/divide conversion Startup frequency divides one second exactly Incorrect or non-monotonic host time
Native S3TC Upload CPU decode followed by uncompressed upload CPU decompression and expanded upload Compatible format/layout/extension path Wrong compressed layout or sampling output

Candidate shortcuts

Candidate Proposed bypass Assumption class Status
PFIFO Constant Status Read Return one modeled constant before acquiring the PFIFO mutex Current-model constant plus exact register/size Measure first; not implemented

Mono Voice Resampling may eventually become a guarded specialization, but it is currently classified as alternate specialized execution. Until channel transitions, persistent resampler state and snapshot semantics are proven, it should not be documented as a qualified shortcut.

Safety categories

Guarded and maintained

Every bypass condition is explicit, the reference route remains reachable, and focused tests cover both routes.

Capability-dependent

The shortcut is valid only when a host API feature or format contract is present. Native S3TC upload belongs here.

Heuristic with fallback

A measured threshold or tuning constant selects the route, but failure and unsupported cases return to a maintained path. Windows short waits belong here because the sub-1.25 ms range is a policy threshold, not an Xbox semantic constant.

Current-model assumption

The shortcut preserves what xemu currently models, but the assumption may not represent all physical-hardware behavior. The proposed PFIFO constant-status return belongs here.

Research/HOLD bypass

The shortened route exists before its guard, invalidation, ordering or lifetime proof is complete. Such a path must remain diagnostic and must not silently become the default.

Main risks

A shortcut can fail even when its local result appears faster.

Incomplete guard

A dependency changes but the route still reports eligible.

Side-effectful guard reordered or repeated

A “check” may clear dirty state, consume an event or publish a lifetime transition. Re-running it for telemetry can change behavior.

Reference route no longer maintained

The fallback compiles but no longer produces the same result, making A/B evidence meaningless.

Work moved elsewhere

A local finish, compile, copy or validation disappears from one helper but reappears at another boundary.

Rare-path assumption becomes common

A shortcut based on “this should almost never happen” can fail badly when another title, driver or host configuration reaches the case frequently.

Magic threshold overfit

A constant selected on one machine can improve mean CPU while worsening p99 wake or frame latency elsewhere.

Required documentation for each shortcut

Every shortcut page must state:

Bypassed work
Maintained reference route
Eligibility guard or assumption
Whether any guard has side effects
Fallback when the optimized path fails
State/lifetime invalidation
Counters proving both routes were reached
Failure if the assumption is wrong
Whether constants are semantic, capability-derived or heuristic

How to test a shortcut

Use Using Hot-Path Shortcuts when the experiment is specifically an optimized bypass versus its maintained reference route.

Use Using Performance Controls for broader settings behavior, persistent caches, restart-latched resource policies and alternate execution strategies.

flowchart LR
    A[Profile real symptom] --> B[Identify exact bypass and reference route]
    B --> C[Prove both routes reachable in one Release binary]
    C --> D[Run balanced fixed-work comparison]
    D --> E{Correctness/order/lifetime equal?}
    E -->|No| F[Shortcut failed; investigate]
    E -->|Yes| G[Compare local avoided work and end-to-end tails/resources]
Loading

Related pages

Assumption-based shortcut research

Assumption-Based Shortcut Validation reviews seven proposed bypasses against exact current source. It separates exact shortcuts, explicit approximations, overlap with existing routes, and one deferred TCG-wide concept.

New research pages cover shader-selection generation trust, frame-scoped texture trust, linear audio resampling, direct surface sampling, approximate occlusion reports, recognized guest poll-loop waits, and direct-RAM read windows.

vCPU and JIT shortcut research

The source-validated vCPU Shortcut Candidates catalog separates genuine bypasses from ordinary backend improvements.

True shortcut investigations:

The Windows XMM-register budget and x87 flag-capture work are intentionally kept out of this list because they are backend optimizations, not assumption-based bypasses.

Clone this wiki locally