Shaders: hold the --precompile DXC compiles to a share of the RAM #1752

Open
Pardok wants to merge 1 commit from upstream-pr/1762 into main
Pardok commented 2026-11-24 20:22:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Pardok on 2026-11-24T20:22:00Z.


Precompile: hold the DXC compiles to a share of the RAM

xcl shaders --precompile on a retail pack (26 503 programs) ran to ~100 GB of commit, most of it in the page file, and stalled for tens of minutes on the compute programs near the end of the pack. wait_for_memory admits a compile when the free commit is at least 6 GB plus 1 GB per running compile, and an auto-growing page file keeps that true however much the compiles hold. It also assumes a compile takes at most ~0.7 GB; the pack's CS_RaytracingResolve_* programs take 2 – 15 GB each in DXC, and four translated compute programs (CS_ScreenProbes_*, CS_Primary_Shade_*; 4.6 – 155 MB of HLSL) do not compile at all within 24 GB.

This is a mitigation, not a fix for those four programs: a compile already running keeps growing, and the cap only stops further ones from starting.

What is in it

  • gpu/recomp/dxc.rs: set_memory_cap / default_memory_cap (XCL_DXC_MEMORY_GB, default half of the RAM, 0 = none), private_bytes (the process's private commit), cap_admits, and wait_for_memory using it when a cap is set. Under a cap a compile starts at once below a quarter of the cap, one per 500 ms up to the cap, and not while another runs at the cap (one alone always goes, so nothing deadlocks); the 60 s wait no longer lets one through. Without a cap (a running title) nothing changes.
  • shaders.rs: --precompile sets the cap and prints it.
  • Two unit tests: the admission rule, and private_bytes reading this process.

Tested

  • AMD Ryzen 7 9800X3D, 32 GB RAM (31.1 GB usable, so the default cap is ~15.5 GB), AMD Radeon RX 9070 XT (driver 32.0.32029.2010), Windows 11 Pro build 26200, Rust 1.100.0, release.
  • cargo test --release -p xcl --lib -- memory_cap private_bytes: 2 passed, 0 failed, 0 ignored (on this PR's commit, rebased onto main b9b6ea62).
  • xcl shaders <pack> --precompile --only cs, 15 compile threads, run inside a 24 GB job object so a runaway would be killed: peak ~24 GB (before, with the same threads and no cap: over 100 GB, 20 GB of it resident), the process was not killed, and 2 685 compute programs compiled in 40 min with 4 errors (DXC "not enough memory" on the four programs above).
  • The following full --precompile of the same pack, same limits, finished (25 134 compiled, 10 434 already cached, 22 errors, 390 GS programs skipped).

Regression run
Not run yet (draft): scripts/smoke.ps1 on main and on this commit. The change does not run in a title: --precompile is the only caller of set_memory_cap.

Not tested

  • cargo test --workspace -- --test-threads=4 (only the two new tests were run).
  • scripts/smoke.ps1 on a title (see above).
  • NVIDIA / other CPUs; machines with a fixed-size page file or less RAM.
  • That the default (half of the RAM) is the right cap: it was not tuned. The measured peak went above the 16 GB cap because compiles already running were not stopped.

AI use

  • Claude Code, Claude Sonnet 5.5: found the cause (read wait_for_memory, traced which programs grew), wrote the change, the tests and this description. The runs above were done on the author's machine under the author's direction.
<!-- greyfinch-sync:ivall/xcl:issue:5479701662 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1762). Originally posted by [Pardok](https://github.com/Pardok) on 2026-11-24T20:22:00Z. --- Precompile: hold the DXC compiles to a share of the RAM `xcl shaders --precompile` on a retail pack (26 503 programs) ran to ~100 GB of commit, most of it in the page file, and stalled for tens of minutes on the compute programs near the end of the pack. `wait_for_memory` admits a compile when the free *commit* is at least 6 GB plus 1 GB per running compile, and an auto-growing page file keeps that true however much the compiles hold. It also assumes a compile takes at most ~0.7 GB; the pack's `CS_RaytracingResolve_*` programs take 2 – 15 GB each in DXC, and four translated compute programs (`CS_ScreenProbes_*`, `CS_Primary_Shade_*`; 4.6 – 155 MB of HLSL) do not compile at all within 24 GB. This is a mitigation, not a fix for those four programs: a compile already running keeps growing, and the cap only stops further ones from starting. **What is in it** - `gpu/recomp/dxc.rs`: `set_memory_cap` / `default_memory_cap` (`XCL_DXC_MEMORY_GB`, default half of the RAM, 0 = none), `private_bytes` (the process's private commit), `cap_admits`, and `wait_for_memory` using it when a cap is set. Under a cap a compile starts at once below a quarter of the cap, one per 500 ms up to the cap, and not while another runs at the cap (one alone always goes, so nothing deadlocks); the 60 s wait no longer lets one through. Without a cap (a running title) nothing changes. - `shaders.rs`: `--precompile` sets the cap and prints it. - Two unit tests: the admission rule, and `private_bytes` reading this process. **Tested** - AMD Ryzen 7 9800X3D, 32 GB RAM (31.1 GB usable, so the default cap is ~15.5 GB), AMD Radeon RX 9070 XT (driver 32.0.32029.2010), Windows 11 Pro build 26200, Rust 1.100.0, release. - `cargo test --release -p xcl --lib -- memory_cap private_bytes`: 2 passed, 0 failed, 0 ignored (on this PR's commit, rebased onto `main` b9b6ea62). - `xcl shaders <pack> --precompile --only cs`, 15 compile threads, run inside a 24 GB job object so a runaway would be killed: peak ~24 GB (before, with the same threads and no cap: over 100 GB, 20 GB of it resident), the process was not killed, and 2 685 compute programs compiled in 40 min with 4 errors (DXC "not enough memory" on the four programs above). - The following full `--precompile` of the same pack, same limits, finished (25 134 compiled, 10 434 already cached, 22 errors, 390 GS programs skipped). **Regression run** Not run yet (draft): `scripts/smoke.ps1` on `main` and on this commit. The change does not run in a title: `--precompile` is the only caller of `set_memory_cap`. **Not tested** - `cargo test --workspace -- --test-threads=4` (only the two new tests were run). - `scripts/smoke.ps1` on a title (see above). - NVIDIA / other CPUs; machines with a fixed-size page file or less RAM. - That the default (half of the RAM) is the right cap: it was not tuned. The measured peak went above the 16 GB cap because compiles already running were not stopped. **AI use** - Claude Code, Claude Sonnet 5.5: found the cause (read `wait_for_memory`, traced which programs grew), wrote the change, the tests and this description. The runs above were done on the author's machine under the author's direction.
DavidM1911 commented 2026-11-25 00:08:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T23:14:22Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7147173217 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1762#issuecomment-7147173217). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T23:14:22Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
Toons29 commented 2026-11-25 04:10:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T03:36:21Z.


Regression run of 3cd15cb7 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 3cd15cb7e89657721ea90c6b997ec4ad428d2358
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1632 (PresentX 1632)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14817 MB

Against the limits in CONTRIBUTING.md: 101 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7152070697 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1762#issuecomment-7152070697). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-25T03:36:21Z. --- Regression run of `3cd15cb7` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 3cd15cb7e89657721ea90c6b997ec4ad428d2358 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1632 (PresentX 1632) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14817 MB ``` Against the limits in CONTRIBUTING.md: 101 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
Foniass commented 2026-12-01 06:41:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:41:58Z.


Triage (#1607) – head 3cd15cb

Other PRs work on the same --precompile memory problem in different ways. #1756 is a script that kills the precompile at a private-commit budget. #2950 reserves an estimated amount of memory per DXC job based on its HLSL size. #1638 runs DXC in worker processes, each with its own cap. None of them caps the process's private bytes inside wait_for_memory the way this PR does.
The PR is built on the old wait_for_memory. Main has since replaced it with MemoryGate::wait_with in gpu/recomp/dxc.rs, so the cap has to be ported to that before this can merge. Under a cap, a compile admitted by the fallback WORKING.compare_exchange(0, 1) does not update LAST_ADMIT_MS. That is minor.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7303170489 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1762#issuecomment-7303170489). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:41:58Z. --- **Triage (#1607)** – head 3cd15cb Other PRs work on the same `--precompile` memory problem in different ways. #1756 is a script that kills the precompile at a private-commit budget. #2950 reserves an estimated amount of memory per DXC job based on its HLSL size. #1638 runs DXC in worker processes, each with its own cap. None of them caps the process's private bytes inside `wait_for_memory` the way this PR does. The PR is built on the old `wait_for_memory`. Main has since replaced it with `MemoryGate::wait_with` in `gpu/recomp/dxc.rs`, so the cap has to be ported to that before this can merge. Under a cap, a compile admitted by the fallback `WORKING.compare_exchange(0, 1)` does not update `LAST_ADMIT_MS`. That is minor. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
gut0to commented 2026-12-02 22:15:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-12-02T22:15:38Z.

Code review location: crates/xcl/src/gpu/recomp/dxc.rs; line 441

@@ -404,6 +404,63 @@ pub fn set_memory_reserve(gb: u64) {
     RESERVE_GB.store(gb, std::sync::atomic::Ordering::Relaxed);
 }
 
+/// Cap on this process's private memory for `xcl shaders --precompile` (0: none, as for a running
+/// title). `wait_for_memory` measures it instead of trusting the free commit, which an
+/// auto-growing page file keeps "plenty" however much the compiles hold: a retail pack's
+/// `CS_RaytracingResolve_*` compute programs take 2 – 15 GB each in DXC, and 15 compile threads
+/// on them ran to 100 GB of commit, most of it in the page file.
+static MEMORY_CAP: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
+
+/// Milliseconds (`memory_clock_ms`) at which the last compile was let in under a cap.
+static LAST_ADMIT_MS: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
+
+/// Sets the cap (`MEMORY_CAP`) in bytes; 0 turns it off.
+pub fn set_memory_cap(bytes: u64) {
+    MEMORY_CAP.store(bytes, std::sync::atomic::Ordering::Relaxed);
+}
+
+/// The cap `--precompile` uses: `XCL_DXC_MEMORY_GB` if set (0 = none), else half of the PC's RAM.
+pub fn default_memory_cap() -> u64 {
+    if let Some(gb) = std::env::var("XCL_DXC_MEMORY_GB").ok().and_then(|v| v.trim().parse::<f64>().ok()) {
+        return (gb.max(0.0) * (1u64 << 30) as f64) as u64;
+    }
+    use windows_sys::Win32::System::SystemInformation::{GlobalMemoryStatusEx, MEMORYSTATUSEX};
+    let mut m: MEMORYSTATUSEX = unsafe { std::mem::zeroed() };
+    m.dwLength = std::mem::size_of::<MEMORYSTATUSEX>() as u32;
+    if unsafe { GlobalMemoryStatusEx(&mut m) } == 0 { 0 } else { m.ullTotalPhys / 2 }
+}
+
+/// This process's private memory (commit) in bytes; 0 when it cannot be read.
+fn private_bytes() -> u64 {
+    use windows_sys::Win32::System::ProcessStatus::{K32GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS_EX};
+    use windows_sys::Win32::System::Threading::GetCurrentProcess;
+    unsafe {
+        let mut c: PROCESS_MEMORY_COUNTERS_EX = std::mem::zeroed();
+        c.cb = std::mem::size_of::<PROCESS_MEMORY_COUNTERS_EX>() as u32;
+        if K32GetProcessMemoryInfo(GetCurrentProcess(), &mut c as *mut _ as *mut _, c.cb) == 0 {
+            return 0;

Low: Returning 0 when K32GetProcessMemoryInfo fails makes the cap fail open: cap_admits treats any usage below one quarter of the cap as safe, so a failed measurement can admit more precompile workers while the actual usage is unknown. Could this return an Option and handle an unavailable reading conservatively (or stop with a diagnostic), with a test for the API-failure path? AI-assisted review: GPT-6 helped inspect the admission path; I traced the failed query through cap_admits.

<!-- greyfinch-sync:ivall/xcl:review-comment:4776865067 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1762#discussion_r4776865067). Originally posted by [gut0to](https://github.com/gut0to) on 2026-12-02T22:15:38Z. **Code review location:** `crates/xcl/src/gpu/recomp/dxc.rs`; line 441 ~~~~diff @@ -404,6 +404,63 @@ pub fn set_memory_reserve(gb: u64) { RESERVE_GB.store(gb, std::sync::atomic::Ordering::Relaxed); } +/// Cap on this process's private memory for `xcl shaders --precompile` (0: none, as for a running +/// title). `wait_for_memory` measures it instead of trusting the free commit, which an +/// auto-growing page file keeps "plenty" however much the compiles hold: a retail pack's +/// `CS_RaytracingResolve_*` compute programs take 2 – 15 GB each in DXC, and 15 compile threads +/// on them ran to 100 GB of commit, most of it in the page file. +static MEMORY_CAP: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); + +/// Milliseconds (`memory_clock_ms`) at which the last compile was let in under a cap. +static LAST_ADMIT_MS: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); + +/// Sets the cap (`MEMORY_CAP`) in bytes; 0 turns it off. +pub fn set_memory_cap(bytes: u64) { + MEMORY_CAP.store(bytes, std::sync::atomic::Ordering::Relaxed); +} + +/// The cap `--precompile` uses: `XCL_DXC_MEMORY_GB` if set (0 = none), else half of the PC's RAM. +pub fn default_memory_cap() -> u64 { + if let Some(gb) = std::env::var("XCL_DXC_MEMORY_GB").ok().and_then(|v| v.trim().parse::<f64>().ok()) { + return (gb.max(0.0) * (1u64 << 30) as f64) as u64; + } + use windows_sys::Win32::System::SystemInformation::{GlobalMemoryStatusEx, MEMORYSTATUSEX}; + let mut m: MEMORYSTATUSEX = unsafe { std::mem::zeroed() }; + m.dwLength = std::mem::size_of::<MEMORYSTATUSEX>() as u32; + if unsafe { GlobalMemoryStatusEx(&mut m) } == 0 { 0 } else { m.ullTotalPhys / 2 } +} + +/// This process's private memory (commit) in bytes; 0 when it cannot be read. +fn private_bytes() -> u64 { + use windows_sys::Win32::System::ProcessStatus::{K32GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS_EX}; + use windows_sys::Win32::System::Threading::GetCurrentProcess; + unsafe { + let mut c: PROCESS_MEMORY_COUNTERS_EX = std::mem::zeroed(); + c.cb = std::mem::size_of::<PROCESS_MEMORY_COUNTERS_EX>() as u32; + if K32GetProcessMemoryInfo(GetCurrentProcess(), &mut c as *mut _ as *mut _, c.cb) == 0 { + return 0; ~~~~ --- **Low**: Returning `0` when `K32GetProcessMemoryInfo` fails makes the cap fail open: `cap_admits` treats any usage below one quarter of the cap as safe, so a failed measurement can admit more precompile workers while the actual usage is unknown. Could this return an `Option` and handle an unavailable reading conservatively (or stop with a diagnostic), with a test for the API-failure path? AI-assisted review: GPT-6 helped inspect the admission path; I traced the failed query through `cap_admits`.
gut0to commented 2026-12-02 22:15:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-12-02T22:15:38Z.

Review: COMMENTED


AI-assisted review: GPT-6 helped inspect the memory-cap admission path; I checked the API failure path and its current caller.

<!-- greyfinch-sync:ivall/xcl:review:6159992764 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1762#pullrequestreview-6159992764). Originally posted by [gut0to](https://github.com/gut0to) on 2026-12-02T22:15:38Z. **Review:** COMMENTED --- AI-assisted review: GPT-6 helped inspect the memory-cap admission path; I checked the API failure path and its current caller.
gut0to commented 2026-12-02 22:16:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-12-02T22:16:51Z.

Code review location: crates/xcl/src/gpu/recomp/dxc.rs; line 503

@@ -433,7 +493,16 @@ pub fn wait_for_memory(wanted: &Wanted) -> MemorySlot {
         m.dwLength = std::mem::size_of::<MEMORYSTATUSEX>() as u32;
         let need = (RESERVE_GB.load(Ordering::Relaxed) << 30) + ((WORKING.load(Ordering::Acquire) as u64) << 30);
         let plenty = unsafe { GlobalMemoryStatusEx(&mut m) } == 0 || m.ullAvailPageFile >= need;
-        if plenty || start.elapsed().as_secs() >= 60 || (WORKING.load(Ordering::Acquire) < WANTED_AT_ONCE && wanted()) {
+        let cap = MEMORY_CAP.load(Ordering::Relaxed);
+        let go = if cap == 0 {
+            plenty || start.elapsed().as_secs() >= 60 || (WORKING.load(Ordering::Acquire) < WANTED_AT_ONCE && wanted())
+        } else {
+            let (now, last) = (memory_clock_ms(), LAST_ADMIT_MS.load(Ordering::Acquire));
+            plenty
+                && cap_admits(cap, private_bytes(), WORKING.load(Ordering::Acquire), now, last)
+                && LAST_ADMIT_MS.compare_exchange(last, now, Ordering::AcqRel, Ordering::Acquire).is_ok()

Medium: This timestamp CAS does not reserve the admission slot before WORKING is incremented. When working == 0, cap_admits returns true regardless of used; concurrent waiters can therefore all reach this line before any of them increments WORKING. If they observe the same millisecond value, each compare_exchange(last, now) can succeed (the later CAS may compare now with itself), allowing several large DXC jobs to start above the quarter-cap threshold. Could admission reserve the first worker atomically before returning, with a barrier-based concurrency test? AI-assisted review: GPT-6 helped trace the admission race; I checked the predicate and ordering in the current diff.

<!-- greyfinch-sync:ivall/xcl:review-comment:4776878367 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1762#discussion_r4776878367). Originally posted by [gut0to](https://github.com/gut0to) on 2026-12-02T22:16:51Z. **Code review location:** `crates/xcl/src/gpu/recomp/dxc.rs`; line 503 ~~~~diff @@ -433,7 +493,16 @@ pub fn wait_for_memory(wanted: &Wanted) -> MemorySlot { m.dwLength = std::mem::size_of::<MEMORYSTATUSEX>() as u32; let need = (RESERVE_GB.load(Ordering::Relaxed) << 30) + ((WORKING.load(Ordering::Acquire) as u64) << 30); let plenty = unsafe { GlobalMemoryStatusEx(&mut m) } == 0 || m.ullAvailPageFile >= need; - if plenty || start.elapsed().as_secs() >= 60 || (WORKING.load(Ordering::Acquire) < WANTED_AT_ONCE && wanted()) { + let cap = MEMORY_CAP.load(Ordering::Relaxed); + let go = if cap == 0 { + plenty || start.elapsed().as_secs() >= 60 || (WORKING.load(Ordering::Acquire) < WANTED_AT_ONCE && wanted()) + } else { + let (now, last) = (memory_clock_ms(), LAST_ADMIT_MS.load(Ordering::Acquire)); + plenty + && cap_admits(cap, private_bytes(), WORKING.load(Ordering::Acquire), now, last) + && LAST_ADMIT_MS.compare_exchange(last, now, Ordering::AcqRel, Ordering::Acquire).is_ok() ~~~~ --- **Medium**: This timestamp CAS does not reserve the admission slot before `WORKING` is incremented. When `working == 0`, `cap_admits` returns true regardless of `used`; concurrent waiters can therefore all reach this line before any of them increments `WORKING`. If they observe the same millisecond value, each `compare_exchange(last, now)` can succeed (the later CAS may compare `now` with itself), allowing several large DXC jobs to start above the quarter-cap threshold. Could admission reserve the first worker atomically before returning, with a barrier-based concurrency test? AI-assisted review: GPT-6 helped trace the admission race; I checked the predicate and ordering in the current diff.
gut0to commented 2026-12-02 22:16:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-12-02T22:16:51Z.

Review: COMMENTED


AI-assisted review: GPT-6 helped inspect the capped admission race; I verified the predicate, timestamp CAS, and worker-count ordering.

<!-- greyfinch-sync:ivall/xcl:review:6160008752 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1762#pullrequestreview-6160008752). Originally posted by [gut0to](https://github.com/gut0to) on 2026-12-02T22:16:51Z. **Review:** COMMENTED --- AI-assisted review: GPT-6 helped inspect the capped admission race; I verified the predicate, timestamp CAS, and worker-count ordering.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1762:upstream-pr/1762'
git switch 'upstream-pr/1762'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1762'
git switch 'upstream-pr/1762'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1762'
git switch 'upstream-pr/1762'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1762'
git switch 'main'
git merge --squash 'upstream-pr/1762'
git switch 'main'
git merge --ff-only 'upstream-pr/1762'
git switch 'main'
git merge 'upstream-pr/1762'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1752
No description provided.