hot path (not for main before the identity run): the prefill GEMM loan and the profile drain are generics, not trait objects (engine dyn 9 -> 3)
PrefillLoans<'a, 'ctx, G: GdnGemm> and the GDN and MoE prefill stage functions take the loaned GEMM by type; prefill_profile::span takes the Context itself (it was the only implementer of Drain). The same calls in the same order; static instead of dynamic dispatch. Not run on a GPU: needs the laptop two-binary identity gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
8eca35e64e
commit
2b75a037d2
@@ -4,7 +4,7 @@
|
||||
"oversize": {},
|
||||
"source": {
|
||||
"dyn-trait:leleka-cuda-driver": 45,
|
||||
"dyn-trait:leleka-engine-qwen35-cuda": 9,
|
||||
"dyn-trait:leleka-engine-qwen35-cuda": 3,
|
||||
"env-read:strata-control": 3,
|
||||
"glob-super-import:leleka-cuda-driver": 2,
|
||||
"instant-now:leleka-cuda-driver": 25,
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ impl<'ctx> OriginalPromptExecutor<'ctx> {
|
||||
if cancelled() {
|
||||
return Err(Error::Unsupported(Stage::Session));
|
||||
}
|
||||
let _span = prof::span(PStage::FinishPreview, Some(self.context as &dyn prof::Drain));
|
||||
let _span = prof::span(PStage::FinishPreview, Some(self.context));
|
||||
rows.finish_after_preview(work.weights.binding, work.weights.dense, work.txn, &final_row)
|
||||
.map_err(|error| trace_error("finish_after_preview", error))?;
|
||||
Ok((final_row, sample, draft_kv))
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ impl<'ctx> OriginalPromptExecutor<'ctx> {
|
||||
draft: ChunkDraft<'_, 'ctx>,
|
||||
cancelled: &mut impl FnMut() -> bool,
|
||||
) -> Result<OriginalDraftKvPending> {
|
||||
let draft_span = prof::span(PStage::DraftKv, Some(self.context as &dyn prof::Drain));
|
||||
let draft_span = prof::span(PStage::DraftKv, Some(self.context));
|
||||
let draft_kv = self.draft_kv_in_ring(inputs, rows, draft, cancelled)?;
|
||||
trace_step("forward: draft kv ok");
|
||||
drop(draft_span);
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ impl<'ctx> OriginalPromptExecutor<'ctx> {
|
||||
};
|
||||
// the chunk's expert stream (if any) ended with the last MoE layer; never carried past the layers
|
||||
work.moe.end_prompt_stream()?;
|
||||
let final_span = prof::span(PStage::Final, Some(self.context as &dyn prof::Drain));
|
||||
let final_span = prof::span(PStage::Final, Some(self.context));
|
||||
trace_step("forward: all layers ok, final row");
|
||||
let preview = rows.preview_conditioning(binding, dense, txn);
|
||||
let final_row = preview.map_err(|error| trace_error("preview_conditioning", error))?;
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ impl<'ctx> OriginalPromptExecutor<'ctx> {
|
||||
) -> Result<PromptDeviceRows<'static, 'arena, 'loan, 'ctx>> {
|
||||
let weights = chunk.weights;
|
||||
let (binding, tokens, txn) = (weights.binding, chunk.window, &*chunk.txn);
|
||||
let drain = Some(self.context as &dyn prof::Drain);
|
||||
let drain = Some(self.context);
|
||||
let init_span = prof::span(PStage::Initialize, drain);
|
||||
let sources = Self::prompt_sources(binding, self.context, txn, tokens.len())?;
|
||||
let upload_span = prof::span(PStage::InitUpload, drain);
|
||||
|
||||
+5
-5
@@ -64,7 +64,7 @@ impl<'ctx> OriginalPromptExecutor<'ctx> {
|
||||
txn: &OriginalPromptTxn<'_, 'ctx>,
|
||||
carrier: Carrier<'w, 'arena, 'loan, 'ctx>,
|
||||
) -> Result<Carrier<'w, 'arena, 'loan, 'ctx>> {
|
||||
let drain = Some(self.context as &dyn prof::Drain);
|
||||
let drain = Some(self.context);
|
||||
let Carrier::Plain(mut rows) = carrier else {
|
||||
return Err(Error::IdentityMismatch);
|
||||
};
|
||||
@@ -87,7 +87,7 @@ impl<'ctx> OriginalPromptExecutor<'ctx> {
|
||||
carrier: Carrier<'_, 'arena, 'loan, 'ctx>,
|
||||
index: u32,
|
||||
) -> Result<PromptDeviceRead<'static, 'arena, 'loan, 'ctx>> {
|
||||
let drain = Some(self.context as &dyn prof::Drain);
|
||||
let drain = Some(self.context);
|
||||
let prompt = self.prompt.as_mut().ok_or(Error::IdentityMismatch)?;
|
||||
match carrier {
|
||||
Carrier::Plain(mut rows) => {
|
||||
@@ -111,7 +111,7 @@ impl<'ctx> OriginalPromptExecutor<'ctx> {
|
||||
read: PromptDeviceRead<'static, 'arena, 'loan, 'ctx>,
|
||||
layer: &BoundLayer,
|
||||
) -> Result<Carrier<'w, 'arena, 'loan, 'ctx>> {
|
||||
let drain = Some(self.context as &dyn prof::Drain);
|
||||
let drain = Some(self.context);
|
||||
let mixer_span = prof::span(
|
||||
match layer.kind() {
|
||||
BoundLayerKind::Gdn => PStage::Gdn,
|
||||
@@ -190,7 +190,7 @@ impl<'ctx> OriginalPromptExecutor<'ctx> {
|
||||
mut ffn: Carrier<'_, 'arena, 'loan, 'ctx>,
|
||||
index: u32,
|
||||
) -> Result<PromptDeviceRead<'static, 'arena, 'loan, 'ctx>> {
|
||||
let drain = Some(self.context as &dyn prof::Drain);
|
||||
let drain = Some(self.context);
|
||||
validated(|| match &mut ffn {
|
||||
Carrier::Plain(rows) => rows.validate_original_rows(binding, dense),
|
||||
Carrier::Normed(rows) => rows.validate_original_rows(binding, dense),
|
||||
@@ -218,7 +218,7 @@ impl<'ctx> OriginalPromptExecutor<'ctx> {
|
||||
index: u32,
|
||||
) -> Result<Carrier<'w, 'arena, 'loan, 'ctx>> {
|
||||
let PromptWeights { binding, dense } = weights;
|
||||
let drain = Some(self.context as &dyn prof::Drain);
|
||||
let drain = Some(self.context);
|
||||
let prompt = self.prompt.as_mut().ok_or(Error::IdentityMismatch)?;
|
||||
let moe_span = prof::span(PStage::Moe, drain);
|
||||
// Literal fused GR norm is prohibited across PLE and final head.
|
||||
|
||||
@@ -25,8 +25,6 @@ const ALPHA_BETA: usize = 96;
|
||||
const BATCH_RESERVE: usize = 128 * 1024 * 1024;
|
||||
const EAGER_TOKENS: usize = 64;
|
||||
/// Largest dequantized GDN matrix (attn_qkv, 10240 x 2560) in FP16 bytes.
|
||||
/// The shared exclusively loaned GEMM adapter every batched step receives.
|
||||
type GemmRef<'a> = &'a dyn GdnGemm;
|
||||
|
||||
pub(in crate::qwen_forward) const BATCH_SCRATCH_BYTES: usize = CHANNELS * MIXED * 2;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use super::step_batch::{
|
||||
check_gdn_window, gather_gdn_rows, gdn_operands, latch_cuda_failure, prepare_or_refuse, run_gdn_program,
|
||||
settle_gdn, window_bytes,
|
||||
};
|
||||
use super::{ChunkReady, GdnBatchResources, GdnChunkDevice, GdnChunkMicro, GdnStage, GemmRef, PromptLayer, Result};
|
||||
use super::{ChunkReady, GdnBatchResources, GdnChunkDevice, GdnChunkMicro, GdnGemm, GdnStage, PromptLayer, Result};
|
||||
|
||||
impl GdnStage {
|
||||
/// The batched Strata-prefill GDN step over one genuine current causal
|
||||
@@ -18,12 +18,12 @@ impl GdnStage {
|
||||
/// of the Out projection and its genuine journal edge. All edges are minted
|
||||
/// only after the whole batch drained finite and the chunk device adopted
|
||||
/// the final state.
|
||||
pub(in crate::qwen_forward) fn step_chunk_batch<'ctx>(
|
||||
pub(in crate::qwen_forward) fn step_chunk_batch<'ctx, G: GdnGemm>(
|
||||
prompt: PromptLayer<'_, '_, 'ctx>,
|
||||
micro: &GdnChunkMicro,
|
||||
owner: &mut GdnChunkDevice<'ctx>,
|
||||
resources: &mut GdnBatchResources<'ctx>,
|
||||
gemm: GemmRef<'_>,
|
||||
gemm: &G,
|
||||
) -> Result<Vec<ChunkReady>> {
|
||||
let PromptLayer { binding, layer, cache, current } = prompt;
|
||||
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
use super::{
|
||||
BoundLayerKind, Buffers, CHANNELS, ChunkReady, Context, DenseWeightCache, DeviceBuffer, Dimension, Error,
|
||||
GDN_BATCH_EPSILON, GdnBatchResources, GdnChunkDevice, GdnChunkMicro, GdnMatrixKind, GdnMatrixRole, GdnNativeFormat,
|
||||
GemmRef, LayerId, MIXED, ModelBinding, Result, Stage, TokenLayer, VALUE_HEADS, VALUES, download, driver_error,
|
||||
f32_bytes, native_format, validate_values,
|
||||
GDN_BATCH_EPSILON, GdnBatchResources, GdnChunkDevice, GdnChunkMicro, GdnGemm, GdnMatrixKind, GdnMatrixRole,
|
||||
GdnNativeFormat, LayerId, MIXED, ModelBinding, Result, Stage, TokenLayer, VALUE_HEADS, VALUES, download,
|
||||
driver_error, f32_bytes, native_format, validate_values,
|
||||
};
|
||||
use crate::qwen_forward::dense_weight_cache::GdnResident;
|
||||
use leleka_cuda_driver::GdnBatchPrefix;
|
||||
@@ -160,9 +160,9 @@ pub(super) fn window_bytes<'a, 'ctx>(
|
||||
}
|
||||
|
||||
/// Upload, run the closed GDN program and read back the next history and the Out projection.
|
||||
pub(super) fn run_gdn_program<'ctx>(
|
||||
pub(super) fn run_gdn_program<'ctx, G: GdnGemm>(
|
||||
resources: &mut GdnBatchResources<'ctx>,
|
||||
gemm: GemmRef<'_>,
|
||||
gemm: &G,
|
||||
tokens: usize,
|
||||
ops: &GdnOperands<'_, 'ctx>,
|
||||
bytes: &WindowBytes<'_, 'ctx>,
|
||||
|
||||
@@ -21,9 +21,6 @@ use leleka_cuda_driver::{
|
||||
MoeRouteBatch,
|
||||
};
|
||||
|
||||
/// The shared exclusively loaned GEMM adapter every batched step receives.
|
||||
type GemmRef<'a> = &'a dyn GdnGemm;
|
||||
|
||||
const MIXED: usize = 2560;
|
||||
const EXPERTS: usize = 512;
|
||||
const SELECTED: usize = 10;
|
||||
@@ -110,10 +107,10 @@ pub(in crate::qwen_forward) struct CombineWindow<'a> {
|
||||
|
||||
/// What the genuine caller lends a window: the actual device context, the persistent prefill resources and the
|
||||
/// exclusively loaned shared GEMM workspace adapter.
|
||||
pub(in crate::qwen_forward) struct PrefillLoans<'a, 'ctx> {
|
||||
pub(in crate::qwen_forward) struct PrefillLoans<'a, 'ctx, G: GdnGemm> {
|
||||
pub(in crate::qwen_forward) current: &'ctx Context<'ctx>,
|
||||
pub(in crate::qwen_forward) resources: &'a mut MoePrefillResources<'ctx>,
|
||||
pub(in crate::qwen_forward) gemm: GemmRef<'a>,
|
||||
pub(in crate::qwen_forward) gemm: &'a G,
|
||||
}
|
||||
|
||||
/// Per-call device owners, released together unless handed to the caller.
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
//! recomputes no shared expert; it is single-use per window and fenced against the actual chunk rows and binding.
|
||||
|
||||
use super::{
|
||||
Buffers, CombineInput, CombineOperands, CombineWindow, Error, MIXED, MicroInputs, MoeBf16Profile, MoeMicroProducts,
|
||||
MoePrefillStage, PrefillLoans, Result, WindowOperands, WindowReads, admit, assemble_products, check_combine_window,
|
||||
combine_on_device, device_bytes, driver_error, f32_bytes, route_on_device, validate_micro,
|
||||
Buffers, CombineInput, CombineOperands, CombineWindow, Error, GdnGemm, MIXED, MicroInputs, MoeBf16Profile,
|
||||
MoeMicroProducts, MoePrefillStage, PrefillLoans, Result, WindowOperands, WindowReads, admit, assemble_products,
|
||||
check_combine_window, combine_on_device, device_bytes, driver_error, f32_bytes, route_on_device, validate_micro,
|
||||
};
|
||||
|
||||
impl MoePrefillStage {
|
||||
@@ -23,10 +23,10 @@ impl MoePrefillStage {
|
||||
/// `operands.weights` the layer's shared-expert owners, `loans.gemm` the exclusively loaned shared workspace
|
||||
/// adapter (retained through the final drain of this call). With `operands.combine`, the Original
|
||||
/// `moe_combine` runs too and its output is part of the products.
|
||||
pub(in crate::qwen_forward) fn route_shared_micro<'ctx>(
|
||||
pub(in crate::qwen_forward) fn route_shared_micro<'ctx, G: GdnGemm>(
|
||||
window: WindowReads<'_>,
|
||||
operands: WindowOperands<'_, 'ctx>,
|
||||
loans: PrefillLoans<'_, 'ctx>,
|
||||
loans: PrefillLoans<'_, 'ctx, G>,
|
||||
) -> Result<MoeMicroProducts<'ctx>> {
|
||||
let WindowReads { binding, layer, reads } = window;
|
||||
let PrefillLoans { current, resources, gemm } = loans;
|
||||
@@ -51,11 +51,11 @@ impl MoePrefillStage {
|
||||
/// whole `bo` output is scanned (which also covers every `dm` element) and is stored in `products` only after a
|
||||
/// clean complete drain. Single-use: a window whose `route_shared_micro` ran the combine, or that already
|
||||
/// combined, is refused.
|
||||
pub(in crate::qwen_forward) fn combine_micro<'ctx>(
|
||||
pub(in crate::qwen_forward) fn combine_micro<'ctx, G: GdnGemm>(
|
||||
window: CombineWindow<'_>,
|
||||
products: &mut MoeMicroProducts<'ctx>,
|
||||
combine: CombineInput<'_, 'ctx>,
|
||||
loans: PrefillLoans<'_, 'ctx>,
|
||||
loans: PrefillLoans<'_, 'ctx, G>,
|
||||
) -> Result<()> {
|
||||
let CombineWindow { binding, layer, expected } = window;
|
||||
let PrefillLoans { current, resources, gemm } = loans;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Validation and device phases of `MoePrefillStage::route_shared_micro`.
|
||||
|
||||
use super::{
|
||||
Buffers, CombineInput, DeviceBuffer, Dimension, EXPERTS, Error, GdnNativeFormat, GemmRef, GrRole, LayerId, MIXED,
|
||||
Buffers, CombineInput, DeviceBuffer, Dimension, EXPERTS, Error, GdnGemm, GdnNativeFormat, GrRole, LayerId, MIXED,
|
||||
MOE_BATCH_MAX_TOKENS, ModelBinding, MoeMicroProducts, MoePrefillResources, MoeRouteBatch, ResidualReady, Result,
|
||||
RouteRow, SELECTED, SharedWeights, TokenLayer, down_format, driver_error, gate_up_format, validate_descriptors,
|
||||
validate_route_row,
|
||||
@@ -137,10 +137,10 @@ fn check_shared(weights: &SharedWeights<'_, '_>, layer: LayerId) -> Result<[GdnN
|
||||
/// Upload the mixed rows and run the closed route program; `finish` drains what was admitted and itself returns the
|
||||
/// latched admission error only when the drain showed no numerical refusal, so an earlier non-finite stage outranks a
|
||||
/// later admission error.
|
||||
pub(super) fn route_on_device<'ctx>(
|
||||
pub(super) fn route_on_device<'ctx, G: GdnGemm>(
|
||||
mut buffers: Buffers<'ctx>,
|
||||
resources: &mut MoePrefillResources<'ctx>,
|
||||
gemm: GemmRef<'_>,
|
||||
gemm: &G,
|
||||
inputs: &MicroInputs<'_, 'ctx>,
|
||||
mixed_bytes: &[u8],
|
||||
) -> Result<(Buffers<'ctx>, MoeRouteBatch)> {
|
||||
@@ -153,10 +153,10 @@ pub(super) fn route_on_device<'ctx>(
|
||||
}
|
||||
}
|
||||
|
||||
fn launch_route<'ctx>(
|
||||
fn launch_route<'ctx, G: GdnGemm>(
|
||||
buffers: &mut Buffers<'ctx>,
|
||||
resources: &mut MoePrefillResources<'ctx>,
|
||||
gemm: GemmRef<'_>,
|
||||
gemm: &G,
|
||||
inputs: &MicroInputs<'_, 'ctx>,
|
||||
mixed_bytes: &[u8],
|
||||
) -> Result<MoeRouteBatch> {
|
||||
@@ -280,11 +280,11 @@ fn check_window_size(binding: &ModelBinding, layer: LayerId, tokens: usize) -> R
|
||||
|
||||
/// Run the closed Original-combine program over the window's own drained products. As in `route_shared_micro`,
|
||||
/// `finish` alone decides, so an admission error here is reported only when the drain showed no numerical refusal.
|
||||
pub(super) fn combine_on_device<'ctx>(
|
||||
pub(super) fn combine_on_device<'ctx, G: GdnGemm>(
|
||||
resources: &mut MoePrefillResources<'ctx>,
|
||||
products: &MoeMicroProducts<'ctx>,
|
||||
tokens: usize,
|
||||
gemm: GemmRef<'_>,
|
||||
gemm: &G,
|
||||
operands: CombineOperands<'_, 'ctx>,
|
||||
) -> Result<()> {
|
||||
let CombineOperands { combine, bo } = operands;
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ pub(super) fn run_prompt_layer<'arena, 'loan, 'ctx>(
|
||||
) -> Result<OriginalDeviceBlock<'arena, 'loan, 'ctx>> {
|
||||
let PromptParts { io, scan, weights } = parts;
|
||||
let weights = *weights;
|
||||
let drain = Some(io.context as &dyn prof::Drain);
|
||||
let drain = Some(io.context);
|
||||
begin_stream(io.schedule, scan.bank, io.layer, &read)?;
|
||||
// High-only is the selected literal Original mixed BF16 policy.
|
||||
let prepare_span = prof::span(PStage::MoePrepare, drain);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
//! `LELEKA_PREFILL_PROFILE_SYNC` also set, the device is drained at the end of every span, so each stage
|
||||
//! carries its own GPU time (the drains themselves cost a little; use it for attribution, not for totals).
|
||||
//! Disabled, a span is one cached flag test and no clock read.
|
||||
use leleka_cuda_driver::Context;
|
||||
use std::cell::RefCell;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
@@ -141,24 +142,14 @@ fn sync_enabled() -> bool {
|
||||
enabled() && crate::settings::process().diagnostics.prefill_profile_sync
|
||||
}
|
||||
|
||||
/// Something the span can drain at its end in the synchronized attribution mode.
|
||||
pub(crate) trait Drain {
|
||||
fn drain(&self);
|
||||
}
|
||||
impl Drain for leleka_cuda_driver::Context<'_> {
|
||||
fn drain(&self) {
|
||||
let _ = self.synchronize();
|
||||
}
|
||||
}
|
||||
|
||||
/// One timed stage; the elapsed time is added when it drops.
|
||||
pub(crate) struct Span<'a> {
|
||||
stage: Stage,
|
||||
start: Option<Instant>,
|
||||
drain: Option<&'a dyn Drain>,
|
||||
drain: Option<&'a Context<'a>>,
|
||||
}
|
||||
/// A span over `stage`; `drain` is synchronized at its end when `LELEKA_PREFILL_PROFILE_SYNC` is set.
|
||||
pub(crate) fn span<'a>(stage: Stage, drain: Option<&'a dyn Drain>) -> Span<'a> {
|
||||
pub(crate) fn span<'a>(stage: Stage, drain: Option<&'a Context<'a>>) -> Span<'a> {
|
||||
if !enabled() {
|
||||
return Span { stage, start: None, drain: None };
|
||||
}
|
||||
@@ -168,7 +159,7 @@ impl Drop for Span<'_> {
|
||||
fn drop(&mut self) {
|
||||
let Some(start) = self.start else { return };
|
||||
if let Some(drain) = self.drain {
|
||||
drain.drain();
|
||||
let _ = drain.synchronize();
|
||||
}
|
||||
let elapsed = start.elapsed();
|
||||
let index = self.stage.index();
|
||||
|
||||
+4
-4
@@ -111,10 +111,10 @@ pub(in super::super) fn produce_original_gdn<'arena, 'loan, 'ctx>(
|
||||
read: OriginalDeviceGrRead<'arena, 'loan, 'ctx>,
|
||||
gdn: &mut leleka_cuda_driver::OriginalGdnPromptDevice<'ctx>,
|
||||
) -> Result<OriginalDeviceBlock<'arena, 'loan, 'ctx>> {
|
||||
use super::super::super::prefill_profile::{Drain, Stage as P, span};
|
||||
use super::super::super::prefill_profile::{Stage as P, span};
|
||||
let PromptWeights { binding, dense } = weights;
|
||||
let context = site.context;
|
||||
let drain = Some(context as &dyn Drain);
|
||||
let drain = Some(context);
|
||||
let mut lap = Lap::new("gdn-host");
|
||||
let state_in = span(P::GdnStateIn, drain);
|
||||
let (mut state, rows) = GdnLayer::enter(weights, txn, site, &mut lap)?;
|
||||
@@ -382,6 +382,6 @@ pub(super) fn produce_block<'arena, 'loan, 'ctx>(
|
||||
|
||||
/// The profiling span of the GR injection, synchronized with the context when `LELEKA_PREFILL_PROFILE_SYNC` is set.
|
||||
pub(super) fn inject_span<'a>(context: &'a Context<'_>) -> super::super::super::prefill_profile::Span<'a> {
|
||||
use super::super::super::prefill_profile::{Drain, Stage, span};
|
||||
span(Stage::Inject, Some(context as &dyn Drain))
|
||||
use super::super::super::prefill_profile::{Stage, span};
|
||||
span(Stage::Inject, Some(context))
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ The order: the debt of the engine is brought to zero in the code, or listed as a
|
||||
| `path-include` | 100 | 0 (420 files moved to the place their module name gives) | none; five `#[path]` remain in test-only modules: two files of the crate's `tests/` directory, the file two proofs share (`native_down_pair_io.rs`, one copy of its state each) |
|
||||
| `env-read` | 1 | 0 | `settings/source.rs`: the one reader of the process environment |
|
||||
| `instant-now` | 16 | 0 | 8 files of measurement timers in hot loops (round, miss, kernel; each one a log line or counter); load laps and the resident-RAM log line read `SystemClock` |
|
||||
| `dyn-trait` | engine-core 18, engine-fake 1, engine 53 | engine-core 0, engine-fake 0, engine 9 | `Box<dyn Backend>` of the five factory files, `EngineFamily::spawn` and the fake family (process boundary); two stored host callbacks (measurement sink, GPU probe). The 9 left are on the hot branch, see below |
|
||||
| `dyn-trait` | engine-core 18, engine-fake 1, engine 53 | engine-core 0, engine-fake 0, engine 9 (3 on the hot branch, see below) | `Box<dyn Backend>` of the five factory files, `EngineFamily::spawn` and the fake family (process boundary); two stored host callbacks (measurement sink, GPU probe). Of the 9 left, the `GdnGemm` loan (2) and the profile `Drain` (4) are generics on `claude/debt-hot-engine` (not merged), `OriginalServePool` (3) is open |
|
||||
| `process-global` | 59 | 0 | 37 files, in three groups: reads of the serving context that is fixed at start-up (`serving_cells()`), `Governor::global()` (the S13/S14 injection of a governor handle is not done), and the settings capture, one tuning cache, one trace epoch, four per-instance `OnceCell` fields |
|
||||
|
||||
What was done, with the tools that did it (all under `scripts/dev/`, offline aids):
|
||||
@@ -304,7 +304,7 @@ Left, with the reason:
|
||||
|---|---|---|
|
||||
| `Governor::global()` (22 sites in 12 files) | the handle has to travel through `StackConfig`, the request environment and `PrefixServe`; each site is cold, but the plumbing touches the load path | one `MemoryHandle` built from what `memory_governor::startup` returns and carried in `StackConfig`; then `memory_governor`'s free functions become its methods |
|
||||
| `serving_cells()` (33 sites in 27 files) | the bound is an immutable process constant after start-up; the call sites are position and prompt-length checks on the decode and prefill paths | a `ServingBound` handle on the session and the request, with the identity gate |
|
||||
| 9 `dyn` of the hot path: `OriginalServePool` (host), `GdnGemm` (prefill batch), `Drain` (prefill profile) | per-round and per-layer calls; the change is semantics-neutral but touches the decode loop and the prefill ring | branch `claude/debt-hot-engine`, not merged before the laptop identity run |
|
||||
| 9 `dyn` of the hot path: `GdnGemm` (prefill batch, 2) and `Drain` (prefill profile, 4) are generic on the branch `claude/debt-hot-engine`, awaiting the laptop identity run; `OriginalServePool` (host and decode steps, 3) | per-layer and per-round calls; the two pool adapters (CPU pool, GPU tier) need an enum that carries four lifetimes through the host | merge the branch after the identity run; the pool enum with the host refactor |
|
||||
| `settings::process()` | leaf code that cannot take a parameter | S13/S14 |
|
||||
|
||||
### (d) Other open items of this file (unchanged by the pass; the owner's order for them)
|
||||
|
||||
Reference in New Issue
Block a user