okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-i8-mmqoff-int 70ef6d873 into f-p4-int (the build without llama.cpp's MMQ prompt kernels takes its own kernels by default)6572fbaf1

main
2.2 KiB35 linesraw
1// metal/src/engine/stubs_i8.cpp - the entry points of the CUDA / HIP int8 prompt-expert kernel (src/kernels/cuda/i8_expert.cuh) that the shared
2// prompt path (Prefill::run_impl, src/prefill/prefill.cpp) calls.  Prefill::run_impl does not run on Metal (the prompt chunks are
3// metal/src/engine/window.cpp, see stubs_df2.cpp); these exist so the shared host files link.
4//   native_expert_i8_supported / _prompt / _by_default     false: this build has no such kernel
5//   native_expert_i8_few_rows_limit                        0: no few-rows route without the kernels
6//   native_expert_i8_floor_gated                           false: no P100 class rule without the kernels
7//   native_expert_i8_scratch_bytes                         the size formula of iq_kernels.cu (keep in step)
8//   native_expert_i8                                       stops the engine with its name, like stubs.cpp, if it is ever reached
9
10#include <cstddef>
11#include <cstdint>
12
13#include "strata/kernels/iq_kernels.hpp"
14
15namespace strata::metal_engine { void missing(const char* name); }
16
17namespace strata::kernels {
18bool native_expert_i8_supported(const NativeExpertLayout&) noexcept { return false; }
19bool native_expert_i8_prompt(const NativeExpertLayout&, int64_t) noexcept { return false; }
20bool native_expert_i8_by_default() noexcept { return false; }
21void native_expert_i8_set_mmq_free() noexcept {}
22int native_expert_i8_few_rows_limit() noexcept { return 0; }
23bool native_expert_i8_floor_gated() noexcept { return false; }
24size_t native_expert_i8_scratch_bytes(int64_t cap_entries, int64_t cap_groups, int64_t n_ff) {
25    const size_t hqb = ((size_t) cap_entries * (size_t) (n_ff / 32) * 36 + 255) & ~(size_t) 255;   // 36 bytes: sizeof(block_q8_1)
26    return hqb + (size_t) (cap_groups + 1) * sizeof(int32_t);
27}
28void native_expert_i8_quantize(const float*, int64_t, int64_t, void*, void*) {
29    strata::metal_engine::missing("strata::kernels::native_expert_i8_quantize");
30}
31void native_expert_i8(const NativeExpertLayout&, const unsigned long long*, const int32_t*, const int32_t*, const int32_t*, const int32_t*, int64_t, int64_t,
32                      const void*, void*, float*, void*) {
33    strata::metal_engine::missing("strata::kernels::native_expert_i8");
34}
35}  // namespace strata::kernels