Recompiler: the build script reads its sources from the checkout being built #2401
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2411"
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 Anon64 on 2026-11-25T18:07:12Z.
crates/xcl/build.rstook the crate's directory fromenv!("CARGO_MANIFEST_DIR"), which is fixed when the build script is compiled. Cargo reuses a compiled build script in another checkout that shares the target directory: the script's dep-info lists only workspace-relative paths, so a git worktree with the samebuild.rsgets the same script binary. That script then reads and hashes the first checkout's translator sources. While both checkouts exist,XCL_TRANSLATOR_SOURCE_IDis made from the wrong tree. Once the first one is removed, every build of the other that reruns the script fails:The script now reads
CARGO_MANIFEST_DIRwhen it runs, as Cargo documents for build scripts.What is in it
crates/xcl/build.rs:rootcomes fromstd::env::var_os("CARGO_MANIFEST_DIR")at run time instead ofenv!. Nothing else changes.Tested
main68a284a: worktree A builds-p xclwithCARGO_TARGET_DIRset to checkout B's target. Worktree A is moved away (git worktree move). In B,touch crates/xcl/src/gpu/dxbc.rsandcargo build -p xclfail with the panic above. The script binary intarget/debug/build/xcl/<hash>/out/contains worktree A's path.cargo test --workspace --no-fail-fast -- --test-threads=4: 1289 passed, 1 failed, 46 ignored. The failure isgpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, which fails onmain68a284atoo (1219 passed, 1 failed, 26 ignored in the lib tests on both) and was fixed onmainby #2420 after this run.f16_programs_on_the_gpu,f32_programs_on_the_gpu,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpuandheap_window_out_of_memory_falls_back_to_the_switch_form.STATUS_ACCESS_VIOLATIONafter that failure. It did not recur in two lib-only reruns or the full run above, and does not involve the build script.Regression run
scripts/smoke.ps1of a retail title, 60 s each,mainand this branch's current head (warm caches, A presses scripted):(The
mainrun went further into world loading inside its 60 s, hence its higher commit and lower present rate at the end. The change itself is build-time only.)Not tested
gnutarget).cargowith--remap-path-prefixor a vendored build.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T18:22:16Z.
Independent AMD RDNA4 (native wave64) test report on exact head
c9dccc9a1e64b58e3b6accf03727efc4aed9fe43(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.D:\xcl-verify) sharingCARGO_TARGET_DIR(D:\xcl\target) with the main checkout:cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1287 passed, 3 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record).main68a284a:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722) andfuzz_validate_and_gpu_3(seed 1599) on this GPU, plusgpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier(from50a9fde/ #2074).Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T20:30:09Z.
Review: COMMENTED
No code-level defect found: reading CARGO_MANIFEST_DIR at build-script runtime correctly makes a reused build-script binary resolve the active checkout. This bug fix still lacks the repository-required regression test: add a shared CARGO_TARGET_DIR/two-worktree case that fails without the change where feasible. The current Windows build/test check also failed with generic exit-code metadata, so please provide a green rerun before merge.
upstream-sync referenced this pull request2026-11-26 00:04:27 +00:00
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-26T21:16:07Z.
@bmjask thanks, added and rebased onto
main(8b957bec); head is now8e245509.Test: the hashing moved from
build.rsintosource_hash::source_ids(root, watch), whichbuild.rscalls with the runtimeCARGO_MANIFEST_DIR.source_hash::tests::built_ids_are_this_checkouts_sourcesrecomputes the three IDs from the tested checkout and compares them withenv!("XCL_TRANSLATOR_SOURCE_ID"),XCL_PER_LANE_SOURCE_IDandXCL_DIRECT_DXIL_SOURCE_ID. It fails when a build script reused from another worktree hashed that worktree's sources. In a single checkout it passes with or without the fix; I did not set up the two-worktree case to show it failing without it.CI: the earlier failure was
lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrieron the old base, unrelated to this change; it passes after the rebase.Tested
cargo test --workspace -- --test-threads=4: 1399 passed, 0 failed, 31 ignored, 25 SKIPPED (the e2e tests rerun once aftercargo build --workspace, which I had skipped)AI use: Claude Code with Claude Opus 5.5 wrote the change, ran the tests and wrote this reply.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T00:59:40Z.
Tested
Clean
8e2455097ea29f1c410e688b01ffd20fd5e74f72, Windows 11 build 26200, AMD Ryzen 7 3800X, Rust/Cargo 1.100.0 MSVC debug. CPU-only, with dedicated target and temp.cargo test --locked -j 2 -p xcl --lib source_hash::tests:: -- --nocapture: 3 passed, 0 failed, 0 ignored, 0 skipped.cargo test --offline -j 2 -vv --lib source_hash::tests::built_ids_are_this_checkouts_sources -- --exact --nocaptureacross synthetic checkouts A, B, and B after moving A. Three passes, zero failures, ignores or skips. Cargo reused the build script executable and checkout B's IDs matched its sources on both runs. Replacing the runtime manifest path with the compile-time path caused the expected stale-ID test failure on B and the expected missing-source error when A had moved. The unchanged control on A passed.Not tested
Full workspace suite, GPU, retail-title smoke.
AI use
Codex in T3 Code (
gpt-6.2-solfor the worker run) wrote the scratch harness, ran the checks and drafted this report. The coordinator reran the checked-in group and scratch harness.Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-27T18:00:46Z.
Tested on AMD / Linux:
8e245509(RX 9070 16 GB, RDNA4, Mesa 26.3.1 RADV; Ryzen 5 9600X, 32 GB; CachyOS; Proton Experimentalexperimental-11.0-20261112with vkd3d-proton masterec207194plus a local patch dropping thelpVtblchecks of command allocators and lists; DXC 1.9.2609.5; Rust 1.96.0,x86_64-pc-windows-gnudebug build, tests run under Wine)The head as it is (base
8b957bec), withmainf9a0cb80the same session as the baseline.Tests (
XCL_REQUIRE_GPU=wave64)cargo test -p xcl --lib -- source_hash --test-threads=1: 3 passed, 0 failed, 0 ignored (includesbuilt_ids_are_this_checkouts_sources).cargo test --workspace --no-fail-fast -- --test-threads=4with--skip compositor_blends_ui_plane_over_scene_plane --skip failed_restore_stops_before_importing_an_unbacked_window --skip grooming_leaves_a_window_under_1_gib_only_its_hole(the first loses the RADV device here, the other two run out of memory under Wine): lib 1310 passed, 8 failed, 27 ignored;mainf9a0cb80lib the same session: 1323 passed, 9 failed, 27 ignored (--test-threads=1and two--test-threads=4runs). All failures are amongmain's. The other binaries fail the same 3 tests as onmainhere (e2e,pls_quota,predication_e2e).d3d12_resource_and_syncended the process, as it does onmainhere.Not tested
AI use
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-28T00:12:05Z.
@JJAutoCompare @ClosetPie107 thanks for the runs. Nothing to change from them; the second-checkout case is covered by
built_ids_are_this_checkouts_sourcesonly, as you note.AI use: Claude Code (Claude Opus 5.5) read the reports and wrote this reply.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:59:17Z.
Triage (#1607) – head
8e24550#2789 made the same core fix (
build.rsreadsCARGO_MANIFEST_DIRat run time instead ofenv!) in 3 lines. Its author closed it unmerged, so this PR is the only open one. Main'sbuild.rsstill usesenv!("CARGO_MANIFEST_DIR")(line 115) and now also passes that root to the newpreparation_layout_id, so the rebase has to cover that input too. Moving the source lists intosrc/source_hash.rsgoes beyond the fix: it makes the lib testbuilt_ids_are_this_checkouts_sourcespossible, but in a single checkout that test passes with or without the fix.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.