okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
df44bcb71
main
1// src/prefill/moe_mmq_tab.hpp - STRATA_MMQ_DIRECT: declarations of the pointer-table MMQ (moe_mmq_tab.cuh). 2// moe_mmq.cu includes only this header, so the tab kernels are instantiated once, in the per-type TUs that CMake 3// generates from mmq_tab_instance.cu.in (STRATA_MMQ_TAB on), never implicitly in moe_mmq.cu. 4#pragma once 5 6#include "mmq.cuh" 7 8namespace strata::prefill::mmq { 9 10/// Expert z's weight matrix starts at p[z] (z < the launch's nchannels <= 16). 11struct mmq_x_tab { 12const char * p [16 ]; 13}; 14 15/// llama.cpp's mul_mat_q_case<T> for fallback=false, with the per-expert base address from `tab` instead of 16/// x + z * stride_channel_x. false (nothing launched) when the rows are not a multiple of 128. 17template < ggml_type T > 18bool mul_mat_q_tab_case (ggml_backend_cuda_context & ctx ,const mmq_args & a ,const mmq_x_tab & tab ,cudaStream_t s ); 19 20extern template bool mul_mat_q_tab_case < GGML_TYPE_Q2_0 > (ggml_backend_cuda_context & ,const mmq_args & ,const mmq_x_tab & ,cudaStream_t ); 21extern template bool mul_mat_q_tab_case < GGML_TYPE_IQ2_XXS > (ggml_backend_cuda_context & ,const mmq_args & ,const mmq_x_tab & ,cudaStream_t ); 22extern template bool mul_mat_q_tab_case < GGML_TYPE_IQ2_XS > (ggml_backend_cuda_context & ,const mmq_args & ,const mmq_x_tab & ,cudaStream_t ); 23extern template bool mul_mat_q_tab_case < GGML_TYPE_IQ2_S > (ggml_backend_cuda_context & ,const mmq_args & ,const mmq_x_tab & ,cudaStream_t ); 24extern template bool mul_mat_q_tab_case < GGML_TYPE_IQ3_XXS > (ggml_backend_cuda_context & ,const mmq_args & ,const mmq_x_tab & ,cudaStream_t ); 25extern template bool mul_mat_q_tab_case < GGML_TYPE_IQ3_S > (ggml_backend_cuda_context & ,const mmq_args & ,const mmq_x_tab & ,cudaStream_t ); 26extern template bool mul_mat_q_tab_case < GGML_TYPE_IQ4_NL > (ggml_backend_cuda_context & ,const mmq_args & ,const mmq_x_tab & ,cudaStream_t ); 27extern template bool mul_mat_q_tab_case < GGML_TYPE_IQ4_XS > (ggml_backend_cuda_context & ,const mmq_args & ,const mmq_x_tab & ,cudaStream_t ); 28extern template bool mul_mat_q_tab_case < GGML_TYPE_Q8_0 > (ggml_backend_cuda_context & ,const mmq_args & ,const mmq_x_tab & ,cudaStream_t ); 29 30}// namespace strata::prefill::mmq