mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-06 16:29:04 +00:00
Made by tools/layout/move_0216.py (the commit before this one) on db8e0be9c, the final code head of 0.2.16:
- 75 git mv (renames, so `git log --follow` and blame keep working; packaging/acceptance_matrix.md shows as delete + add because its links
changed too) and 3 removals: SETUP.bat, UPDATE.bat and update.sh (setup.py --update pulls the code now);
- 1,425 path edits in 307 files: root-relative paths in CI, Docker, .gitignore and the release scripts; Markdown links; Python and
Node joins from a root that moved with its folder; explicit edits for code that computes a root or names a moved path; tables of
repository paths inside tests.
engine/ holds what CMake builds (src, include, cmake, metal, sycl, spark, third_party, the C++ tests and benches). app/ is the desktop
app and its host (was apps/). terminal/ is the Terminal in the layout of the installed one (strata.py, setup.py, strata_cli,
strata_control, serve, bin, data, ref, crates, the Python tools and tests). docs/ has the documentation, docs/lang/ the translated
READMEs, docs/history and docs/bench-results. tools/ has the repository's own checks, packaging, docker, research and nix.
tests/core/test_tqp_ref.py is a pytest file and stays with the Python tests (terminal/tests/core/).
AGENTS.md, README.md, LICENSE, setup.sh and START-HERE.bat stay at the root.
No behaviour change: the same command lines, the same sources. For this head a replay of the script gave the same numbers and the path
scan (tools/layout/checks/path_scan.py) reports no hit; the suites and the builds run on this commit next.
38 lines
2.9 KiB
C++
38 lines
2.9 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.
|
|
/// 143-amdk: native_moe_combine_multi with moe_hit_add folded in: for the rows listed in dst[0, *count) (entry index = token * k + expert,
|
|
/// relative to `parts` and `hits`) the expert's part is parts + hits (the add moe_hit_add made in place), then the combine as before.
|
|
/// Only the k = 10 vec4 case; `native_moe_combine_hits_supported` says whether a call may use it.
|
|
bool native_moe_combine_hits_supported(const float* parts, const float* shared, const float* output, int64_t n_embd, int64_t k, int n_tok);
|
|
void native_moe_combine_multi_hits_added(const float* parts, const float* hits, const int32_t* dst, const int32_t* count,
|
|
const float* weights, const float* shared, float* output, int64_t n_embd, int64_t k,
|
|
int n_tok, void* stream);
|
|
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);
|
|
/// STRATA_VERIFY_RESIDENT: the same, reading every part as `0.0f + hit[i]` - bitwise what a zeroed part row plus
|
|
/// moe_hit_add (parts += hit) gave, without the zero fill and the add launch.
|
|
void native_moe_combine_multi_hits(const float* hits, const float* weights, const float* shared, float* output,
|
|
int64_t n_embd, int64_t k, int n_tok, void* stream);
|
|
/// S26 STRATA_LFUSE: the same with `shared` unscaled and shared_gate[t] the shared expert's raw gate logit: the
|
|
/// row is scaled by sigmoid(shared_gate[t]) here, bitwise what shared_expert_multi's sigmoid + scale gave.
|
|
void native_moe_combine_multi_hits_gated(const float* hits, const float* weights, const float* shared,
|
|
const float* shared_gate, float* output, int64_t n_embd, int64_t k, int n_tok,
|
|
void* stream);
|
|
}
|