okami.mom/strata

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

Niko1221Merge f-0213-defaults (a04860fad): DFlash2 per-device defaults - Strix Halo and Blackwell cc 12.0 cards with >= 48 GB draft window 6 -> 8 (all sets), conf 0.55 for IQ3_S only on that Blackwell class; end to end through the Terminal's flags, 3 interleaved rounds: Strix UD-Q4_K_XL x1.052 (output differs, deterministic; owner 11-08: ship as is), Strix UD-IQ4_XS-v31 x1.020 (identical), l620 IQ3_S x1.028 (identical); every other card unchangede3bd5cfde

main
2.0 KiB36 linesraw
1// src/core/draft_cap_test.cpp - the per-card window cap of --draft dflash2 (CPU only).
2#include "strata/core/draft_cap.hpp"
3
4#include <cstdio>
5
6using namespace strata::core;
7
8static int fails = 0;
9#define CHECK(c) do { if (!(c)) { std::fprintf(stderr, "FAIL %s:%d %s\n", __FILE__, __LINE__, #c); ++fails; } } while (0)
10
11static constexpr size_t GiB = (size_t) 1 << 30;
12
13int main() {
14    CHECK(dflash2_auto_cap(true, 0, 0, 0) == 8);               // Strix Halo (gfx1151)
15    CHECK(dflash2_auto_cap(false, 12, 0, 72 * GiB) == 8);      // Blackwell cc 12.0, RTX PRO 5000 72 GB
16    CHECK(dflash2_auto_cap(false, 12, 0, 96 * GiB) == 8);      // Blackwell cc 12.0, 96 GB
17    CHECK(dflash2_auto_cap(false, 12, 0, 48000000000ull) == 8);// exactly 48 GB
18    CHECK(dflash2_auto_cap(false, 12, 0, 48000000000ull - 1) == 6);
19    CHECK(dflash2_auto_cap(false, 12, 0, 51033931776ull) == 8);// a 48 GB card reports about 47.5 GiB
20    CHECK(dflash2_auto_cap(false, 12, 0, 32 * GiB) == 6);      // RTX 5090: cc 12.0 under 48 GB keeps 6
21    CHECK(dflash2_auto_cap(false, 12, 0, 12 * GiB) == 6);      // RTX 5070
22    CHECK(dflash2_auto_cap(false, 12, 0, 0) == 6);             // memory unknown keeps 6
23    CHECK(dflash2_auto_cap(false, 12, 1, 128 * GiB) == 6);     // DGX Spark (cc 12.1): unchanged whatever the memory it reports
24    CHECK(dflash2_auto_cap(false, 12, 1, 24 * GiB) == 6);
25    CHECK(dflash2_auto_cap(false, 8, 0, 80 * GiB) == 0);       // Ampere / Hopper: --spec as given
26    CHECK(dflash2_auto_cap(false, 8, 9, 48 * GiB) == 0);       // Ada
27    CHECK(dflash2_auto_cap(false, 0, 0, 0) == 0);              // another AMD card
28    CHECK(dflash2_big_blackwell(12, 0, 72 * GiB));
29    CHECK(!dflash2_big_blackwell(12, 1, 72 * GiB));
30    CHECK(!dflash2_big_blackwell(9, 0, 72 * GiB));
31    CHECK(dflash2_small_nvidia(true, (size_t) 12 << 30));
32    CHECK(!dflash2_small_nvidia(true, (size_t) 16 << 30));
33    CHECK(!dflash2_small_nvidia(false, (size_t) 8 << 30));
34    if (fails == 0) std::printf("draft_cap_test: ok\n");
35    return fails == 0 ? 0 : 1;
36}