okami.mom/strata

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

Niko1221Merge f-0216-strix2 into f-0216-all51548e553

main
1.5 KiB30 linesraw
1// src/prefill/moe_f16_kq.hpp - gfx11: the K-quant prompt experts on the F16 matrix cores (moe_f16_kq.cu; the switch,
2// STRATA_PF_F16=1 with STRATA_PF_FUSED_KQ=1, is moe_f16_common.cuh's).
3// Internal to moe_fused_iq.cu, which owns the native experts' tables and launches.
4#pragma once
5
6#include <cstdint>
7
8#include <cuda_runtime.h>
9
10#include "strata/prefill/moe_fused.hpp"
11#include "strata/prefill/moe_fused_iq.hpp"
12
13namespace strata::prefill::fused::f16kq {
14
15/// The gate/up type has a kernel here (and this build has gfx11 device code).
16bool covers(int gu_type);
17
18/// Gate/up, SwiGLU and H for experts [b.e0, b.e1): the same tiles, activations and H as native_w11_kernel<WT, true>.
19/// `ts`, `tiles`, `off` are fused::group's tables (at most `work_bound` tiles); `n` the layer's routed rows over
20/// `n_expert` experts; `act` the int8 activations (quantize_act_native); `out` H.
21void gate_up(const Batch& b, const NativeGeom& g, const int32_t* ts, const int2* tiles, const int32_t* off, int64_t n,
22             int n_expert, int64_t work_bound, const uint8_t* act, const int32_t* src, uint8_t* out, cudaStream_t s);
23
24/// The down type has a kernel here (Q5_1).
25bool covers_down(int d_type);
26/// Down for the same experts and tiles: H (int8, `h`) to the routed rows' FP32 outputs in `dm`.
27void down(const Batch& b, const NativeGeom& g, const int32_t* ts, const int2* tiles, const int32_t* off, int64_t n, int n_expert,
28          int64_t work_bound, const uint8_t* h, float* dm, cudaStream_t s, bool d16 = false);
29
30}  // namespace strata::prefill::fused::f16kq