From ca903c124a8e5ca9d0bcbaf129ed274fe98754b0 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Fri, 23 Oct 2026 18:37:31 +0200 Subject: [PATCH] metal: a launch with no Metal dispatch names its own file and line strata_ds4_launch is a macro that passes __FILE__ and __LINE__ to strata_ds4_launch_at, so the abort message reads 'src/dsv41/ds4_iq.cu:1234' rather than a generic line. Each run of the engine is then an exact work item instead of a guess about which of the 146 launches is next, and the message is machine-readable from a log. Build rc=0, strata_ds4 = 1,412,984 B. --- metal/include/metal_compat/cuda_launch.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/metal/include/metal_compat/cuda_launch.h b/metal/include/metal_compat/cuda_launch.h index 25627621..dc0f2bb3 100644 --- a/metal/include/metal_compat/cuda_launch.h +++ b/metal/include/metal_compat/cuda_launch.h @@ -20,4 +20,12 @@ static inline void strata_ds4_launch(K kernel, A&&...) { } // the call sites sit inside namespaces whose first argument would win argument-dependent lookup: force the global one -#define strata_ds4_launch(...) ::strata_ds4_launch(__VA_ARGS__) +// the call sites carry their own location, so a run names the exact launch that needs a dispatch +#define strata_ds4_launch(...) ::strata_ds4_launch_at(__FILE__, __LINE__, __VA_ARGS__) + +// the macro adds the call site's location, so a run names the exact launch that still needs a Metal dispatch +template +static inline void strata_ds4_launch_at(const char* file, int line, K, A&&...) { + std::fprintf(stderr, "strata metal: kernel launch with no Metal dispatch at %s:%d\n", file, line); + std::abort(); +}