okami.mom/strata

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

Niko1221Metal keeps --lookup-max-t off by default: its windows hold 8 rows and a 12-row lookup window ended the first Qwen serve request (metal window: window size out of range); the default rule is a header with a testfea8a3e63

main
1.7 KiB40 linesraw
1// (asserts stay on in a Release build: the test is its own check)
2#undef NDEBUG
3#include "strata/core/lookup_default.hpp"
4#include <cassert>
5#include <iostream>
6
7using strata::core::LookupDefaultIn;
8using strata::core::default_lookup_max_t;
9
10int main() {
11    LookupDefaultIn cuda;   // the 8-row CUDA serve on one card, the case the owner decided
12    cuda.narrow_window = cuda.serve = cuda.suffix_draft = cuda.spec_at_least_2 = true;
13    assert(default_lookup_max_t(cuda) == 12);
14
15    LookupDefaultIn metal = cuda;   // Metal also has 8-row windows, but no 12-row window: the option stays off
16    metal.metal_build = true;
17    assert(default_lookup_max_t(metal) == 0);
18
19    LookupDefaultIn wide = cuda;    // HIP (16 rows) keeps its old windows
20    wide.narrow_window = false;
21    assert(default_lookup_max_t(wide) == 0);
22
23    // every other condition turns it off on its own
24    bool LookupDefaultIn::*off_when_true[] = {&LookupDefaultIn::env_off, &LookupDefaultIn::multi_gpu, &LookupDefaultIn::layer_split,
25                                              &LookupDefaultIn::batch, &LookupDefaultIn::dflash2, &LookupDefaultIn::lookup_chain};
26    for (auto m : off_when_true) {
27        LookupDefaultIn x = cuda;
28        x.*m = true;
29        assert(default_lookup_max_t(x) == 0);
30    }
31    bool LookupDefaultIn::*off_when_false[] = {&LookupDefaultIn::narrow_window, &LookupDefaultIn::serve, &LookupDefaultIn::suffix_draft,
32                                               &LookupDefaultIn::spec_at_least_2};
33    for (auto m : off_when_false) {
34        LookupDefaultIn x = cuda;
35        x.*m = false;
36        assert(default_lookup_max_t(x) == 0);
37    }
38    std::cout << "lookup_default_test: ok\n";
39    return 0;
40}