okami.mom/strata

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

Niko1221Merge f-028-arcb65-pipe: pipelined B-series (two Battlemage stages) is the default18200cffa

main
2.7 KiB40 linesraw
1// The default of --pipeline-windows (strata::pipeline_auto_on), no GPU needed: on only for a layer split of exactly two
2// Battlemage cards with --serve and the MTP drafter.
3#include <cstdio>
4#include "strata/pipeline_auto.hpp"
5
6using strata::PipelineAutoInputs;
7using strata::pipeline_auto_on;
8static int bad = 0;
9#define CHECK(cond, what) do { if (!(cond)) { std::printf("FAIL: %s\n", what); ++bad; } } while (0)
10
11static PipelineAutoInputs two_b65() {
12    PipelineAutoInputs in;
13    in.serve = true; in.multi_gpu = true; in.later_stages = 1; in.has_mtp = true; in.spec = 4;
14    in.first_is_battlemage = true; in.later_is_battlemage = true;
15    return in;
16}
17
18int main() {
19    CHECK(pipeline_auto_on(two_b65()), "two Battlemage cards, serve, MTP -> on");
20    { auto in = two_b65(); in.spec = 2; CHECK(pipeline_auto_on(in), "spec 2 -> on"); }
21    { auto in = two_b65(); in.spec = 1; CHECK(!pipeline_auto_on(in), "spec 1 (no draft window) -> off"); }
22    { auto in = two_b65(); in.spec = 0; CHECK(!pipeline_auto_on(in), "no --spec -> off"); }
23    { auto in = two_b65(); in.has_mtp = false; CHECK(!pipeline_auto_on(in), "no MTP drafter -> off"); }
24    { auto in = two_b65(); in.serve = false; CHECK(!pipeline_auto_on(in), "no --serve -> off"); }
25    { auto in = two_b65(); in.multi_gpu = false; CHECK(!pipeline_auto_on(in), "single card -> off"); }
26    { auto in = two_b65(); in.split_same = true; CHECK(!pipeline_auto_on(in), "both stages on one GPU -> off"); }
27    { auto in = two_b65(); in.later_stages = 0; CHECK(!pipeline_auto_on(in), "no later stage -> off"); }
28    { auto in = two_b65(); in.later_stages = 2; CHECK(!pipeline_auto_on(in), "three stages (the pipeline runs exactly two) -> off"); }
29    { auto in = two_b65(); in.later_stages = 3; CHECK(!pipeline_auto_on(in), "four stages -> off"); }
30    { auto in = two_b65(); in.first_is_battlemage = false; CHECK(!pipeline_auto_on(in), "first card not Battlemage (A-series) -> off"); }
31    { auto in = two_b65(); in.later_is_battlemage = false; CHECK(!pipeline_auto_on(in), "second card not Battlemage -> off"); }
32    { auto in = two_b65(); in.first_is_battlemage = false; in.later_is_battlemage = false;
33      CHECK(!pipeline_auto_on(in), "two A-series cards -> off"); }
34    { auto in = two_b65(); in.auto_off = true; CHECK(!pipeline_auto_on(in), "STRATA_PIPELINE_AUTO=0 -> off"); }
35    { auto in = two_b65(); in.batch = 4; CHECK(!pipeline_auto_on(in), "--batch slots -> off"); }
36    { auto in = two_b65(); in.peer_device = true; CHECK(!pipeline_auto_on(in), "--peer-device -> off"); }
37    { auto in = two_b65(); in.helper_caches = true; CHECK(!pipeline_auto_on(in), "helper caches -> off"); }
38    if (bad == 0) std::printf("pipeline_auto_test: all OK\n");
39    return bad == 0 ? 0 : 1;
40}