MCPcopy Create free account
hub / github.com/Niko1221/Strata / main

Function main

engine/src/program/batch_groups_test.cpp:33–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31} // namespace
32
33int main() {
34 std::printf("batch_groups_test\n");
35 check(bg::auto_groups(0, 4) == 1, "auto: no layer split, one group");
36 check(bg::auto_groups(1, 2) == 2 && bg::auto_groups(1, 4) == 2 && bg::auto_groups(1, 3) == 1,
37 "auto: two GPUs, 2 groups when the slots divide by 2");
38 check(bg::auto_groups(3, 8) == 4 && bg::auto_groups(3, 6) == 3 && bg::auto_groups(3, 2) == 2,
39 "auto: at most one group per GPU, and a divisor of the slots");
40
41 { // the 0.1.41 default
42 const auto r = bg::resolve(in(2, 1));
43 check(r.groups == 2 && r.from_auto && r.serial == bg::Serial::None, "layer split, --batch 2, nothing given: 2 groups");
44 }
45 {
46 const auto r = bg::resolve(in(1, 1));
47 check(r.groups == 1 && !r.from_auto, "--batch 1: no default");
48 }
49 {
50 const auto r = bg::resolve(in(2, 0));
51 check(r.groups == 1 && !r.from_auto, "no layer split: one group");
52 }
53
54 { // the production shape: parallel 2 on a 2-GPU split with --batch-mtp
55 bg::Input i = in(2, 1);
56 i.batch_mtp = true;
57 auto r = bg::resolve(i);
58 check(r.groups == 2 && r.from_auto && r.serial == bg::Serial::None && r.mtp_dropped,
59 "--batch-mtp, nothing given: the pipeline wins, --batch-mtp is dropped");
60 i.mtp_serial = true;
61 r = bg::resolve(i);
62 check(r.groups == 1 && r.from_auto && r.serial == bg::Serial::BatchMtp && r.would_be == 2 && !r.mtp_dropped,
63 "STRATA_BATCH_MTP_SERIAL: one group, because of --batch-mtp");
64 check(bg::serial_what(r.serial)[0] == '-', "the reason names the feature");
65 }
66 { // STRATA_PIPED_MTP: the pipelined groups draft too, with any number of slots per group
67 bg::Input i = in(4, 3);
68 i.batch_mtp = true;
69 i.mtp_piped = true;
70 auto r = bg::resolve(i);
71 check(r.groups == 4 && r.mtp_piped && !r.mtp_dropped && r.serial == bg::Serial::None,
72 "STRATA_PIPED_MTP, 4 slots on 4 GPUs: 4 groups of 1 slot, and the drafts stay");
73 i.batch = 8; // two slots per group: the group's window carries both slots' rows, each with its own drafts
74 r = bg::resolve(i);
75 check(r.groups == 4 && r.mtp_piped && !r.mtp_dropped && r.serial == bg::Serial::None,
76 "STRATA_PIPED_MTP, 8 slots on 4 GPUs: 4 groups of 2 slots, and the drafts stay");
77 i.batch = 4;
78 i.mtp_serial = true; // asked for the serial windows: those win
79 r = bg::resolve(i);
80 check(r.groups == 1 && !r.mtp_piped && r.serial == bg::Serial::BatchMtp,
81 "STRATA_PIPED_MTP with STRATA_BATCH_MTP_SERIAL: one serial group");
82 i.mtp_serial = false;
83 i.batch_mtp = false;
84 r = bg::resolve(i);
85 check(r.groups == 4 && !r.mtp_piped && !r.mtp_dropped, "STRATA_PIPED_MTP without --batch-mtp: nothing to draft");
86 i.batch_mtp = true;
87 i.set = true;
88 i.given = 1; // one group: the serial windows, where --batch-mtp's own drafts run
89 r = bg::resolve(i);
90 check(r.groups == 1 && !r.mtp_piped && !r.mtp_dropped, "STRATA_PIPED_MTP, --batch-groups 1: the serial path, --batch-mtp runs there");

Callers

nothing calls this directly

Calls 13

auto_groupsFunction · 0.85
serial_whatFunction · 0.85
nv_serial_wantedFunction · 0.85
pipe_adapt_everyFunction · 0.85
pipe_adapt_dueFunction · 0.85
pipe_adapt_autoFunction · 0.85
pipe_adapt_nextFunction · 0.85
slot_read_wide_onFunction · 0.85
slot_read_ahead_onFunction · 0.85
checkFunction · 0.70
inFunction · 0.70
resolveFunction · 0.50

Tested by

no test coverage detected