Skip to content
Merged
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
19 changes: 18 additions & 1 deletion crates/xcl/src/gpu/recomp/dxc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,23 @@ mod version_tests {
assert_eq!(lib(0, 0, "10.0.1.2").to_string(), "(file 10.0.1.2)");
}

#[test]
fn a_source_compiled_at_o0_has_no_debug_noops() {
if location().is_err() {
crate::gpu::recomp::runner::skip_test("no DXC");
return;
}
let src = "RWByteAddressBuffer m : register(u0);\n[numthreads(1, 1, 1)] void main() { uint a = m.Load(0); uint b = a + 1u; m.Store(4, b); }\n";
let padded = format!("{src}{}", " ".repeat(8 * 1024 * 1024));
let with_noops = compile(src, "main", "cs_6_6", &["-O0"]).unwrap();
let without = compile(src, "main", "cs_6_6", &["-O0", "-opt-disable", "debug-nops"]).unwrap();
if without.len() == with_noops.len() {
println!("this DXC has no debug-nops switch");
return;
}
assert_eq!(compile(&padded, "main", "cs_6_6", &[]).unwrap().len(), without.len());
}

/// The DXC of this PC, when it has one: what `report.json` says of it.
#[test]
fn the_loaded_dxc_is_identified() {
Expand Down Expand Up @@ -489,7 +506,7 @@ fn compile_here(src: &str, entry: &str, profile: &str, extra: &[&str]) -> Result
// a 19 600-instruction CS: 13.5 s instead of 17.7 at -O3; -O0 10.6 s, but twice the DXIL)
if !extra.iter().any(|a| a.starts_with("-O")) {
if src.len() > 8 * 1024 * 1024 {
args.push(crate::util::wide("-O0"));
args.extend(["-O0", "-opt-disable", "debug-nops"].map(crate::util::wide));
} else if src.len() > 1024 * 1024 {
args.push(crate::util::wide("-O1"));
}
Expand Down
Loading