From b1db4ab8e46ab48e5b98a89839d94100437889ef Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Thu, 12 Nov 2026 13:53:05 +0100 Subject: [PATCH] metal: the Metal engine links again; two prompt-path entry points had no Metal stub The staged prompt walk (3feffd597) calls fused::want_dm_f16, and the few-row expert path (af5803e4b) calls fewrows_record. Both are defined only in the CUDA / HIP sources. Prefill::run_impl is linked into the Metal engine but never runs there, so every entry point it calls needs a stub, and these two had none: strata failed to link with two undefined symbols. stubs_prompt_f16.cpp holds both: want_dm_f16 does nothing (the build has no fused kernels), fewrows_record stops the engine with its name like the other stubs (it is only reached with the research switch STRATA_PF_FEWROWS set). No shared source is touched. --- metal/src/engine/stubs_prompt_f16.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 metal/src/engine/stubs_prompt_f16.cpp diff --git a/metal/src/engine/stubs_prompt_f16.cpp b/metal/src/engine/stubs_prompt_f16.cpp new file mode 100644 index 0000000000..a0b057cf84 --- /dev/null +++ b/metal/src/engine/stubs_prompt_f16.cpp @@ -0,0 +1,23 @@ +// metal/src/engine/stubs_prompt_f16.cpp - two entry points of the CUDA / HIP prompt path that the Metal engine does not implement: +// the F16 request of the fused expert kernels and the few-row expert plan record. Prefill::run_impl (src/prefill/prefill.cpp) calls +// them but does not run on Metal (the prompt chunks are metal/src/engine/window.cpp, see stubs_df2.cpp); they exist so the shared host +// files link. +// fused::want_dm_f16 asks the fused kernels to write the down rows as FP16 (gfx11): this build has no fused kernels, nothing to ask. +// fewrows_record STRATA_PF_FEWROWS (research switch, off): the plan record of a few-row expert, written by a CUDA kernel; +// stops the engine with its name, like stubs.cpp, if it is ever reached. + +#include + +#include "strata/prefill/kernels.hpp" +#include "strata/prefill/moe_fused_iq.hpp" + +namespace strata::metal_engine { void missing(const char* name); } + +namespace strata::prefill { +void fewrows_record(void*, const void*, int, int, void*) { + strata::metal_engine::missing("strata::prefill::fewrows_record"); +} +namespace fused { +void want_dm_f16(bool) {} +} // namespace fused +} // namespace strata::prefill