Skip to main content

execute_compiled_with_wait_hint

Function execute_compiled_with_wait_hint 

Source
pub fn execute_compiled_with_wait_hint(
    compiled: &CompiledNode,
    inputs: &[Arc<RwLock<Storage>>],
    outputs: &mut [Arc<RwLock<Storage>>],
    layouts: &[Layout],
    will_be_waited: bool,
) -> Result<CompletionHandle>
Expand description

Step E A4b open question #4 — “event only where waited”. Identical to execute_compiled except the caller supplies will_be_waited: whether ANY later step in this realize will individually wait this node’s completion handle before the realize-end drain (today: the cross-device Copy/Move producer wait, wait_producer_handle in pipelined.rs).

will_be_waited == false lets produce_pending skip the CUDA Event/in-flight-counter machinery entirely and return CompletionHandle::Ready immediately — the kernel is still launched on the device stream exactly as before; only the completion-observation bookkeeping is elided. Same-device consumers stay correct because CUDA has one stream per device: stream order alone guarantees a later same-device kernel doesn’t start before this one’s writes land, with no host-side wait required. Cutting the event is safe PROVIDED the caller’s wait-set is conservative (a producer that turns out to be waited must always pass true) — pipelined.rs’s pre-scan is exactly that: built from the SAME Copy/Move nodes the mid-walk wait consults.

will_be_waited == true is byte-identical to the pre-elision path.