Recompiler: the build script reads its sources from the checkout being built #2411
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2411
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@Anon64 on GitHub · 2026-11-25 18:07 UTC · original
Anon64:build/manifest-dir-at-run→main· +5 −1 · 1 files · 1 commits · opencrates/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 head:Not tested
gnutarget).cargowith--remap-path-prefixor a vendored build.AI use
🤖 Generated with Claude Code
build.rs took the crate's directory from env!("CARGO_MANIFEST_DIR"), which is fixed when the script is compiled. Cargo reuses a compiled build script in another checkout that shares the target directory: its dep-info records only workspace-relative paths, so a git worktree with the same sources gets the same script. That script then hashes (and reads) the first checkout's files. Once that checkout is removed, every build of the other one fails with "read shader translator source: ... cannot find the path specified", and while both exist the translator source id is made from the wrong tree. The script now reads CARGO_MANIFEST_DIR when it runs, as Cargo documents for build scripts. Co-Authored-By: Claude Opus 5.5 <[email protected]>@emirduran707 on GitHub · 2026-11-25 18:22 UTC · original
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
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.