Verify GPU plan: raise_after_staging back under complexity 10 (copy-kernel retain extracted)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
a2f5854d72
commit
228552f1a3
@@ -220,9 +220,7 @@ impl<'ctx> schedule::OriginalVerifyCpuSink<'_, 'ctx> {
|
||||
) -> Result<()> {
|
||||
let flag_b = self.flag_b_host_address()?;
|
||||
if flag_b_route(kernel, pcie.is_some()) == FlagBRoute::AtOnce {
|
||||
if kernel && !plan.pcie.is_empty() {
|
||||
self.bank.retain_pcie_source(Rc::clone(pcie.as_ref().ok_or(Error::InvalidQwenShape)?.bank))?;
|
||||
}
|
||||
self.retain_for_copy_kernel(plan, pcie.as_ref(), kernel)?;
|
||||
return self.raise_flag_b();
|
||||
}
|
||||
let source = pcie.ok_or(Error::InvalidQwenShape)?;
|
||||
@@ -236,6 +234,19 @@ impl<'ctx> schedule::OriginalVerifyCpuSink<'_, 'ctx> {
|
||||
self.raise_after_copies(copy, flag_b, write)
|
||||
}
|
||||
|
||||
/// The copy kernel reads the bank's registered bytes inside the graph: keep the bank retained until the window's fence.
|
||||
fn retain_for_copy_kernel(
|
||||
&mut self,
|
||||
plan: &OriginalVerifyGpuPlan,
|
||||
pcie: Option<&OriginalVerifyPcieSource<'_, 'ctx>>,
|
||||
kernel: bool,
|
||||
) -> Result<()> {
|
||||
if !kernel || plan.pcie.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
self.bank.retain_pcie_source(Rc::clone(pcie.ok_or(Error::InvalidQwenShape)?.bank))
|
||||
}
|
||||
|
||||
/// Queues the flag B write behind the staging copies: a stream write when supported, else a host callback.
|
||||
fn raise_after_copies(&self, copy: &mut OriginalGpuStream<'ctx>, flag_b: usize, write: bool) -> Result<()> {
|
||||
if write {
|
||||
|
||||
Reference in New Issue
Block a user