mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 23:08:36 +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.
43 lines
2.4 KiB
C++
43 lines
2.4 KiB
C++
// #5012: the qwen35moe engine's INFO line for the Monitor's "Expert cache: <expert_slots> / <experts>" (strata/qwen35/expert_info.hpp).
|
|
// Before #5012 that engine printed no expert figures at all, and no engine printed the total (`experts`): the Monitor showed nothing,
|
|
// or "N / 0". No GPU, no model: fake layers with the two fields place_experts leaves (n_slots, stride).
|
|
#include "strata/qwen35/expert_info.hpp"
|
|
|
|
#include <cstdio>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace {
|
|
int checks = 0, failures = 0;
|
|
void check(bool ok, const char* what) {
|
|
++checks;
|
|
if (!ok) { ++failures; std::fprintf(stderr, "FAIL: %s\n", what); }
|
|
}
|
|
struct FakeLayer { int n_slots; size_t stride; };
|
|
} // namespace
|
|
|
|
int main() {
|
|
using strata::qwen35::expert_info;
|
|
using strata::qwen35::expert_info_line;
|
|
// Qwen3.6-35B-A3B: 40 layers of 256 routed experts; an expert of the Q8_0 set is ~3.2 MB
|
|
const size_t stride = 3342336;
|
|
std::vector<FakeLayer> all(40, FakeLayer{256, stride});
|
|
auto a = expert_info(all, 256);
|
|
check(a.slots == 10240 && a.experts == 10240, "every expert fits: slots = experts = 40 x 256");
|
|
check(a.cache_mib == (long long) ((10240ull * stride) >> 20), "their VRAM in MiB");
|
|
check(expert_info_line(a) == "INFO expert_slots=10240 experts=10240 expert_cache_mib=" + std::to_string(a.cache_mib) + "\n",
|
|
"the INFO line: expert_slots, experts (the total) and expert_cache_mib");
|
|
// hybrid: 64 of 256 per layer in VRAM (the slot count), the rest on the CPU pool
|
|
std::vector<FakeLayer> hyb(40, FakeLayer{64, stride});
|
|
auto h = expert_info(hyb, 256);
|
|
check(h.slots == 2560 && h.experts == 10240, "hybrid: 2560 of 10240 resident, the total unchanged");
|
|
check(expert_info_line(h).find(" experts=10240 ") != std::string::npos, "the total is in the line, so the Monitor shows a share");
|
|
// the line carries no vram_elastic key (the server takes that key to mean the VRAM command exists; this engine has none)
|
|
check(expert_info_line(h).find("vram_elastic") == std::string::npos, "no vram_elastic key");
|
|
check(expert_info_line(h).rfind("INFO ", 0) == 0 && expert_info_line(h).back() == '\n', "an INFO line, one line");
|
|
// no layers: nothing to report (the engine prints the line only when experts > 0)
|
|
check(expert_info(std::vector<FakeLayer>{}, 256).experts == 0, "no layers: experts 0");
|
|
std::printf("q36_expert_info_test: %d checks, %d failed\n", checks, failures);
|
|
return failures == 0 ? 0 : 1;
|
|
}
|