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

Function feed

engine/src/core/dflash2_ring_test.cpp:46–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44int32_t token_of(uint32_t lineage, int64_t pos) { return (int32_t) (1000 + ((uint32_t) pos * 7919u + lineage * 104729u) % 50000u); }
45
46bool feed(Dflash2Drafter& d, float* dev, uint32_t lineage, int64_t from, int64_t to, std::string& err) {
47 std::vector<float> h((size_t) 256 * kTap);
48 for (int64_t p0 = from; p0 < to; p0 += 256) {
49 const int64_t n = std::min<int64_t>(256, to - p0);
50 for (int64_t r = 0; r < n; ++r)
51 for (int i = 0; i < kTap; ++i) h[(size_t) r * kTap + (size_t) i] = tap_value(lineage, p0 + r, i);
52 if (cudaMemcpy(dev, h.data(), (size_t) n * kTap * 4, cudaMemcpyHostToDevice) != cudaSuccess) { err = "upload"; return false; }
53 if (!d.context(dev, n, p0, err)) return false;
54 std::vector<int32_t> tk((size_t) n);
55 for (int64_t r = 0; r < n; ++r) tk[(size_t) r] = token_of(lineage, p0 + r);
56 d.note_rows(tk.data(), n, p0);
57 }
58 return true;
59}
60
61std::vector<int32_t> ids_of(uint32_t lineage, int64_t n) {
62 std::vector<int32_t> v((size_t) n);

Callers 3

mainFunction · 0.70
mainFunction · 0.50
mainFunction · 0.50

Calls 6

tap_valueFunction · 0.85
token_ofFunction · 0.85
cudaMemcpyFunction · 0.50
dataMethod · 0.45
contextMethod · 0.45
note_rowsMethod · 0.45

Tested by

no test coverage detected