Today — Config::block_threads() is .product() over the three block dimensions as u64 (space/lib.rs:61–69). The values come from kernel.toml (spec.rs:172, any non-negative integer). Three large dimensions overflow: a panic in a debug build, a wrapped value in release that then feeds estimate and the gate's threads > WARP_SIZE test. Everything downstream is careful — the constraint evaluator returns "multiplication overflow" (constraint.rs:196), grid_blocks saturates — so this one function is the exception.
Fix. checked_mul folding to Result<u64, SpaceError>; callers propagate. Reject at spec load a block dimension above CUDA's 1024-thread block limit with a clear message, so the overflow cannot be reached from a valid spec in the first place. A proptest over three u64 dims that asserts no panic.
Done when
Today —
Config::block_threads()is.product()over the three block dimensions asu64(space/lib.rs:61–69). The values come fromkernel.toml(spec.rs:172, any non-negative integer). Three large dimensions overflow: a panic in a debug build, a wrapped value in release that then feedsestimateand the gate'sthreads > WARP_SIZEtest. Everything downstream is careful — the constraint evaluator returns "multiplication overflow" (constraint.rs:196),grid_blockssaturates — so this one function is the exception.Fix.
checked_mulfolding toResult<u64, SpaceError>; callers propagate. Reject at spec load a block dimension above CUDA's 1024-thread block limit with a clear message, so the overflow cannot be reached from a valid spec in the first place. A proptest over threeu64dims that asserts no panic.Done when
block_threadscannot panic or wrap; the proptest is in the suite.kernel.tomlwithblock_x = 2048is refused at load with a message naming the limit.