mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-04 07:18:50 +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.
37 lines
1.7 KiB
C++
37 lines
1.7 KiB
C++
// fp16_rows_rule (include/strata/prefill/fp16_rows_rule.hpp): the tokens the FP16 expert path's buffers are sized for. No GPU, no model.
|
|
#include <cstdio>
|
|
|
|
#include "strata/prefill/fp16_rows_rule.hpp"
|
|
|
|
using strata::prefill::fp16_buf_tokens;
|
|
|
|
static int failed = 0;
|
|
#define CHECK(x) do { if (!(x)) { std::fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #x); ++failed; } } while (0)
|
|
|
|
int main() {
|
|
const int64_t floor = 1024;
|
|
// a fused layout: the tail below the floor only (the same size moe_bufs gives GU / H / Hq), at the floor and above, and a chunk below the floor keeps its own size
|
|
CHECK(fp16_buf_tokens(8192, true, floor) == 1023);
|
|
CHECK(fp16_buf_tokens(2048, true, floor) == 1023);
|
|
CHECK(fp16_buf_tokens(1025, true, floor) == 1023);
|
|
CHECK(fp16_buf_tokens(1024, true, floor) == 1023);
|
|
CHECK(fp16_buf_tokens(1023, true, floor) == 1023);
|
|
CHECK(fp16_buf_tokens(512, true, floor) == 512);
|
|
CHECK(fp16_buf_tokens(1, true, floor) == 1);
|
|
// a different floor (STRATA_PREFILL_STREAM_MIN, the CPU share's limit)
|
|
CHECK(fp16_buf_tokens(8192, true, 2048) == 2047);
|
|
CHECK(fp16_buf_tokens(2000, true, 2048) == 2000);
|
|
// no fused layout (the Tesla P100: FP16 from the floor up; STRATA_PF_FUSED=0; a card the fused kernels do not cover): the full chunk at every size
|
|
CHECK(fp16_buf_tokens(8192, false, floor) == 8192);
|
|
CHECK(fp16_buf_tokens(2048, false, floor) == 2048);
|
|
CHECK(fp16_buf_tokens(1024, false, floor) == 1024);
|
|
CHECK(fp16_buf_tokens(1023, false, floor) == 1023);
|
|
CHECK(fp16_buf_tokens(64, false, floor) == 64);
|
|
if (failed) {
|
|
std::fprintf(stderr, "fp16_rows_rule_test: %d check(s) failed\n", failed);
|
|
return 1;
|
|
}
|
|
std::printf("fp16_rows_rule_test: OK\n");
|
|
return 0;
|
|
}
|