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.
This commit is contained in:
Niko1221 committed 2026-10-23 18:37:31 +02:00
1 parent 883d0000a7
commit ca903c124a
1 file changed
+9 -1
+9 -1
View File
@@ -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 <typename K, typename... A>
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();
}