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

Method commit_flip

engine/sycl/src/core/expert_source.cpp:2343–2366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2341}
2342
2343int64_t FileExpertSource::commit_flip() {
2344 int64_t n = 0;
2345 for (const Exchange& x : staged_) {
2346 const uint8_t* src = override_[x.out];
2347 if (exchange_storage_.active()) { // STRATA_EXCHANGE_ROTATE: the same ownership transfer as commit_exchanges
2348 if (!exchange_storage_.commit(x.in, x.out, (size_t) x.q, src, (size_t) x.bytes)) {
2349 std::fprintf(stderr, "FileExpertSource: invalid exchange rotation commit; refusing corrupt residency\n");
2350 std::abort();
2351 }
2352 ++n;
2353 override_[x.out] = nullptr;
2354 continue;
2355 }
2356 const uint64_t at = complement_offsets_[x.in];
2357 // the same test as commit_copies: an exchange whose bytes were copied is the one that flips
2358 if (src != nullptr && at != kNoComplement && at <= complement_bytes_ && x.bytes <= complement_bytes_ - at &&
2359 complement_host_ != nullptr && detail::exchange_cache_complement(complement_offsets_, x.in, x.out))
2360 ++n;
2361 override_[x.out] = nullptr;
2362 }
2363 staged_.clear();
2364 exchanges_ += n;
2365 return n;
2366}
2367
2368const uint8_t* FileExpertSource::resident_blob(int64_t layer, int64_t expert) const {
2369 if (!complement_ready_ || complement_host_ == nullptr || layer < 0 || expert < 0 || layer >= n_layers_ ||

Callers 1

mainFunction · 0.45

Calls 5

abortFunction · 0.50
activeMethod · 0.45
commitMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected