Skip to content

Commit d22214e

Browse files
committed
chore[gpu]: error out in case of mixed cpu/gpu execution
Signed-off-by: Alexander Droste <[email protected]>
1 parent 7b47788 commit d22214e

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

‎vortex-cuda/src/executor.rs‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use vortex::array::arrays::struct_::StructDataParts;
2626
use vortex::array::buffer::BufferHandle;
2727
use vortex::dtype::PType;
2828
use vortex::error::VortexResult;
29+
use vortex::error::vortex_bail;
2930
use vortex::error::vortex_err;
3031

3132
use crate::CudaSession;
@@ -417,19 +418,27 @@ impl CudaArrayExt for ArrayRef {
417418

418419
// Try all GPU execution strategies: fused dynamic dispatch, partial
419420
// fusion with subtree fallbacks, and single-kernel fallback.
420-
// If none succeed, fall back to CPU execution.
421-
match hybrid_dispatch::try_gpu_dispatch(&self, ctx).await {
421+
// If none succeed, fall back to CPU execution only when all buffers
422+
// remain host-resident.
423+
let gpu_error = match hybrid_dispatch::try_gpu_dispatch(&self, ctx).await {
422424
Ok(canonical) => return Ok(canonical),
423425
Err(e) => {
424426
debug!(
425427
encoding = %self.encoding_id(),
426428
error = %e,
427429
"No GPU execution path available, falling back to CPU"
428430
);
431+
e
429432
}
433+
};
434+
435+
if !self.is_host() {
436+
vortex_bail!(
437+
"GPU execution for encoding {} failed ({gpu_error}); CPU fallback with device-resident buffers is not supported",
438+
self.encoding_id()
439+
);
430440
}
431441

432-
// TODO(0ax1): Double check whether we need to move buffers back to the host explicitly.
433442
self.execute(&mut ctx.ctx)
434443
}
435444
}

0 commit comments

Comments
 (0)