From ca6346decf8a8316a92e7d8c8ceb2039117ca4a1 Mon Sep 17 00:00:00 2001 From: bmjask <> Date: Thu, 26 Nov 2026 00:41:33 -0800 Subject: [PATCH] D3D12.X: separate compute blobs by node mask Driver cached pipeline blobs can be node-specific on linked-adapter devices. Include NodeMask in the in-memory compute blob identity so a compile for one node cannot be offered to another. Checked with the Windows GNU cross-target cargo check; Windows runtime and GPU tests were not available. Assisted-by: Codex (GPT-5.6-sol) --- crates/xcl/src/hle/d3d12x/real.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs index 54d1da6af9..c03461226f 100644 --- a/crates/xcl/src/hle/d3d12x/real.rs +++ b/crates/xcl/src/hle/d3d12x/real.rs @@ -4886,7 +4886,7 @@ unsafe fn compute_container(this: *mut c_void, f: PsoFn, d: &D3D12_COMPUTE_PIPEL copy.CachedPSO = D3D12_CACHED_PIPELINE_STATE::default(); // A program built again gets the driver's own result of its first build: a retail title // made 14 big compute pipelines twice while loading, 13 - 30 s each the second time. - let key = compute_blob_key(dxil, rs as usize, copy.Flags.0); + let key = compute_blob_key_for(dxil, rs as usize, copy.Flags.0, copy.NodeMask); let mut cached = compute_blob(key); // … and one built in an earlier run gets the blob kept on disk then (`driver_cache`) let disk = driver_cache::path_for_root(dxil, copy.Flags.0, mode == ComputeBuild::Chain, samplers); @@ -5658,9 +5658,14 @@ const COMPUTE_BLOBS_MAX: usize = 512 << 20; const COMPUTE_BLOB_MIN_DXIL: usize = 16 << 10; fn compute_blob_key(dxil: &[u8], rs: usize, flags: i32) -> (u64, usize, i32) { + compute_blob_key_for(dxil, rs, flags, 0) +} + +fn compute_blob_key_for(dxil: &[u8], rs: usize, flags: i32, node_mask: u32) -> (u64, usize, i32) { use std::hash::{Hash, Hasher}; let mut h = std::collections::hash_map::DefaultHasher::new(); dxil.hash(&mut h); + node_mask.hash(&mut h); (h.finish(), rs, flags) } @@ -5727,6 +5732,8 @@ mod compute_blob_tests { let dxil = vec![7u8; 1000]; let key = super::compute_blob_key(&dxil, 0x1000, 0); assert_eq!(key, super::compute_blob_key(&dxil.clone(), 0x1000, 0)); + assert_eq!(key, super::compute_blob_key_for(&dxil, 0x1000, 0, 0)); + assert_ne!(key, super::compute_blob_key_for(&dxil, 0x1000, 0, 2)); assert_ne!(key, super::compute_blob_key(&dxil, 0x2000, 0)); assert_ne!(key, super::compute_blob_key(&dxil, 0x1000, 1)); let mut other = dxil.clone();