Publish the pareto-residency Windows build and portable launcher

This commit is contained in:
codec_d committed 2026-11-25 22:33:14 -08:00
1 parent efeef1d65b
commit 545f89019e
20 files changed
+1671 -217

No files matched your search

+59 -9
View File
@@ -227,9 +227,9 @@ pub fn track(
let mut offset_at =
std::collections::BTreeMap::<usize, (Vec<usize>, Vec<Value>, Vec<Site>)>::new();
for (b, block) in p.blocks.iter().enumerate() {
t.at.set(Some(b));
for (i, inst) in block.insts.iter().enumerate() {
let site = (b, i);
t.at.set(Some(site));
if let Some(value) = t.restored(inst, Some(b)) {
out.restored_lanes.insert(site, value);
}
@@ -240,7 +240,7 @@ pub fn track(
let mut first_lane = Vec::new();
let mut offset = Vec::new();
let mut descriptor = |op: &Operand, role| -> Result<(), ShaderError> {
let source = t.descriptor(inst, op, b).map_err(fail)?;
let source = t.descriptor(inst, op, site).map_err(fail)?;
// A descriptor the code keeps per lane ([`Tracer::lane_copies`])
// is the same in every lane: its loop is lowered as it stands
// and needs no proof.
@@ -417,8 +417,8 @@ struct Tracer<'a> {
meets: std::cell::RefCell<Meets>,
/// Reverse-postorder index per block.
rpo: Vec<usize>,
/// The block of the access being traced ([`Self::live`]).
at: std::cell::Cell<Option<usize>>,
/// The instruction site of the access being traced ([`Self::live`]).
at: std::cell::Cell<Option<Site>>,
}
/// What lanes are known to satisfy: each [`Bool`] where its flag is set,
@@ -1119,8 +1119,8 @@ impl<'a> Tracer<'a> {
self.address(lo, hi, extra)
}
/// The source of the descriptor operand `op` of `inst`, in block `at`.
fn descriptor(&self, inst: &Inst, op: &Operand, at: usize) -> Result<Source, &'static str> {
/// The source of the descriptor operand `op` of `inst`, at `at`.
fn descriptor(&self, inst: &Inst, op: &Operand, at: Site) -> Result<Source, &'static str> {
let Operand::Scalar { code, dwords } = *op else {
return Err("a descriptor not in SGPRs");
};
@@ -1135,8 +1135,14 @@ impl<'a> Tracer<'a> {
{
words = raw.to_vec();
}
// Only the lanes that reach the access read the descriptor.
let mut known = Vec::from_iter(self.lanes.map(|l| (l.reach[at], true)));
// Only the lanes that reach and run the access read the descriptor.
let mut known = Vec::new();
if let Some(l) = self.lanes {
known.push((l.reach[at.0], true));
if let Some(guard) = l.guards[at.0][at.1] {
known.push((guard, true));
}
}
self.classify(&words, &mut Vec::new(), &mut known)
}
@@ -1288,7 +1294,10 @@ impl<'a> Tracer<'a> {
let (Some(at), Some(lanes)) = (self.at.get(), self.lanes) else {
return t;
};
let mut known = vec![(lanes.reach[at], true)];
let mut known = vec![(lanes.reach[at.0], true)];
if let Some(guard) = lanes.guards[at.0][at.1] {
known.push((guard, true));
}
for _ in 0..MAX_JOINS {
let Term::Value(v) = t else { break };
let Some((block, i)) = self.phis[v.0 as usize] else {
@@ -4098,4 +4107,45 @@ pub(crate) mod tests {
assert_eq!(r.waterfall.compares.len(), 2);
assert_eq!(r.waterfall.reads.len(), 4);
}
#[test]
fn a_guarded_access_excludes_dead_lane_edges_at_a_join() {
// Lanes failing `v_cmp_gt_u32` clear EXEC and take `s_cbranch_execz`
// directly to the join block without initializing the immediate
// sampler `s[8:11]`. The join's `image_sample_lz` is guarded by EXEC,
// so only the arm where `s[8:11]` was built can execute it.
let code: Vec<u8> = [
0xBE84_0300u32, // s_mov_b32 s4, s0
0xBE85_0380, // s_mov_b32 s5, 0
0xF40C_0302,
0xFA00_0000, // s_load_dwordx8 s[12:19], s[4:5], 0x0
0x7E04_0D00, // v_cvt_f32_u32 v2, v0
0x7E06_0302, // v_mov_b32 v3, v2
0x7D88_0090, // v_cmp_gt_u32 vcc_lo, 16, v0
0xBF8C_C07F, // s_waitcnt lgkmcnt(0)
0x877E_6A7E, // s_and_b32 exec_lo, exec_lo, vcc_lo
0xBF88_0004, // s_cbranch_execz -> join (skips 4 dwords)
0xBE88_0380, // s_mov_b32 s8, 0
0xBE89_0380, // s_mov_b32 s9, 0
0xBE8A_0380, // s_mov_b32 s10, 0
0xBE8B_0380, // s_mov_b32 s11, 0
0xF09C_0F08,
0x0043_0C02, // image_sample_lz v[12:15], v[2:3], s[12:19], s[8:11]
S_ENDPGM,
]
.iter()
.flat_map(|w| w.to_le_bytes())
.collect();
let p = crate::ir::build(&code, false, 256).unwrap();
let structured = lanes(&p).expect("structured form");
assert!(structured.guards[2][0].is_some(), "join access must carry an EXEC guard");
let r = track(&p, &[param(Table, 0, 1)], HwStage::Cs, Some(&structured)).unwrap();
assert!(
r.descriptors
.iter()
.any(|d| d.role == Role::Sampler && d.source == Source::Constant(vec![0; 4])),
"guarded join should resolve the immediate sampler from the live arm: {:?}",
r.descriptors
);
}
}