From ca9ee7e2dd89dee4a449c5a650a5976a0ee447fb Mon Sep 17 00:00:00 2001 From: haixuanTao Date: Sun, 7 Jun 2026 19:12:25 +0200 Subject: [PATCH] cuda: name the missing entry point in load_function errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A failed load_function previously surfaced as a bare DriverError with no hint of WHICH kernel was missing — the common cause being a stale prebuilt module or a shader/host build mismatch, where the missing entry's name is exactly the diagnostic you need. Add a LoadFunction error variant carrying the entry-point name. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01U2n9RqmxTJb8UG5d1Sjw4W --- crates/khal/src/backend/cuda.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/khal/src/backend/cuda.rs b/crates/khal/src/backend/cuda.rs index 2cba404..b0eaf5e 100644 --- a/crates/khal/src/backend/cuda.rs +++ b/crates/khal/src/backend/cuda.rs @@ -53,6 +53,13 @@ pub enum CudaBackendError { ShaderArg(#[from] ShaderArgsError), #[error("CUDA driver error: {0}")] Driver(#[from] driver::DriverError), + /// The requested kernel entry point was not found in the loaded module — + /// typically a stale prebuilt module or a shader/host build mismatch. + #[error("failed to load kernel entry point `{entry_point}`: {source}")] + LoadFunction { + entry_point: String, + source: driver::DriverError, + }, #[error("Invalid PTX module")] InvalidPtx, } @@ -318,7 +325,12 @@ impl Backend for Cuda { entry_point: &str, _push_constant_size: u32, ) -> Result { - let func = module.inner.load_function(entry_point)?; + let func = module.inner.load_function(entry_point).map_err(|source| { + CudaBackendError::LoadFunction { + entry_point: entry_point.to_string(), + source, + } + })?; Ok(CudaFunction { func }) }