Archived
unlimitedocr: prefill and decode performance work
- sam_attn: tile queries and hoist the relative-position dots; the tower drops from 0.44-2.09 s to 0.10-0.36 s per tile. - processor: split OCR patch/LUT staging across rows, then make both bicubic passes and the LUT append AVX2 (bit-exact, 1.15-1.38x host preprocessing). - tower: batch the DeepEncoder across every tile segment of an encode pass. Patch embed, the 12 SAM blocks, neck, the 24 CLIP blocks and the projector run once per batch of up to 8 tiles (4 at the 64 grid); sam_attn and attn_dense stay segment-independent through B+1 cu tables, and position tables are host-staged PERSIST planes. B == 1 emits the old graph. Fix the newline layout: the reference expands image_newline over every map row, while the copy read past the one-row vector; with a multi-tile batch that made the trailing cells live data and the decoder dropped the text at the right margin of every line. - attn: instantiate attn_paged_qrow at head_dim 128 (bf16 and fp8 caches) and read OCR's q slice of the fused q|k|v plane in place, keeping the dense cast as the fallback when the library does not serve the qrow row. - tests: h128 attention emulator cases, a batched-tower arch test, an AVX2 bit-identity test, and a 15 s arch_test CPU budget for the image. Measured through the router at 256 tokens: 8-page TTFT 4157 -> 1327 ms, 640 page 608 -> 284 ms, 8 concurrent pages 17.6 -> 4.26 s wall; decode unchanged at ~344 tok/s. Parse gate 0.9901 text / 1 px on the deployed image.
This commit is contained in:
1 parent
8bcf695db9
commit
912c57cb21
14 files changed
+1026
-398
No files matched your search
+5
-3
@@ -235,9 +235,11 @@ int Engine::run_encodes() {
|
||||
it.pixels.shrink_to_fit();
|
||||
if (dump_dir && *dump_dir) dump(it, ".bf16", it.embd.data(), it.embd.size());
|
||||
}
|
||||
RAD_DEBUG("encoder: %zu item(s) encoded in %.1f ms", items.size(),
|
||||
std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - t0)
|
||||
.count());
|
||||
const double ms = std::chrono::duration<double, std::milli>(
|
||||
std::chrono::steady_clock::now() - t0).count();
|
||||
if (std::getenv("RADIANCE_DEBUG_MM_TIME"))
|
||||
RAD_INFO("encoder: tower pass for %zu item(s) -> %.1f ms", items.size(), ms);
|
||||
RAD_DEBUG("encoder: %zu item(s) encoded in %.1f ms", items.size(), ms);
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user