okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
6ca60e9a0
main
1// metal/src/engine/stubs_0145.cpp - the kernel-library entry points the 0.1.45 sources added and Metal does not implement yet. 2// Same job and shape as stubs.cpp (each stops the engine with its name, metal/src/engine/missing.cpp). Written from the linker's 3// undefined-symbol report because tools/gen_stubs.py reads an older clang AST dump format than macOS 27's clang prints. 4// A symbol that gets a Metal implementation is deleted from here. fused_gr_persist_init / fused_gr_read_persist / f16_range_read / 5// gemm_f16_range_read are opt-in features of the HIP and Turing builds: off on Metal, so they answer "nothing to do" instead of stopping the engine. 6 7#include "strata/kernels/bf16_bits.hpp" 8#include "strata/kernels/bf16_gemv.hpp" 9#include "strata/kernels/cvec.hpp" 10#include "strata/kernels/dequant_bf16.hpp" 11#include "strata/kernels/dequant_s2.hpp" 12#include "strata/kernels/elementwise.hpp" 13#include "strata/kernels/f16_bits.hpp" 14#include "strata/kernels/fused_gdn.hpp" 15#include "strata/kernels/fused_gr.hpp" 16#include "strata/kernels/gdn.hpp" 17#include "strata/kernels/gfx_arch.hpp" 18#include "strata/kernels/gr.hpp" 19#include "strata/kernels/iq_kernels.hpp" 20#include "strata/kernels/kv_q4.hpp" 21#include "strata/kernels/kv_q8.hpp" 22#include "strata/kernels/kv_stream.hpp" 23#include "strata/kernels/mrope.hpp" 24#include "strata/kernels/native_flash_attn.hpp" 25#include "strata/kernels/native_gdn.hpp" 26#include "strata/kernels/native_gdn_preprocess.hpp" 27#include "strata/kernels/native_gr_norm.hpp" 28#include "strata/kernels/native_gr_postops.hpp" 29#include "strata/kernels/native_mmvq.hpp" 30#include "strata/kernels/native_moe.hpp" 31#include "strata/kernels/native_ple_postops.hpp" 32#include "strata/kernels/native_qsa.hpp" 33#include "strata/kernels/native_qsa_indexer.hpp" 34#include "strata/kernels/native_qsa_score.hpp" 35#include "strata/kernels/native_rope.hpp" 36#include "strata/kernels/native_router.hpp" 37#include "strata/kernels/ngram.hpp" 38#include "strata/kernels/pdl.hpp" 39#include "strata/kernels/ple.hpp" 40#include "strata/kernels/qsa.hpp" 41#include "strata/kernels/qsa_decode_attn.hpp" 42#include "strata/kernels/qsa_prompt_attn.hpp" 43#include "strata/kernels/qsa_select.hpp" 44#include "strata/kernels/quantize_act.hpp" 45#include "strata/kernels/rope.hpp" 46#include "strata/kernels/rope_scaling.hpp" 47#include "strata/kernels/route_prior.hpp" 48#include "strata/kernels/router_top10.hpp" 49#include "strata/kernels/s2_expert_grouped.hpp" 50#include "strata/kernels/s2_gemv.hpp" 51#include "strata/kernels/s2_gemv_q8.hpp" 52#include "strata/kernels/s_gemv.hpp" 53#include "strata/kernels/sampler.hpp" 54#include "strata/kernels/shared_expert.hpp" 55#include "strata/kernels/verify_kernels.hpp" 56#include "strata/kernels/cpu/expert.hpp" 57#include "strata/kernels/cpu/expert_layout.hpp" 58#include "strata/kernels/cpu/iq_avx1.hpp" 59#include "strata/kernels/cpu/iq_avx2.hpp" 60#include "strata/kernels/cpu/iq_avx512.hpp" 61#include "strata/kernels/cpu/kq_avx1.hpp" 62#include "strata/kernels/cpu/kq_avx2.hpp" 63#include "strata/kernels/cpu/native_expert.hpp" 64#include "strata/kernels/cpu/pool.hpp" 65#include "strata/prefill/gemm.hpp" 66#include "strata/prefill/kernels.hpp" 67#include "strata/prefill/moe_fused.hpp" 68#include "strata/prefill/moe_fused_iq.hpp" 69#include "strata/prefill/moe_mmq.hpp" 70#include "strata/prefill/prefill.hpp" 71#include "strata/prefill/share_rules.hpp" 72#include "strata/prefill/xmx_moe.hpp" 73#include "strata/core/arch_defaults.hpp" 74#include "strata/core/batch_rows.hpp" 75#include "strata/core/conversation_buffer.hpp" 76#include "strata/core/conversation_cache.hpp" 77#include "strata/core/conversation_file.hpp" 78#include "strata/core/conversation_memory.hpp" 79#include "strata/core/conversation_snapshot.hpp" 80#include "strata/core/coupled_draft.hpp" 81#include "strata/core/device.hpp" 82#include "strata/core/dma_batch.hpp" 83#include "strata/core/emulate.hpp" 84#include "strata/core/exchange_storage.hpp" 85#include "strata/core/expert_cache.hpp" 86#include "strata/core/expert_source.hpp" 87#include "strata/core/foresight_swap.hpp" 88#include "strata/core/graph.hpp" 89#include "strata/core/hit_hook.hpp" 90#include "strata/core/layer.hpp" 91#include "strata/core/layout.hpp" 92#include "strata/core/logit_bias.hpp" 93#include "strata/core/mtp.hpp" 94#include "strata/core/native_dense.hpp" 95#include "strata/core/native_head.hpp" 96#include "strata/core/on_device.hpp" 97#include "strata/core/peer_experts.hpp" 98#include "strata/core/pinned.hpp" 99#include "strata/core/pinned_ring.hpp" 100#include "strata/core/progress.hpp" 101#include "strata/core/remote_expert_opt.hpp" 102#include "strata/core/remote_experts.hpp" 103#include "strata/core/session.hpp" 104#include "strata/core/session_save_reclaim.hpp" 105#include "strata/core/spec_prob.hpp" 106#include "strata/core/verify.hpp" 107#include "strata/core/vmm.hpp" 108#include "strata/core/weights.hpp" 109#include "strata/platform/aux_cpus.hpp" 110#include "strata/platform/direct_file.hpp" 111#include "strata/platform/host_limits.hpp" 112#include "strata/platform/memory.hpp" 113#include "strata/ngram/ple_reader.hpp" 114#include "strata/spec/controller.hpp" 115#include "strata/spec/draft_policy.hpp" 116#include "strata/spec/draft_source.hpp" 117#include "strata/spec/suffix_drafter.hpp" 118#include <type_traits> 119 120#include <type_traits> 121 122namespace strata::metal_engine {void missing (const char * name ); } 123 124namespace strata::kernels {void copy_rows_from_mapped_after (unsigned int const * p0 ,unsigned int p1 ,float * p2 ,float const * p3 ,long long p4 ,long long p5 ,int const * p6 ,int const * p7 ,void * p8 ) { strata::metal_engine::missing ("strata::kernels::copy_rows_from_mapped_after" ); } } 125namespace strata::kernels::cpu {void iq256_gu_rows_exact_one (int p0 ,unsigned char const * p1 ,unsigned long p2 ,unsigned long p3 ,int p4 ,void const * p5 ,float * p6 ,int p7 ,int p8 ) { strata::metal_engine::missing ("strata::kernels::cpu::iq256_gu_rows_exact_one" ); } } 126namespace strata::kernels {void fused_gr_persist_init () { } } 127namespace strata::kernels {bool fused_gr_read_persist (strata::kernels::FusedGrArgs const * p0 ,int p1 ,void * p2 ) {return false; } } 128namespace strata::kernels {void gdn_step_norm_groups (strata::kernels::GdnGroups const & p0 ,float const * p1 ,int p2 ,float const * p3 ,float const * p4 ,float const * p5 ,float const * p6 ,float p7 ,float * p8 ,int p9 ,int p10 ,bool p11 ,void * p12 ) { strata::metal_engine::missing ("strata::kernels::gdn_step_norm_groups" ); } } 129namespace strata::kernels {void handoff_publish (float * p0 ,float const * p1 ,long long p2 ,float const * p3 ,long long p4 ,float const * p5 ,long long p6 ,unsigned int * p7 ,unsigned int * p8 ,void * p9 ,unsigned int const * p10 ) { strata::metal_engine::missing ("strata::kernels::handoff_publish" ); } } 130namespace strata::kernels {void hc_q8_to_bf16 (void const * p0 ,float const * p1 ,unsigned short * p2 ,long long p3 ,void * p4 ) { strata::metal_engine::missing ("strata::kernels::hc_q8_to_bf16" ); } } 131namespace strata::kernels {void native_quantize_q8_1_il (float const * p0 ,void * p1 ,void * p2 ,int p3 ,int p4 ,void * p5 ) { strata::metal_engine::missing ("strata::kernels::native_quantize_q8_1_il" ); } } 132namespace strata::kernels {void qsa_block_scores_rows (strata::kernels::QsaScoreRows const & p0 ,float const * p1 ,int const * p2 ,long long p3 ,long long p4 , strata::kernels::QsaShapes const & p5 ,float * p6 ,void * p7 ) { strata::metal_engine::missing ("strata::kernels::qsa_block_scores_rows" ); } } 133namespace strata::kernels {void qsa_decode_attn_batch_rows (float const * p0 , strata::kernels::QsaAttnPoolsRows const & p1 ,int const * p2 ,int const * p3 ,long long p4 , strata::kernels::QsaShapes const & p5 ,float * p6 ,float * p7 ,long long p8 ,void * p9 ) { strata::metal_engine::missing ("strata::kernels::qsa_decode_attn_batch_rows" ); } } 134namespace strata::kernels {bool qsa_decode_attn_split (float const * p0 , strata::kernels::QsaAttnPools const & p1 ,int const * p2 ,int const * p3 ,long long p4 , strata::kernels::QsaShapes const & p5 ,float * p6 ,unsigned long long p7 ,float * p8 ,long long p9 ,void * p10 ) { strata::metal_engine::missing ("strata::kernels::qsa_decode_attn_split" );return {}; } } 135namespace strata::kernels {void res_patch (int * p0 ,int const * p1 ,int p2 ,void * p3 ) { strata::metal_engine::missing ("strata::kernels::res_patch" ); } } 136namespace strata::kernels {void wait_copy_i32_from_mapped (unsigned int const * p0 ,unsigned int p1 ,int * p2 ,int const * p3 ,long long p4 ,void * p5 ) { strata::metal_engine::missing ("strata::kernels::wait_copy_i32_from_mapped" ); } } 137namespace strata::kernels {void wait_flag_ge_stamped (unsigned int const * p0 ,unsigned int p1 ,unsigned long long * p2 ,unsigned long long * p3 ,void * p4 ) { strata::metal_engine::missing ("strata::kernels::wait_flag_ge_stamped" ); } } 138namespace strata::kernels {void wait_handoff (unsigned int const * p0 ,unsigned int p1 ,unsigned int * p2 ,unsigned long long p3 ,void * p4 ) { strata::metal_engine::missing ("strata::kernels::wait_handoff" ); } } 139namespace strata::prefill {void moe_scatter_add (float const * p0 ,int const * p1 ,int const * p2 ,int const * p3 ,float const * p4 ,long long p5 ,float * p6 ,void * p7 ) { strata::metal_engine::missing ("strata::prefill::moe_scatter_add" ); } } 140namespace strata::prefill {void moe_shared_init (float const * p0 ,float const * p1 ,float * p2 ,long long p3 ,void * p4 ) { strata::metal_engine::missing ("strata::prefill::moe_shared_init" ); } } 141namespace strata::prefill {bool f16_range_read (float & p0 ,unsigned long long & p1 ,bool p2 ) {return false; } } 142namespace strata::prefill {bool gemm_f16_range_read (float * p0 ,unsigned long long * p1 ,bool p2 ) {return false; } } 143namespace strata::prefill {void gr_norm (float const * p0 ,float const * p1 ,float p2 ,float * p3 ,unsigned short * p4 ,long long p5 ,void * p6 ,unsigned short * p7 ,bool p8 ) { strata::metal_engine::missing ("strata::prefill::gr_norm" ); } } 144namespace strata::prefill {void gr_norm_rs (float const * p0 ,float const * p1 ,float p2 ,float * p3 ,unsigned short * p4 ,long long p5 ,void * p6 ,unsigned short * p7 ,long long p8 ,bool p9 ) { strata::metal_engine::missing ("strata::prefill::gr_norm_rs" ); } } 145namespace strata::prefill {void gr_write_cvec_norm_rs (float * p0 ,float const * p1 ,float const * p2 ,long long p3 ,float const * p4 ,float const * p5 ,int const * p6 ,int p7 ,float const * p8 ,float p9 ,float * p10 ,unsigned short * p11 ,long long p12 ,void * p13 ,unsigned short * p14 ,long long p15 ,bool p16 ) { strata::metal_engine::missing ("strata::prefill::gr_write_cvec_norm_rs" ); } } 146namespace strata::prefill {void gr_write_norm_rs (float * p0 ,float const * p1 ,float const * p2 ,long long p3 ,float const * p4 ,float p5 ,float * p6 ,unsigned short * p7 ,long long p8 ,void * p9 ,unsigned short * p10 ,long long p11 ,bool p12 ) { strata::metal_engine::missing ("strata::prefill::gr_write_norm_rs" ); } } 147// pf_wmma (STRATA_PF_WMMA=1, Volta prompt experts) is CUDA only; the prefill code of 148/149 references it, so the Metal link needs the entry point. Off on Metal: "not launched". 148namespace strata::kernels {bool gemm_iq_f16_grouped (int p0 ,void const * p1 ,unsigned long p2 ,int p3 ,int p4 ,void const * p5 ,int p6 ,int const * p7 ,int p8 ,int p9 ,float * p10 ,int p11 ,void * p12 ) {return false; } } 149// STRATA_Q8_SM60 (Pascal GP100, opt-in): a no-op on Metal; NativeHead::load()/unload() call these for a Q8_0 head, so they must exist and answer "nothing packed". 150namespace strata::kernels {bool native_q8_0_sm60_pack (void const * p0 ,int p1 ,int p2 ,char const * p3 ) {return false; } } 151namespace strata::kernels {void native_q8_0_sm60_release (void const * p0 ) { } } 152// the MTP drafter's STRATA_MTP_Q8_SM60 packing (mtp.cpp): nothing packed on Metal 153namespace strata::kernels {bool native_q8_0_sm60_pack_quiet (void const * p0 ,int p1 ,int p2 ,char const * p3 ) {return false; } } 154namespace strata::kernels {bool native_q8_0_sm60_pack_in_place (void * p0 ,int p1 ,int p2 ,char const * p3 ) {return false; } } 155// STRATA_SELECT_LONG (verify.cpp's long-context decode select): CUDA only; never reached on Metal (no scratch asked for) 156namespace strata::kernels {long long qsa_topk_multi_scratch_ints (long long p0 ) {return 0 ; } } 157namespace strata::kernels {void qsa_block_topk_long (float const * p0 ,int const * p1 ,long long p2 ,long long p3 ,long long p4 , strata::kernels::QsaShapes const & p5 ,int * p6 ,void * p7 ,long long p8 ,int * p9 ) { strata::metal_engine::missing ("strata::kernels::qsa_block_topk_long" ); } } 158namespace strata::kernels {void qsa_block_scores_long (float const * p0 ,float const * p1 ,float const * p2 ,int const * p3 ,long long p4 ,long long p5 , strata::kernels::QsaShapes const & p6 ,float * p7 ,void * p8 ,long long p9 ) { strata::metal_engine::missing ("strata::kernels::qsa_block_scores_long" ); } } 159// only reached with pf_wmma (off on Metal) 160namespace strata::prefill {void swiglu_split_f16 (float const * p0 ,unsigned short * p1 ,long long p2 ,int p3 ,bool p4 ,void * p5 ) { } } 161// STRATA_PLE_COMPACT (opt-in, CUDA / HIP prompt path): prefill.cpp references it; the Metal prompt runs through its window and never reaches it. 162namespace strata::kernels {void ple_iq4nl_dequant (const uint8_t * p0 ,int64_t p1 ,float * p2 ,void * p3 ) { strata::metal_engine::missing ("strata::kernels::ple_iq4nl_dequant" ); } } 163// STRATA_DEQUANT_SIDE (opt-in, CUDA only): off on Metal; the prompt path takes no second scratch and set_dequant_side(nullptr) keeps the serial form. 164namespace strata::prefill {bool gemm_dequant_side () {return false; } } 165auto strata::prefill::Gemm ::set_dequant_side (uint16_t * p0 , std::string & p1 )-> bool {if (p0 == nullptr )return true; strata::metal_engine::missing ("strata::prefill::Gemm::set_dequant_side" );return false; }