gpu: port lock-free submit-thread watch/shadow/batch/card_steps/send optimizations
This commit is contained in:
1 parent
84b4509fa3
commit
6f34121d31
5 files changed
+325
-143
No files matched your search
@@ -8847,6 +8847,9 @@ impl Batch {
|
||||
let Step::Refresh(shadow, address, len) = step else {
|
||||
continue;
|
||||
};
|
||||
if shadow.in_place() {
|
||||
continue;
|
||||
}
|
||||
let (from, to) = (*address, *address + *len);
|
||||
let key = std::sync::Arc::as_ptr(shadow) as usize;
|
||||
let at = if last.0 == key && key != 0 {
|
||||
@@ -8876,6 +8879,9 @@ impl Batch {
|
||||
}
|
||||
|
||||
fn add(&mut self, shadow: &std::sync::Arc<crate::shadow::Shadow>, address: usize, len: usize) {
|
||||
if shadow.in_place() {
|
||||
return;
|
||||
}
|
||||
let end = address + len;
|
||||
let key = std::sync::Arc::as_ptr(shadow) as usize;
|
||||
if self.ahead.get(&key).is_some_and(|&(from, to)| from <= address && end <= to) {
|
||||
@@ -8962,6 +8968,9 @@ impl Batch {
|
||||
for step in &list.deferred().copies {
|
||||
match step {
|
||||
Step::Refresh(shadow, at, len) => {
|
||||
if shadow.in_place() {
|
||||
continue;
|
||||
}
|
||||
self.touches.push(Touch::Refresh(std::sync::Arc::as_ptr(shadow) as usize, *at, *at + *len));
|
||||
}
|
||||
Step::GpuWrite(shadow, ..) => self.touches.push(Touch::Write(std::sync::Arc::as_ptr(shadow) as usize)),
|
||||
@@ -9038,6 +9047,9 @@ impl Batch {
|
||||
for (i, step) in list.deferred().copies.iter().enumerate() {
|
||||
touches.push(match step {
|
||||
Step::Refresh(shadow, at, len) => {
|
||||
if shadow.in_place() {
|
||||
continue;
|
||||
}
|
||||
let key = std::sync::Arc::as_ptr(shadow) as usize;
|
||||
copies.entry(key).or_insert_with(|| shadow.clone());
|
||||
Touch::Refresh(key, *at, *at + *len)
|
||||
@@ -9144,7 +9156,7 @@ impl Batch {
|
||||
}
|
||||
// One write-watch asking for the copies that lie close together,
|
||||
// not one per copy.
|
||||
let ahead = self.refreshes.len() > 1;
|
||||
let ahead = self.refreshes.len() > 1 && !crate::watch::kept_active();
|
||||
if ahead {
|
||||
let started = std::time::Instant::now();
|
||||
let ranges: Vec<(usize, usize)> = self
|
||||
|
||||
Reference in new issue
Block a user