Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ Fill the reusable DXIL cache ahead of a run with the read-only package wrapper.
- With a v1 PSO manifest recorded by `XCL_PSO_MANIFEST=1`, `--through-present N` builds the
compute pipelines first used up to that recorded present, in first-use order. A missing cutoff
or unmatched compute key stops the pass before any build. Graphics PSOs require additional state.
On single-node devices, translated compute pipelines use the offline driver-cache entry
when the title requests node mask 1 and disk PSO caching is enabled.
- **`--pipelines` size cap**: a compute program whose DXIL is over 8 MiB and that has no saved
blob is left to the runtime instead of being compiled in the pass — those compiles take tens
of minutes and gigabytes and stopped the pass on the biggest programs. `XCL_PIPELINE_MAX_KB`
Expand Down
23 changes: 23 additions & 0 deletions crates/xcl/src/hle/d3d12x/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6190,13 +6190,23 @@ enum ComputeBuild {
IndirectChain,
}

fn translated_compute_node_mask(node_mask: u32, node_count: u32) -> u32 {
if node_mask == 1 && node_count == 1 { 0 } else { node_mask }
}

unsafe fn compute_container(this: *mut c_void, f: PsoFn, d: &D3D12_COMPUTE_PIPELINE_STATE_DESC, rs: *mut c_void,
dxil: &[u8], samplers: &[crate::gpu::recomp::pso::StaticSampler], record: u64, riid: *const GUID,
ppv: *mut *mut c_void, mode: ComputeBuild) -> (HRESULT, std::time::Duration, bool) {
let mut copy: D3D12_COMPUTE_PIPELINE_STATE_DESC = std::ptr::read(d);
copy.pRootSignature = std::mem::transmute::<*mut c_void, std::mem::ManuallyDrop<Option<ID3D12RootSignature>>>(rs);
copy.CS = bytecode(dxil);
copy.CachedPSO = D3D12_CACHED_PIPELINE_STATE::default();
// Use the offline descriptor for translated compute on a single-node device.
if copy.NodeMask == 1 {
if let Some(device) = ID3D12Device::from_raw_borrowed(&this) {
copy.NodeMask = translated_compute_node_mask(copy.NodeMask, device.GetNodeCount());
}
}
let library_name = match mode {
ComputeBuild::DirectChain => driver_cache::name_for_chain_root_node(
dxil, copy.Flags.0, driver_cache::ChainRoot::DirectConstants, samplers, copy.NodeMask),
Expand Down Expand Up @@ -7177,6 +7187,19 @@ fn forget_compute_blob_if(key: (u64, usize, i32), expected: &std::sync::Arc<Vec<

#[cfg(test)]
mod compute_blob_tests {
#[test]
fn translated_compute_matches_offline_node_on_single_node_device() {
let node_mask = super::translated_compute_node_mask(1, 1);
assert_eq!(
super::driver_cache::name_for_root_node(b"dxil", 0, false, &[], node_mask),
super::driver_cache::name_for_root(b"dxil", 0, false, &[]),
);
assert_eq!(super::translated_compute_node_mask(0, 1), 0);
assert_eq!(super::translated_compute_node_mask(2, 1), 2);
assert_eq!(super::translated_compute_node_mask(1, 2), 1);
assert_eq!(super::translated_compute_node_mask(2, 2), 2);
}

#[test]
fn recorded_split_selects_cached_whole_or_pieces() {
use super::*;
Expand Down
Loading