Source: https://github.com/Niko1221/Strata, commit 6f32ec070f23ced9f50e704d854d775da52591ab (engine 0.1.39, MIT). Every file is as upstream published it; later commits show exactly what this fork changes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
22 lines
1.2 KiB
C++
22 lines
1.2 KiB
C++
#pragma once
|
|
#include <cstdint>
|
|
|
|
namespace strata::kernels {
|
|
// Configure before constructing/capturing sessions. Existing captures keep their
|
|
// selected kernels; changing this flag does not rewrite an existing graph.
|
|
void native_moe_combine_set_enabled(bool enabled);
|
|
bool native_moe_combine_enabled();
|
|
|
|
// Pinned CUDA weighted-reduction contract for one token, k in [1, 15].
|
|
// The backend fuses k=2..15; k=1 is its ordinary multiply/contiguous/add path.
|
|
// parts: k contiguous F32 rows of n_embd; weights: k F32 values. The first
|
|
// product rounds to F32, following products accumulate with FMA in expert order,
|
|
// and optional shared is added once afterward. Shared is not router weighted.
|
|
// Requires a nonnull ordered stream and disjoint output. No allocation or sync.
|
|
void native_moe_combine(const float* parts, const float* weights, const float* shared,
|
|
float* output, int64_t n_embd, int64_t k, void* stream);
|
|
/// n_tok rows (parts [n,k,N], weights [n,k], shared/output [n,N]) in one launch, each as the single call.
|
|
void native_moe_combine_multi(const float* parts, const float* weights, const float* shared, float* output,
|
|
int64_t n_embd, int64_t k, int n_tok, void* stream);
|
|
}
|