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

Method Rig

engine/tests/core/split_lend_complement_test.cpp:95–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93 size_t blob = 0;
94
95 explicit Rig(const char* tag) {
96 std::string err;
97 require(strata::kernels::cpu::expert_layout_load(dir.path.string(), kLayers, kExperts, err), err);
98 blob = (size_t) strata::kernels::cpu::BLOB;
99 truth.resize((size_t) kLayers * kExperts);
100 {
101 std::ofstream out(dir.path / "experts.bin", std::ios::binary);
102 for (int64_t l = 0; l < kLayers; ++l)
103 for (int64_t e = 0; e < kExperts; ++e) {
104 std::vector<uint8_t>& t = truth[(size_t) l * kExperts + e];
105 t.resize(blob);
106 for (size_t i = 0; i < blob; ++i) t[i] = truth_byte(l, e, i);
107 out.write((const char*) t.data(), (std::streamsize) blob);
108 }
109 require((bool) out, std::string(tag) + ": fixture write failed");
110 }
111 require(src.open(dir.path.string(), kLayers, kExperts, err), err);
112 // kExperts slots each: every layer of the stage, and the tail the prompt path borrows
113 require(stage0.open(kExperts, kLayers, kExperts, blob, err), err);
114 require(stage1.open(kExperts, kLayers, kExperts, blob, err), err);
115 for (int64_t e = 0; e < kExperts; ++e) {
116 const int32_t s0 = stage0.admit(0, e);
117 require(s0 >= 0 && stage0.fill_slot_blocking(s0, truth[(size_t) e].data(), err), err);
118 const int32_t s1 = stage1.admit(1, e);
119 require(s1 >= 0 && stage1.fill_slot_blocking(s1, truth[(size_t) kExperts + e].data(), err), err);
120 }
121 }
122
123 // every expert of stage 1's cache, the way generate hands the later stages to pin_cache_complement
124 std::vector<std::pair<int32_t, int32_t>> stage1_pairs() const {

Callers

nothing calls this directly

Calls 11

truth_byteFunction · 0.85
requireFunction · 0.70
expert_layout_loadFunction · 0.50
stringFunction · 0.50
stringMethod · 0.45
resizeMethod · 0.45
writeMethod · 0.45
dataMethod · 0.45
openMethod · 0.45
admitMethod · 0.45
fill_slot_blockingMethod · 0.45

Tested by

no test coverage detected