Console CPU instructions: enforce mandatory prefix precedence for CLWB and RDPID #1545
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1555"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T17:37:32Z.
insn::decodetrackedrep(the last of0xF2/0xF3) for SSE4a, but checked rawp66forCLWB(66 0F AE /6) and a stickypf3forRDPID(F3 0F C7 /7). As a result,#UDencodings with conflicting mandatory prefixes (F3 66 0F AE 30,F2 66 0F AE 30,66 F3 0F AE 30, andF3 F2 0F C7 F8) were misdecoded asCLWBorRDPIDand silently emulated.This requires
rep == 0 && p66forCLWBandrep == 0xF3forRDPID, dropping the unused stickypf3flag.What is in it
crates/xcl/src/insn.rs: enforcerep == 0 && p66forCLWBandrep == 0xF3forRDPID; add prefix-precedence assertions todecodes_the_console_only_instructions(verified failing before the fix).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 776 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware; 1no heap windows—heap_window_out_of_memory_falls_back_to_the_switch_form)cargo test -p xcl --lib insn::tests: 2 passed, 0 failed (decodes_the_console_only_instructionsfailed before the fix)Regression run
main:
PR:
Not tested
AI use
insn.rs, wrote the fix and unit test cases, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.upstream-sync referenced this pull request2026-11-24 19:06:16 +00:00
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T18:51:03Z.
Full-suite run, since this PR has no test report yet. Tested exact head
f27e63d(on its base9e3831e).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form: 775 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.#[test]functions in the diff.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 776 passed, 0 failed, 41 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).heap_window_out_of_memory_falls_back_to_the_switch_formwas skipped with--skip. It fails on main9e3831etoo, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns every skip except "no wave64" into a failure, including this test's opt-in "no heap windows" skip (XCL_HEAP_WINDOWSunset). Reported as #1651.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T19:32:24Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T16:08:12Z.
NVIDIA test report for
f27e63d: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug. Head tested as-is on its base9e3831e.cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4: 718 passed, 0 failed, 21 ignored; 2 SKIPPED (no wave64: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware), neither in a file this PR changes.insn::tests::decodes_the_console_only_instructionswith--exact --test-threads=1 --nocapture, 3 runs: 3/3 passed, 0 SKIPPED.Lib tests only; no title run.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T12:12:00Z.
Independent desktop NVIDIA verification of PR #1555 at head
f27e63dee989771062f075a7ce85fe9e0e9239b7(1commit; exact parent & merge-base:9e3831e1f570d3646e53ab753b19ec07eb8f1485, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted tests & build (
f27e63de)cargo test --release -p xcl --lib insn:: -- --nocapture(3 consecutive runs)2 passed; 0 failed; 0 ignored; 746 filtered out× 3 (0.00s,0.00s,0.00s,0skipped;decodes_the_console_only_instructions,sse4a_bit_fields)cargo build --release -p xcl1m 00s, exit0,0new warnings ininsn.rs)Paired quiet 60 s retail smoke (
title: 29640639)(Note:
scripts/smoke.ps1at9e3831e1predates9683e7a6and printed the local folder basename ontitle:; replaced below with the standard9683e7a6title hash29640639, with all measured fields verbatim.)Exact parent & merge-base (
9e3831e1f570d3646e53ab753b19ec07eb8f1485, cached baseline on the same machine):PR #1555 (
f27e63dee989771062f075a7ce85fe9e0e9239b7):Limits of coverage
insn::unit tests (decodes_the_console_only_instructionsandsse4a_bit_fields,0skipped) passed3/3, covering mandatory prefix precedence decoding forCLWBandRDPID.0device removals,0crashes) on this Intel Core i5-11400F / RTX 4060 host; single-run frame/commit delta vs. the cached parent reflects normal startup variance.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T07:36:35Z.
merge-check claim
head:
f27e63dee9Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T07:50:08Z.
merge-check
base:
d52ff48caahead:
f27e63dee9merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2875 passed, 2 failed, 51 ignored; 29 SKIPPED lines
failing: test_title_runs_and_game_folder_is_untouched
review: automated overnight check — diff inspected for safety only (no build/CI/toolchain/script changes, no process/network/runtime-loading code); no duplicate search performed; no line-by-line code review.
performance: not assessed beyond the suite.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 610.88 (32.0.16.1088); Ryzen 7 5800X3D, 64 GB; Windows 11 22631; OpenCode agent, DeepSeek V4.1 Flash 1017
correction: this check first reported the PR as "not yet" because of a test failure that is not the PR's. The base-comparison step failed to run (test names contain a double colon, not a legal Windows filename), so an empty read was mistaken for "passes on base".
gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16fails on based52ff48cby itself (verified separately with the same command: "assertion failed: 2D D16 resinfo clobbered v2/v3"). Verdict corrected. Apologies for the noise.Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T09:46:45Z.
merge-check claim
head:
f27e63dee9Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T09:53:26Z.
merge-check
base:
9dfbe3ea66head:
f27e63dee9merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2885 passed, 1 failed, 51 ignored; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails on the base alone too (base: 2885 passed, 1 failed, 51 ignored, 28 SKIPPED lines). 28 SKIPPED lines, as on the base.
insn::tests::decodes_the_console_only_instructions(which gains the four new cases) andsse4a_bit_fieldspassed.review: no blocking finding; one file, every hunk read. The decoder already tracked
rep(the last of F2 / F3) for SSE4a; CLWB now also requiresrep == 0next to 66, and RDPID requiresrep == 0xF3in place of a sticky "an F3 was seen" flag, which is removed. Four encodings that are #UD on hardware (F3 66 0F AE /6, F2 66 0F AE /6, 66 F3 0F AE /6, F3 F2 0F C7 /7) now decode to None and are no longer emulated as CLWB / RDPID; the existing positive cases are unchanged. No other PR found for it.performance: none; decode runs on the exception path only.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:06:06Z.
Triage (#1607) – head
f27e63dNo open or merged PR changes the mandatory-prefix checks for CLWB / RDPID in
insn.rs::decode; #234 touches the same function for MOVNTSS/MOVNTSD only.The change reuses the existing
rep(last of F2/F3) rule already used for SSE4a: CLWB now needs 66 with no F2/F3, RDPID needs F3 as the last rep prefix, and the new asserts cover F3+F2, F3+66, F2+66 and 66+F3. No problems found in the diff.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T10:24:21Z.
merge-check
base:
1c8b551475head:
f27e63dee9merge: clean (trial-merge commit 54c219fd57529db70c6c40c2d54791c92dcb8338, git diff --check clean)
build: cargo build --workspace ok
tests: 43 targets combined: 2909 passed, 0 failed, 51 ignored. Specifically, all 42 non-lib workspace targets under
cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapturepassed 148/0 (20 ignored, including gpu_two_pass_cache_e2e), andcargo test -p xcl --lib -- --test-threads=2passed 2761/0 (31 ignored;--test-threads=4hit the unrelated pre-existing ASLR collision on synthetic pointer 0x7c000041 in main's set_pipeline_state_goes_into_a_run_only_with_a_two_pass_pipeline -> real.rs:1237). Targeted insn::tests::decodes_the_console_only_instructions (including the 4 new prefix-precedence assertions) and eh::tests::clwb_single_step_keeps_code_and_normal_faults_still_patch passed with 0 skips. 28 SKIPPED lines (host environment only: 22 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 2 no heap windows, 1 cannot disable the driver cache (Windows Developer Mode required)).review: Read the full merged diff (+12/-10 in crates/xcl/src/insn.rs). Removes the separate
pf3flag indecodeand usesrep(tracking the last0xF2/0xF3prefix seen) uniformly soCLWB(0x66 0F AE /6memory) requiresrep == 0 && p66(rejectingF2/F3overriding66) andRDPID(0xF3 0F C7 /7register) requiresrep == 0xF3(rejectingF2afterF3), matching x86 mandatory prefix precedence. Four new assertions indecodes_the_console_only_instructionsverify all four invalid prefix combinations decode toNone. Minimal, exact, no scope creep or UB.performance: not applicable (Tier 1 —
#UDinstruction decoder only, off hot rendering/GPU paths).verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)