Stores by address are bounded: title buffers take the builder's only where it was given them to write
A directory entry says whether stores by address reach its page (translator and host). Faults take at most 128 pages a frame and 8,192 in all; every slot of the copies' run holds a null view until its copy is there; a page is looked at once a frame. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ea375caa52
commit
96bfd0ebec
6 files changed
+136
-46
No files matched your search
@@ -1783,7 +1783,7 @@ impl<'a> Lower<'a> {
|
||||
if let Some(bias) = self.root_bias(a.param) {
|
||||
off = self.s.m.bin(c, Bin::Add, off, bias);
|
||||
}
|
||||
match self.root_memory(&src, off, guard) {
|
||||
match self.root_memory(&src, off, guard, false) {
|
||||
Some((h, byte)) => {
|
||||
off = byte;
|
||||
Some(h)
|
||||
@@ -3013,8 +3013,10 @@ impl<'a> Lower<'a> {
|
||||
/// (and drops writes) through the null view at the first slot, and its
|
||||
/// number is left for the host, for lanes that run (`guard`). Goes on in
|
||||
/// another block.
|
||||
fn memory(&mut self, lo: V, hi: V, guard: Option<V>) -> (V, V) {
|
||||
use super::shader::{MEMORY_FAULTS, MEMORY_PAGES, SLOT_FAULTS, SLOT_MEMORY, USER_MEMORY_BASE};
|
||||
/// With `store`, a page that is not to be written ([`super::shader::MEMORY_READ_ONLY`])
|
||||
/// is the null view.
|
||||
fn memory(&mut self, lo: V, hi: V, guard: Option<V>, store: bool) -> (V, V) {
|
||||
use super::shader::{MEMORY_FAULTS, MEMORY_PAGES, MEMORY_READ_ONLY, SLOT_FAULTS, SLOT_MEMORY, USER_MEMORY_BASE};
|
||||
let c = self.cur;
|
||||
let (i32t, res) = (self.s.t.i32, self.s.t.res_ret);
|
||||
let k = |l: &mut Self, v: u32| l.s.m.i32(v);
|
||||
@@ -3043,7 +3045,9 @@ impl<'a> Lower<'a> {
|
||||
&[directory, at, iu, both, align],
|
||||
);
|
||||
let (copy, start) = (self.s.m.extract(c, entry, 0), self.s.m.extract(c, entry, 1));
|
||||
let (copy, start) = (self.as_int(copy), self.as_int(start));
|
||||
let (number, start) = (self.as_int(copy), self.as_int(start));
|
||||
let mask = k(self, !MEMORY_READ_ONLY);
|
||||
let copy = self.s.m.bin(c, Bin::And, number, mask);
|
||||
// A page without a copy: its number, at a place by the number. In a
|
||||
// branch: the notes lie in the PC's memory, and a store there with
|
||||
// every node of every ray would be most of what a trace does.
|
||||
@@ -3073,6 +3077,12 @@ impl<'a> Lower<'a> {
|
||||
);
|
||||
self.end_guarded(noting, &[]);
|
||||
let c = self.cur;
|
||||
let copy = if store {
|
||||
let closed = self.s.m.cmp(c, pred::SLT, number, zero);
|
||||
self.s.m.select(c, closed, zero, copy)
|
||||
} else {
|
||||
copy
|
||||
};
|
||||
let base = self.host_word(RootType::Other(USER_MEMORY_BASE), 0, 0);
|
||||
let slot = self.s.m.bin(c, Bin::Add, base, copy);
|
||||
// The builder's threads read what others of the dispatch wrote (a
|
||||
@@ -3112,7 +3122,7 @@ impl<'a> Lower<'a> {
|
||||
/// another block.
|
||||
/// shortcut: an access of several dwords is taken not to cross the end
|
||||
/// of a host copy (the builder's records lie on their size).
|
||||
fn root_memory(&mut self, src: &Source, off: V, guard: Option<V>) -> Option<(V, V)> {
|
||||
fn root_memory(&mut self, src: &Source, off: V, guard: Option<V>, store: bool) -> Option<(V, V)> {
|
||||
let (lo, hi) = self.root_address(src)?;
|
||||
let c = self.cur;
|
||||
let i32t = self.s.t.i32;
|
||||
@@ -3123,7 +3133,7 @@ impl<'a> Lower<'a> {
|
||||
let sign = self.s.m.bin(c, Bin::AShr, off, k31);
|
||||
let hi = self.s.m.bin(c, Bin::Add, hi, carry);
|
||||
let hi = self.s.m.bin(c, Bin::Add, hi, sign);
|
||||
let (h, byte) = self.memory(sum, hi, guard);
|
||||
let (h, byte) = self.memory(sum, hi, guard, store);
|
||||
self.root_copy = Some(h);
|
||||
Some((h, byte))
|
||||
}
|
||||
@@ -3173,7 +3183,7 @@ impl<'a> Lower<'a> {
|
||||
let Some(Operand::Vector { reg, .. }) = *dst else {
|
||||
return Err("a global load result");
|
||||
};
|
||||
let (h, byte) = self.memory(lo, hi, guard);
|
||||
let (h, byte) = self.memory(lo, hi, guard, false);
|
||||
let c = self.cur;
|
||||
let mask = self.s.m.i8((1u8 << n) - 1);
|
||||
let r = self.s.op(
|
||||
@@ -3195,7 +3205,7 @@ impl<'a> Lower<'a> {
|
||||
let n = count(rest)?;
|
||||
let d = data.as_ref().ok_or("global store data")?;
|
||||
let vals = self.vgprs(inst, d, n)?;
|
||||
let (h, byte) = self.memory(lo, hi, guard);
|
||||
let (h, byte) = self.memory(lo, hi, guard, true);
|
||||
let mut args = vec![h, byte, iu];
|
||||
args.extend(&vals);
|
||||
args.resize(3 + 4, iu);
|
||||
@@ -3222,7 +3232,7 @@ impl<'a> Lower<'a> {
|
||||
Some(x) => self.i32_of(x)?,
|
||||
None => self.s.m.i32(0),
|
||||
};
|
||||
let (h, byte) = self.memory(lo, hi, guard);
|
||||
let (h, byte) = self.memory(lo, hi, guard, true);
|
||||
let c = self.cur;
|
||||
// DXIL's atomic operations: add 0, and 1, or 2, xor 3, signed
|
||||
// minimum 4 and maximum 5, unsigned 6 and 7, exchange 8.
|
||||
@@ -3357,7 +3367,7 @@ impl<'a> Lower<'a> {
|
||||
for first in (0..count).step_by(4) {
|
||||
let n = (count - first).min(4);
|
||||
let (lo, hi) = self.address_plus(lo, hi, offset + 4 * i32::from(first));
|
||||
let (h, byte) = self.memory(lo, hi, None);
|
||||
let (h, byte) = self.memory(lo, hi, None, false);
|
||||
let c = self.cur;
|
||||
let mask = self.s.m.i8((1u8 << n) - 1);
|
||||
let r = self.s.op(
|
||||
@@ -6004,7 +6014,7 @@ impl<'a> Lower<'a> {
|
||||
return Ok(());
|
||||
}
|
||||
if matches!(kind, Some(u) if u.kind == ResourceType::Srv) {
|
||||
let h = match self.root_memory(src, addr, None) {
|
||||
let h = match self.root_memory(src, addr, None, false) {
|
||||
Some((h, byte)) => {
|
||||
addr = byte;
|
||||
h
|
||||
@@ -11279,7 +11289,7 @@ impl<'a> Lower<'a> {
|
||||
off = self.s.m.bin(c, Bin::Add, element, off);
|
||||
index = None;
|
||||
}
|
||||
if let Some((_, byte)) = self.root_memory(src, off, guard) {
|
||||
if let Some((_, byte)) = self.root_memory(src, off, guard, store || atomic.is_some()) {
|
||||
off = byte;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user