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.
55 lines
3.3 KiB
C++
55 lines
3.3 KiB
C++
// plain_floor_rule.hpp: the long-prompt floor of the plain pack by card class and share state. No GPU, no model.
|
|
// Classes: plain pack (build without MMQ, non-native pack) or not; discrete CUDA card (answered, not integrated) or integrated / not asked / HIP; share armed (limit 3,072 or 1,024) or not; switch.
|
|
#include <cstdint>
|
|
#include <cstdio>
|
|
#include <initializer_list>
|
|
|
|
#include "strata/prefill/plain_floor_rule.hpp"
|
|
|
|
using strata::prefill::floor_with_share;
|
|
using strata::prefill::kPlainDiscreteFloor;
|
|
using strata::prefill::plain_floor_off;
|
|
using strata::prefill::plain_takes_discrete_floor;
|
|
|
|
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() {
|
|
constexpr int64_t kFused = 64; // stream_floor_rule.hpp kFusedOnlyFloor, the plain pack's default floor
|
|
constexpr int64_t kDefault = 1024; // kStreamFloorDefault
|
|
// the way back: only "0"
|
|
CHECK(!plain_floor_off(nullptr));
|
|
CHECK(!plain_floor_off(""));
|
|
CHECK(!plain_floor_off("00"));
|
|
CHECK(!plain_floor_off("1"));
|
|
CHECK(!plain_floor_off("off"));
|
|
CHECK(plain_floor_off("0"));
|
|
// class: only (plain pack) x (discrete CUDA card) x (switch not "0") takes the discrete floor
|
|
for (const char* env : {(const char*) nullptr, "", "1", "x"}) {
|
|
CHECK(plain_takes_discrete_floor(true, true, env));
|
|
CHECK(!plain_takes_discrete_floor(true, false, env)); // integrated / not asked yet / HIP: unchanged
|
|
CHECK(!plain_takes_discrete_floor(false, true, env)); // a native pack or a build with MMQ: unchanged
|
|
CHECK(!plain_takes_discrete_floor(false, false, env));
|
|
}
|
|
for (const bool plain : {false, true})
|
|
for (const bool disc : {false, true}) CHECK(!plain_takes_discrete_floor(plain, disc, "0")); // the way back, every class
|
|
// the answer: the plain pack on a discrete card, share armed (3,072 / 1,024) or not, takes the discrete floor
|
|
CHECK(floor_with_share(true, 3072, kFused) == kPlainDiscreteFloor);
|
|
CHECK(floor_with_share(true, 1024, kFused) == kPlainDiscreteFloor);
|
|
CHECK(floor_with_share(true, 0, kFused) == kPlainDiscreteFloor);
|
|
CHECK(kPlainDiscreteFloor == 1536); // the measured constant (RTX 5070); above the default floor and the plain pack's 64, below the share's limit
|
|
CHECK(kPlainDiscreteFloor > kDefault && kPlainDiscreteFloor > kFused && kPlainDiscreteFloor < 3072);
|
|
// a default floor above the constant is never lowered
|
|
CHECK(floor_with_share(true, 0, 4096) == 4096);
|
|
CHECK(floor_with_share(true, 3072, 4096) == 4096);
|
|
// every other class keeps the old answer: the share's limit when armed, else the default floor
|
|
CHECK(floor_with_share(false, 3072, kFused) == 3072); // integrated GPU / unknown card / HIP, plain pack, share armed
|
|
CHECK(floor_with_share(false, 1024, kFused) == 1024);
|
|
CHECK(floor_with_share(false, 0, kFused) == kFused); // integrated GPU, plain pack, no share: 64 stays
|
|
CHECK(floor_with_share(false, 3072, kDefault) == 3072); // native pack, share armed
|
|
CHECK(floor_with_share(false, 0, kDefault) == kDefault); // native pack, no share
|
|
CHECK(floor_with_share(false, -1, kDefault) == kDefault); // no share (negative = not armed)
|
|
if (failed == 0) std::printf("plain_floor_rule_test: ok\n");
|
|
return failed == 0 ? 0 : 1;
|
|
}
|