okami.mom/strata

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

Niko1221Merge f-p4-fb-gate 0d6308de6 into f-p4-int (Tesla P100: the FP16 prompt path with few-row experts is the default instead of MMQ)d59dc3e6f

main
1.9 KiB51 linesraw
1// The Tesla P100 prompt-expert default (gp100_prompt_default.hpp): the FP16 path only with STRATA_PREFILL_MMQ unset, every visible card
2// cc 6.0, and nothing in force that needs MMQ (STRATA_MMQ_WS=1, STRATA_EXPERT_NIBBLE=1, --peer-device).  Header-only, no GPU.
3#include <cstdio>
4#include <initializer_list>
5
6#include "strata/prefill/gp100_prompt_default.hpp"
7
8using strata::prefill::Gp100PromptInputs;
9using strata::prefill::gp100_fp16_rule;
10
11static int failed = 0;
12#define CHECK(x) do { if (!(x)) { std::fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #x); ++failed; } } while (0)
13
14int main() {
15    Gp100PromptInputs p100;
16    p100.all_cc60 = true;
17    CHECK(gp100_fp16_rule(p100));   // one or more P100s, nothing set: the FP16 path
18
19    Gp100PromptInputs other = p100;
20    other.all_cc60 = false;         // any card that is not cc 6.0 (a P40, a V100, a mixed rig): MMQ as before
21    CHECK(!gp100_fp16_rule(other));
22
23    for (const char* v : {"1", "0", "2", ""}) {   // an explicit setting keeps its old meaning; the rule stands aside
24        Gp100PromptInputs e = p100;
25        e.env = v;
26        CHECK(!gp100_fp16_rule(e));
27    }
28
29    Gp100PromptInputs ws = p100;
30    ws.mmq_ws = true;
31    CHECK(!gp100_fp16_rule(ws));
32
33    Gp100PromptInputs nib = p100;
34    nib.nibble = true;
35    CHECK(!gp100_fp16_rule(nib));
36
37    Gp100PromptInputs peer = p100;  // two P100s with --peer-device keep MMQ and the prompt peer
38    peer.peer_device = true;
39    CHECK(!gp100_fp16_rule(peer));
40
41    CHECK(!strata::prefill::peer_device_requested().load());   // off until generate.cpp sees --peer-device
42    strata::prefill::peer_device_requested().store(true);
43    CHECK(strata::prefill::peer_device_requested().load());
44
45    if (failed) {
46        std::fprintf(stderr, "gp100_prompt_default_test: %d failed\n", failed);
47        return 1;
48    }
49    std::printf("gp100_prompt_default_test: ok\n");
50    return 0;
51}