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

Method commit_exchanges

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

Source from the content-addressed store, hash-verified

2303}
2304
2305int64_t FileExpertSource::commit_exchanges() {
2306 int64_t n = 0;
2307 for (const Exchange& x : staged_) {
2308 const uint8_t* src = override_[x.out];
2309 if (exchange_storage_.active()) {
2310 if (!exchange_storage_.commit(x.in, x.out, (size_t)x.q, src, (size_t)x.bytes)) {
2311 // Admitting the GPU swap after a failed RAM ownership update would lose an expert.
2312 std::fprintf(stderr, "FileExpertSource: invalid exchange rotation commit; refusing corrupt residency\n");
2313 std::abort();
2314 }
2315 ++n;
2316 override_[x.out] = nullptr;
2317 continue;
2318 }
2319 const uint64_t at = complement_offsets_[x.in];
2320 if (src != nullptr && at != kNoComplement && at <= complement_bytes_ && x.bytes <= complement_bytes_ - at &&
2321 complement_host_ != nullptr) {
2322 std::memcpy((uint8_t*) complement_host_ + (size_t) at, src, (size_t) x.bytes);
2323 if (detail::exchange_cache_complement(complement_offsets_, x.in, x.out)) ++n;
2324 }
2325 override_[x.out] = nullptr;
2326 }
2327 staged_.clear();
2328 exchanges_ += n;
2329 return n;
2330}
2331
2332void FileExpertSource::commit_copies() {
2333 if (exchange_storage_.active()) return; // STRATA_EXCHANGE_ROTATE: ownership moves in commit_flip, nothing to copy

Callers 1

mainFunction · 0.45

Calls 6

memcpyFunction · 0.85
abortFunction · 0.50
activeMethod · 0.45
commitMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected