Follow-up fix forward: the mask extract's and the depth gap's tests; the old render key re-pinned at 2206

Gate m3-max-59374 (the batch before its rebase onto development 2258522299) found four reds of
this batch's own, each a test still asserting the old form:
- device::tests::from_queries::from_queries_keeps_the_narrow_mask_on_ga10x asserted no
  OpBitFieldUExtract; the extract is now the one form, so it is
  from_queries_clears_a_narrow_value_by_an_extract_on_ga10x and asserts one (59374: 3 extracts).
- tests::engine_tessellation::ushort_patch_and_instance_indices_are_masked looked for an
  OpBitwiseAnd by 0xffff; each load is now cleared by OpBitFieldUExtract of offset 0, count 16.
- tests::engine_fragment::a_returned_stencil_and_sample_mask_are_tested_in_the_shader expected
  FramebufferFetch; the refusal is Feature::MultisampledShaderDepthTest (59374's own answer).
- pipeline::compile::tests::the_old_render_descriptor_key_keeps_its_value: SEMANTICS_VERSION 2206
  gives e937cf25c6060126a5de54f612b5ca4bd30b2eb78ddc64801c3e65c6105bfd57 (59374).
This commit is contained in:
Anees Iqbal committed 2026-11-20 10:36:12 -08:00
1 parent be2c5d567e
commit f8d1d15c96
4 files changed
+31 -37

No files matched your search

@@ -115,15 +115,15 @@ entry:
/// A narrow mask over a signed clamp, to exactly 16 bits' range, of a sum of two values
/// sign-extended from 16 bits ([`NARROW_CLAMP`]), on an NVIDIA Ampere GA10x description (the RTX
/// 50's capture under the RTX 3090's identity): `Device::from_queries` masks it with
/// `OpBitwiseAnd`, as on every device, and emits no `OpBitFieldUExtract`.
/// 50's capture under the RTX 3090's identity): `Device::from_queries` clears its high bits with
/// `OpBitFieldUExtract`, as on every device.
#[test]
fn from_queries_keeps_the_narrow_mask_on_ga10x() {
fn from_queries_clears_a_narrow_value_by_an_extract_on_ga10x() {
use crate::budget::SPIRV_WORDS;
use crate::lower::select::LowerInputs;
use crate::pipeline::compile::{compile_bitcode_kept, EntryRef};
use crate::pipeline::testing::{llvm_assemble_text, meter, AssembleError};
use crate::spirv::ir::{BinOp, Inst};
use crate::spirv::ir::Inst;
let bc = match llvm_assemble_text(NARROW_CLAMP) {
Ok(bc) => bc,
Err(AssembleError::Missing(why)) => {
@@ -136,31 +136,19 @@ fn from_queries_keeps_the_narrow_mask_on_ga10x() {
desc.driver_id = Some(vk::DriverId::NVIDIA_PROPRIETARY);
desc.vendor_id = 0x10de;
desc.device_id = 0x2204;
// The unsigned extracts and the ANDs of the kernel compiled on `p`.
let counts = |p: &DeviceProfile| {
// The unsigned extracts of the kernel compiled on `p`.
let extracts = |p: &DeviceProfile| {
let entry = EntryRef::Name("narrow_clamp");
let inputs = LowerInputs::new();
let compiled = compile_bitcode_kept(&bc, entry, p, &inputs, &mut meter(), SPIRV_WORDS);
let (_, _, module) = compiled.expect("compiled");
let insts = || module.blocks().iter().flat_map(|b| b.insts.iter());
let extracts = insts()
module
.blocks()
.iter()
.flat_map(|b| b.insts.iter())
.filter(|n| matches!(n.inst, Inst::BitFieldExtract { signed: false, .. }))
.count();
let ands = insts()
.filter(|n| {
matches!(
n.inst,
Inst::Binary {
op: BinOp::BitwiseAnd,
..
}
)
})
.count();
(extracts, ands)
.count()
};
let queried = Device::from_queries(desc, DevicePolicy::default()).unwrap();
let (extracts, ands) = counts(queried.profile());
assert_eq!(extracts, 0, "from_queries: an extract");
assert!(ands > 0, "from_queries: no mask");
assert!(extracts(queried.profile()) > 0, "from_queries: no extract");
}
@@ -1274,7 +1274,7 @@ fn the_old_render_descriptor_key_keeps_its_value() {
let key = device("moltenvk-m3").render_descriptor_key(&d);
let hex: String = key.digest().iter().map(|b| format!("{b:02x}")).collect();
assert_eq!(
hex, "6e8e0aca145e2255e36036e94fc8b1cfd903813384847944940380c69cf45a8d",
hex, "e937cf25c6060126a5de54f612b5ca4bd30b2eb78ddc64801c3e65c6105bfd57",
"the old runtime's key of the descriptor"
);
}
@@ -4205,8 +4205,10 @@ fn a_returned_stencil_and_sample_mask_are_tested_in_the_shader() {
assert_eq!(
base.plan(&radv, &shape(tests)).map(|_| ()),
Err(BindError::Unsupported(
crate::error::Unsupported::not_implemented(Feature::FramebufferFetch)
.at_attachment(crate::error::Attachment::Depth)
crate::error::Unsupported::not_implemented(
Feature::MultisampledShaderDepthTest
)
.at_attachment(crate::error::Attachment::Depth)
)),
"{name} at 4x under {tests:?}"
);
@@ -532,7 +532,8 @@ fn a_gated_off_control_point_field_reads_zero_unfetched() {
}
/// A `ushort` `[[patch_id]]` or `[[instance_id]]` holds the low 16 bits of its 32-bit patch input
/// zero-extended: each load of the input is masked.
/// zero-extended: each load of the input is cleared past them, by `OpBitFieldUExtract` of offset 0
/// and count 16.
#[test]
fn ushort_patch_and_instance_indices_are_masked() {
let Some(bc) = fixture() else { return };
@@ -541,12 +542,15 @@ fn ushort_patch_and_instance_indices_are_masked() {
let a = compile(&bc, "tess_short_ids", p, None).unwrap_or_else(|e| panic!("{stem}: {e}"));
let (_, words) = link_and_validate(&a, p).unwrap_or_else(|e| panic!("{stem}: {e}"));
let decorations = instructions(&words, crate::spv::Op::Decorate);
let masks: Vec<u32> = instructions(&words, crate::spv::Op::Constant)
.iter()
.filter(|c| c.get(2) == Some(&0xffff))
.map(|c| c[1])
.collect();
let ands = instructions(&words, crate::spv::Op::BitwiseAnd);
let constants = |value: u32| -> Vec<u32> {
instructions(&words, crate::spv::Op::Constant)
.iter()
.filter(|c| c.get(2) == Some(&value))
.map(|c| c[1])
.collect()
};
let (zeros, sixteens) = (constants(0), constants(16));
let extracts = instructions(&words, crate::spv::Op::BitFieldUExtract);
let loads = instructions(&words, crate::spv::Op::Load);
for location in [
TessellationStage::PATCH_INDEX_LOCATION,
@@ -572,10 +576,10 @@ fn ushort_patch_and_instance_indices_are_masked() {
);
for x in loaded {
assert!(
ands.iter().any(|a| {
(a[2] == x && masks.contains(&a[3])) || (a[3] == x && masks.contains(&a[2]))
extracts.iter().any(|e| {
e[2] == x && zeros.contains(&e[3]) && sixteens.contains(&e[4])
}),
"{stem}: a load of location {location} is not masked to 16 bits"
"{stem}: a load of location {location} is not cleared past 16 bits"
);
}
}