Merge perf-PR group batch (f-145-pp-batch)
This commit is contained in:
commit
e8b1edbcb7
25 files changed
+2105
-130
No files matched your search
@@ -2352,8 +2352,15 @@ bool Prefill::run_impl(const int64_t* tokens, int64_t n, int64_t pos0, std::stri
|
||||
std::future<bool> ple_next; // declared after everything it reads: an early return waits for it
|
||||
int ple_buf = 0;
|
||||
|
||||
if (hand_in_ == nullptr) stopped_at_ = -1;
|
||||
for (int64_t c0 = 0; c0 < n; c0 += m.T) {
|
||||
if (should_stop && should_stop()) { err = "cancelled"; return false; }
|
||||
// the first stage: end the run before this chunk (every chunk before it is handed on; the caller's drain
|
||||
// waits for the later stages to read them)
|
||||
if (c0 > 0 && hand_in_ == nullptr && stop_at_chunk && stop_at_chunk()) {
|
||||
stopped_at_ = c0;
|
||||
break;
|
||||
}
|
||||
if (std::getenv("STRATA_TRACE")) { std::fprintf(stderr, "strata trace: prompt chunk %lld of %lld\n", (long long) c0, (long long) n); std::fflush(stderr); }
|
||||
const int64_t T = std::min(m.T, n - c0), p0 = pos0 + c0;
|
||||
core::progress_at("reading the prompt (batched): preparing the chunk from token", p0); // #251
|
||||
@@ -4642,6 +4649,22 @@ bool Prefill::drain_pipeline(std::string& err) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool Prefill::reserve_uploads(int64_t T) {
|
||||
bool ok = true;
|
||||
if (impl_ != nullptr && T > 0) {
|
||||
Impl& m = *impl_;
|
||||
const core::OnDevice on_device(m.device); // (the ring is the device's that is current at its first use)
|
||||
// a text chunk's largest pageable uploads through the ring: the routing tables (and their ids down, T x K
|
||||
// each); the PLE rows when they could not be pinned (T x N). A picture's rows are not covered.
|
||||
size_t bytes = (size_t) (T * K) * sizeof(int32_t);
|
||||
if (!m.ple_pageable[0].empty() || !m.ple_pageable[1].empty())
|
||||
bytes = std::max(bytes, (size_t) (T * N) * sizeof(float));
|
||||
ok = m.up_ring.reserve(bytes);
|
||||
}
|
||||
if (next_ != nullptr) ok = next_->reserve_uploads(T) && ok;
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool Prefill::run(const int64_t* tokens, int64_t n, int64_t pos0, std::string& err) {
|
||||
#if defined(STRATA_GPU_METAL)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user