[PR #1704] [CLOSED] perf: experimental active-layer expert cache for fresh prefill #3620

Closed
opened 2026-11-07 15:29:37 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1704
Author: @CC-David-CC
Created: 10/9/2026
Status: ❌ Closed

Base: main ← Head: perf/prefill-active-layer-cache


📝 Commits (6)

  • 76ce987 prefill: add opt-in bounded active-layer expert cache
  • ec8eecd test: validate layer cache on P4, RX 5500 XT and RTX 3070
  • eb393ba Merge current main while preserving experimental validation paths
  • 035ea72 docs: answer requested 20K P4 exactness and speed check
  • 7c55456 docs: correct rounded P4 time-reduction percentage
  • f2fedfd Merge Strata v0.1.43 into perf/prefill-active-layer-cache

📊 Changes

23 files changed (+47646 additions, -12 deletions)

View changed files

➕ docs/PREFILL_LAYER_CACHE_EXPERIMENTAL.md (+86 -0)
➕ docs/measurements/p4-layer-cache/README.md (+115 -0)
➕ docs/measurements/p4-layer-cache/cross-gpu/README.md (+116 -0)
➕ docs/measurements/p4-layer-cache/cross-gpu/a5500.json (+919 -0)
➕ docs/measurements/p4-layer-cache/cross-gpu/g3070.json (+1424 -0)
➕ docs/measurements/p4-layer-cache/cross-gpu/r730.json (+870 -0)
➕ docs/measurements/p4-layer-cache/cross-gpu/summary.json (+311 -0)
➕ docs/measurements/p4-layer-cache/cross-gpu/sycl-build.json (+25 -0)
➕ docs/measurements/p4-layer-cache/current-main-20k/README.md (+66 -0)
➕ docs/measurements/p4-layer-cache/current-main-20k/candidate-off-vs-on.json (+21284 -0)
➕ docs/measurements/p4-layer-cache/current-main-20k/main-vs-enabled.json (+21260 -0)
➕ docs/measurements/p4-layer-cache/current-main-20k/provenance.json (+7 -0)
➕ docs/measurements/p4-layer-cache/initial.json (+226 -0)
➕ docs/measurements/p4-layer-cache/off-config.json (+78 -0)
➕ docs/measurements/p4-layer-cache/off.log (+50 -0)
➕ docs/measurements/p4-layer-cache/on-config.json (+78 -0)
➕ docs/measurements/p4-layer-cache/on.log (+69 -0)
➕ docs/measurements/p4-layer-cache/steady-state.json (+191 -0)
➕ docs/measurements/p4-layer-cache/summary.json (+156 -0)
📝 include/strata/prefill/prefill.hpp (+9 -0)

...and 3 more files

📄 Description

Adds an opt-in active-layer expert cache for fresh, single-GPU native-MMQ text prefill. It walks a bounded window layer by layer, using temporary expert VRAM and pinned residual buffers while preserving chronological attention/recurrent state. Enable STRATA_PREFILL_LAYER_CACHE=1; the ordinary path remains the default. Unsupported formats/device layouts and failed initial allocations decline the experiment. Cancellation after processing starts fails the request and drains rather than restarting from partially advanced state.

Refreshed onto current main (61b3fb5d), preserving the active-layer guard and current CPU-share RAM fallback. This update answers the requested 20K P4 follow-up.

Fresh single-P4 / ISTA IQ3_XXS / INT8 KV / MTP-width-2 comparison, three 20K repeats per arm:

Comparison Main/off median prefill Enabled median prefill Time reduction
Current main / candidate enabled 199.9948s 182.6055s 8.695%
Candidate off / candidate enabled 201.2198s 182.7688s 9.170%

All twelve measured requests returned identical full 64-token streams, with zero reused prompt tokens. Candidate-off matches main. Both arms used auto-RAM staging, automatic chunk sizing and CPU prefill sharing disabled; this is not a comparison against setup defaults with sharing enabled. STOP during a 20K prompt cancelled and a following request completed on the same engine.

The 2048-token target resolved to two 1280-token chunks. The first enabled request logged 480.6 MiB temporary expert capacity and 100.0 MiB pinned residual rows, plus expert staging buffers. These are allocation sizes, not sampled peaks. One synthetic workload, fixed off-then-on ordering, warm filesystem caches and three observations per arm do not establish a general speedup. Historical cross-GPU slowdowns remain documented; this stays experimental.

CUDA sm61, HIP gfx1012 and standalone SYCL builds passed; fresh HIP/SYCL 20K inference was not tested. Usage and limits. Fresh results, exact source/binary identities, full IDs, timings and reproduction.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1704 **Author:** [@CC-David-CC](https://github.com/CC-David-CC) **Created:** 10/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `perf/prefill-active-layer-cache` --- ### 📝 Commits (6) - [`76ce987`](https://github.com/Niko1221/Strata/commit/76ce987ae5af9f08c4e6ce59edabb8099714a06d) prefill: add opt-in bounded active-layer expert cache - [`ec8eecd`](https://github.com/Niko1221/Strata/commit/ec8eecdab4b6306d0cb8430fd1c99dbb49d3da33) test: validate layer cache on P4, RX 5500 XT and RTX 3070 - [`eb393ba`](https://github.com/Niko1221/Strata/commit/eb393ba64cc89e9ed4da108b4fd72718228414eb) Merge current main while preserving experimental validation paths - [`035ea72`](https://github.com/Niko1221/Strata/commit/035ea720917fb08da9e772e92c22e7b4f28a418e) docs: answer requested 20K P4 exactness and speed check - [`7c55456`](https://github.com/Niko1221/Strata/commit/7c554563d4bd7f4576fd40ead97b25e71f5d45ef) docs: correct rounded P4 time-reduction percentage - [`f2fedfd`](https://github.com/Niko1221/Strata/commit/f2fedfda067e81d0aac762b0816b9f67d59c67cc) Merge Strata v0.1.43 into perf/prefill-active-layer-cache ### 📊 Changes **23 files changed** (+47646 additions, -12 deletions) <details> <summary>View changed files</summary> ➕ `docs/PREFILL_LAYER_CACHE_EXPERIMENTAL.md` (+86 -0) ➕ `docs/measurements/p4-layer-cache/README.md` (+115 -0) ➕ `docs/measurements/p4-layer-cache/cross-gpu/README.md` (+116 -0) ➕ `docs/measurements/p4-layer-cache/cross-gpu/a5500.json` (+919 -0) ➕ `docs/measurements/p4-layer-cache/cross-gpu/g3070.json` (+1424 -0) ➕ `docs/measurements/p4-layer-cache/cross-gpu/r730.json` (+870 -0) ➕ `docs/measurements/p4-layer-cache/cross-gpu/summary.json` (+311 -0) ➕ `docs/measurements/p4-layer-cache/cross-gpu/sycl-build.json` (+25 -0) ➕ `docs/measurements/p4-layer-cache/current-main-20k/README.md` (+66 -0) ➕ `docs/measurements/p4-layer-cache/current-main-20k/candidate-off-vs-on.json` (+21284 -0) ➕ `docs/measurements/p4-layer-cache/current-main-20k/main-vs-enabled.json` (+21260 -0) ➕ `docs/measurements/p4-layer-cache/current-main-20k/provenance.json` (+7 -0) ➕ `docs/measurements/p4-layer-cache/initial.json` (+226 -0) ➕ `docs/measurements/p4-layer-cache/off-config.json` (+78 -0) ➕ `docs/measurements/p4-layer-cache/off.log` (+50 -0) ➕ `docs/measurements/p4-layer-cache/on-config.json` (+78 -0) ➕ `docs/measurements/p4-layer-cache/on.log` (+69 -0) ➕ `docs/measurements/p4-layer-cache/steady-state.json` (+191 -0) ➕ `docs/measurements/p4-layer-cache/summary.json` (+156 -0) 📝 `include/strata/prefill/prefill.hpp` (+9 -0) _...and 3 more files_ </details> ### 📄 Description Adds an opt-in active-layer expert cache for fresh, single-GPU native-MMQ text prefill. It walks a bounded window layer by layer, using temporary expert VRAM and pinned residual buffers while preserving chronological attention/recurrent state. Enable `STRATA_PREFILL_LAYER_CACHE=1`; the ordinary path remains the default. Unsupported formats/device layouts and failed initial allocations decline the experiment. Cancellation after processing starts fails the request and drains rather than restarting from partially advanced state. Refreshed onto current main (`61b3fb5d`), preserving the active-layer guard and current CPU-share RAM fallback. This update answers the [requested 20K P4 follow-up](https://github.com/Niko1221/Strata/pull/1704#issuecomment-6099698652). Fresh single-P4 / ISTA IQ3_XXS / INT8 KV / MTP-width-2 comparison, three 20K repeats per arm: | Comparison | Main/off median prefill | Enabled median prefill | Time reduction | |---|---:|---:|---:| | Current main / candidate enabled | 199.9948s | 182.6055s | 8.695% | | Candidate off / candidate enabled | 201.2198s | 182.7688s | 9.170% | All twelve measured requests returned identical full 64-token streams, with zero reused prompt tokens. Candidate-off matches main. Both arms used auto-RAM staging, automatic chunk sizing and CPU prefill sharing disabled; this is not a comparison against setup defaults with sharing enabled. STOP during a 20K prompt cancelled and a following request completed on the same engine. The 2048-token target resolved to two 1280-token chunks. The first enabled request logged 480.6 MiB temporary expert capacity and 100.0 MiB pinned residual rows, plus expert staging buffers. These are allocation sizes, not sampled peaks. One synthetic workload, fixed off-then-on ordering, warm filesystem caches and three observations per arm do not establish a general speedup. Historical cross-GPU slowdowns remain documented; this stays experimental. CUDA sm61, HIP gfx1012 and standalone SYCL builds passed; fresh HIP/SYCL 20K inference was not tested. [Usage and limits](https://github.com/CC-David-CC/Strata-a5500/blob/7c554563d4bd7f4576fd40ead97b25e71f5d45ef/docs/PREFILL_LAYER_CACHE_EXPERIMENTAL.md). [Fresh results, exact source/binary identities, full IDs, timings and reproduction](https://github.com/CC-David-CC/Strata-a5500/blob/7c554563d4bd7f4576fd40ead97b25e71f5d45ef/docs/measurements/p4-layer-cache/current-main-20k/README.md). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:29:37 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3620
No description provided.