okami.mom/strata

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

Niko1221Merge f-q4-metal (ed1f58d27): the Mac (Metal) engine follows the compiled geometry (q4_lite/q4_mid/q4_big kernel parity 40/40, gate 2 like CUDA), plus the PLE row-buffer fix in src/program/generate.cpp (sized by the compiled hidden size, not 2560; it overran 24 KB at hidden 4096 and crashed Metal serve); default build unchanged (CUDA SASS 3573/3573 and 160/160 host objects, HIP gfx1201/gfx1151 string offsets only, SYCL 129/129 objects and 22/22 checksums, Metal per-token functions identical, UD-Q4_K_XL 10/10 tokens, CUDA IQ3_S 26/26 tokens) (Qwen4 prep)7f46672a4

main
2.3 KiB34 linesraw
1// metal/tests/geo_check.cpp - what engine/geo.h makes of the geometry this build is compiled for.
2//
3// A default build (no -DSTRATA_GEOMETRY / -DSTRATA_GEOMETRY_FILE) must give every host constant of the engine the number it had as a literal
4// before engine/geo.h existed (Qwen3.8-Flash-Next): the static_asserts below are that list, checked by the compiler.  For any build the program
5// prints the constants and the kernel prelude, so a run documents the shape a binary is built for.
6#include "engine/geo.h"
7
8#include <cstdio>
9
10namespace g = strata_metal::geo;
11
12#if !__has_include("strata/core/geometry_selected.hpp")
13static_assert(g::N == 2560 && g::HC == 4 && g::LR == 320 && g::NFF == 640 && g::TOPK == 10 && g::NEXP == 512, "hidden, hc, hc_lr, expert width, top-k, experts");
14static_assert(g::NL == 48 && g::QI == 4 && g::NQSA == 12 && g::NGDN == 36, "layers");
15static_assert(g::SS == 128 && g::HK == 16 && g::HV == 48 && g::CONV == 10240 && g::ZV == 6144, "GDN");
16static_assert(g::QH == 24 && g::QKV == 2 && g::QD == 256 && g::IH == 4 && g::ID == 128 && g::BUD == 2051, "full attention");
17static_assert(g::QCHUNKS == 33 && g::QCHUNKS2 == 65 && g::QPREP == 33, "attention chunks and qsa_prep groups");
18static_assert(g::HCD == 10240 && g::QFULL == 12288 && g::QOUT == 6144 && g::KV == 512 && g::IQR == 512 && g::GDN_FUSED == 16480, "row sizes");
19#define DEFAULT_BUILD 1
20#else
21#define DEFAULT_BUILD 0
22#endif
23
24int main() {
25    std::printf("geo: %s build, geometry %s\n", DEFAULT_BUILD ? "default" : "selected", strata::core::kGeometryName);
26    std::printf("  hidden %d  hc %d  hc_lr %d  expert width %d  top-k %d  experts %d  layers %d (every %dth full attention: %d QSA, %d GDN)\n", g::N, g::HC, g::LR,
27                g::NFF, g::TOPK, g::NEXP, g::NL, g::QI, g::NQSA, g::NGDN);
28    std::printf("  GDN: key heads %d, value heads %d, state %d, conv channels %d, value dim %d, fused input rows %d\n", g::HK, g::HV, g::SS, g::CONV, g::ZV,
29                g::GDN_FUSED);
30    std::printf("  attention: %d query heads / %d kv heads x %d, indexer %d x %d, budget %d cells, %d chunks (%d of 32), qsa_prep groups %d\n", g::QH, g::QKV,
31                g::QD, g::IH, g::ID, g::BUD, g::QCHUNKS, g::QCHUNKS2, g::QPREP);
32    std::printf("  prelude:\n%s", g::prelude().empty() ? "  (empty: Flash-Next's own)\n" : g::prelude().c_str());
33    return 0;
34}