Merge branch 'claude/round-overhead' into claude/port-gpu-bringup
This commit is contained in:
@@ -419,7 +419,6 @@ impl<'driver> Device<'driver> {
|
||||
kar_levels: Cell::new(None),
|
||||
experimental: std::array::from_fn(|_| Cell::new(None)),
|
||||
window_modules: RefCell::new(Vec::new()),
|
||||
parked_execs: RefCell::new(Vec::new()),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -471,9 +470,6 @@ pub struct Context<'driver> {
|
||||
/// Sealed verify-window modules loaded under this context, shared by every verifier bank created later
|
||||
/// (the serve path assembles one per request) and unloaded with the context.
|
||||
window_modules: RefCell<Vec<(&'static str, Rc<original_verify::abi::Module>, Vec<&'static str>)>>,
|
||||
/// Drained verifier graph executables kept for the next verifier's graphs of the same shape (destroyed with
|
||||
/// the context).
|
||||
parked_execs: RefCell<Vec<original_gpu_schedule::ParkedExec>>,
|
||||
}
|
||||
#[derive(Clone, Copy)]
|
||||
struct FixedKernel {
|
||||
@@ -2093,22 +2089,6 @@ impl Context<'_> {
|
||||
}
|
||||
/// The shared verify-window modules: unloaded (current context) once no bank holds them; a module a live
|
||||
/// bank still shares is left to that bank's own unload.
|
||||
fn destroy_parked_execs(&mut self) -> Result<()> {
|
||||
let parked = std::mem::take(self.parked_execs.get_mut());
|
||||
if parked.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
if self.is_poisoned() {
|
||||
std::mem::forget(parked);
|
||||
return Err(Error::ContextPoisoned);
|
||||
}
|
||||
let guard = self.enter()?;
|
||||
let mut result = Ok(());
|
||||
for p in parked {
|
||||
result = combine(result, p.api.exec_destroy(p.exec));
|
||||
}
|
||||
combine(result, guard.finish())
|
||||
}
|
||||
fn unload_window_modules(&mut self) -> Result<()> {
|
||||
let modules = std::mem::take(self.window_modules.get_mut());
|
||||
if modules.is_empty() {
|
||||
@@ -2173,7 +2153,6 @@ impl Context<'_> {
|
||||
let unload = combine(unload, self.unload_kar_levels());
|
||||
let unload = combine(unload, self.unload_experimental());
|
||||
let unload = combine(unload, self.unload_window_modules());
|
||||
let unload = combine(unload, self.destroy_parked_execs());
|
||||
if let Some(handle) = self.handle.take() {
|
||||
// cuCtxDestroy accepts an owned non-current context. Pushing here
|
||||
// would add a stack entry for a handle invalidated by destruction.
|
||||
@@ -2635,7 +2614,6 @@ mod tests {
|
||||
kar_levels: Cell::new(None),
|
||||
experimental: std::array::from_fn(|_| Cell::new(None)),
|
||||
window_modules: RefCell::new(Vec::new()),
|
||||
parked_execs: RefCell::new(Vec::new()),
|
||||
};
|
||||
let make = |handle| DeviceBuffer {
|
||||
context: &context,
|
||||
|
||||
@@ -309,7 +309,6 @@ impl<'ctx> OriginalGpuStream<'ctx> {
|
||||
nodes: None,
|
||||
policy,
|
||||
last_sequence: 0,
|
||||
shape_nodes: 0,
|
||||
};
|
||||
let begin = call(self.inner.context, &self.inner.api, |a| a.begin(h));
|
||||
if let Err(primary) = begin {
|
||||
@@ -365,30 +364,8 @@ impl<'ctx> OriginalGpuStream<'ctx> {
|
||||
);
|
||||
}
|
||||
}
|
||||
// A verifier graph of an earlier (closed) verifier of this context with the same policy and node count is
|
||||
// updated in place instead of instantiated again (cuGraphExecUpdate: the topology must match, else the driver
|
||||
// refuses and the graph is instantiated as before).
|
||||
let reusable = matches!(policy, OriginalCapturePolicy::VerifierWindow | OriginalCapturePolicy::VerifierCommit)
|
||||
&& reuse_execs();
|
||||
let parked = if reusable {
|
||||
let n = call(g.context, &g.api, |a| a.nodes(graph))?;
|
||||
g.shape_nodes = n;
|
||||
g.context.take_parked_exec(policy as u8, n)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let instantiate = call(g.context, &g.api, |a| {
|
||||
g.exec = Some(match parked {
|
||||
Some(e) => {
|
||||
if a.exec_update(e, graph)? {
|
||||
e
|
||||
} else {
|
||||
a.exec_destroy(e)?;
|
||||
a.instantiate(graph)?
|
||||
}
|
||||
}
|
||||
None => a.instantiate(graph)?,
|
||||
});
|
||||
g.exec = Some(a.instantiate(graph)?);
|
||||
if policy == OriginalCapturePolicy::Registry {
|
||||
g.done = Some(a.event_create(false)?);
|
||||
} else {
|
||||
@@ -612,8 +589,6 @@ pub struct OriginalGpuGraph<'ctx, R: OriginalGraphResources> {
|
||||
nodes: Option<usize>,
|
||||
policy: OriginalCapturePolicy,
|
||||
last_sequence: u64,
|
||||
/// Node count of the captured graph of a reusable (verifier) policy: its executable's parking key.
|
||||
shape_nodes: usize,
|
||||
}
|
||||
impl<'ctx, R: OriginalGraphResources> OriginalGpuGraph<'ctx, R> {
|
||||
fn validate(&self) -> Result<usize> {
|
||||
@@ -787,20 +762,10 @@ impl<'ctx, R: OriginalGraphResources> OriginalGpuGraph<'ctx, R> {
|
||||
if drained.is_err() {
|
||||
return drained;
|
||||
}
|
||||
// Original reset order is executable -> graph -> completion event. A drained verifier executable is
|
||||
// parked with the context for the next verifier's graph of the same shape (`capture_owned`).
|
||||
// Original reset order is executable -> graph -> completion event.
|
||||
let mut result = Ok(());
|
||||
if let Some(e) = self.exec.take() {
|
||||
let park = matches!(self.policy, OriginalCapturePolicy::VerifierWindow | OriginalCapturePolicy::VerifierCommit)
|
||||
&& reuse_execs()
|
||||
&& self.graph.is_none();
|
||||
let parked = park
|
||||
&& self.shape_nodes > 0
|
||||
&& !self.context.is_poisoned()
|
||||
&& self.context.park_exec(self.policy as u8, self.shape_nodes, e, Rc::clone(&self.api));
|
||||
if !parked {
|
||||
result = combine(result, a.exec_destroy(e));
|
||||
}
|
||||
result = combine(result, a.exec_destroy(e));
|
||||
}
|
||||
if let Some(g) = self.graph.take() {
|
||||
result = combine(result, a.graph_destroy(g));
|
||||
@@ -1080,32 +1045,3 @@ pub mod capture_timing {
|
||||
(v[0], v[1], v[2])
|
||||
}
|
||||
}
|
||||
|
||||
/// `LELEKA_GRAPH_EXEC_REUSE=off`: every verifier graph is instantiated anew (A/B control).
|
||||
fn reuse_execs() -> bool {
|
||||
static ON: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
|
||||
*ON.get_or_init(|| !std::env::var("LELEKA_GRAPH_EXEC_REUSE").is_ok_and(|v| v == "off" || v == "0"))
|
||||
}
|
||||
/// A drained verifier executable kept by its context for the next verifier's graph of the same shape.
|
||||
pub(crate) struct ParkedExec {
|
||||
pub(crate) policy: u8,
|
||||
pub(crate) nodes: usize,
|
||||
pub(crate) exec: usize,
|
||||
pub(crate) api: Rc<abi::Api>,
|
||||
}
|
||||
impl<'d> Context<'d> {
|
||||
/// Park `exec` (at most 16 per context); false when the caller must destroy it.
|
||||
pub(crate) fn park_exec(&self, policy: u8, nodes: usize, exec: usize, api: Rc<abi::Api>) -> bool {
|
||||
let Ok(mut parked) = self.parked_execs.try_borrow_mut() else { return false };
|
||||
if parked.len() >= 16 || parked.try_reserve(1).is_err() {
|
||||
return false;
|
||||
}
|
||||
parked.push(ParkedExec { policy, nodes, exec, api });
|
||||
true
|
||||
}
|
||||
pub(crate) fn take_parked_exec(&self, policy: u8, nodes: usize) -> Option<usize> {
|
||||
let mut parked = self.parked_execs.try_borrow_mut().ok()?;
|
||||
let at = parked.iter().position(|p| p.policy == policy && p.nodes == nodes)?;
|
||||
Some(parked.swap_remove(at).exec)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,14 +41,6 @@ mod platform {
|
||||
type End = unsafe extern "C" fn(Handle, *mut Handle) -> i32;
|
||||
type Nodes = unsafe extern "C" fn(Handle, *mut Handle, *mut usize) -> i32;
|
||||
type Instantiate = unsafe extern "C" fn(*mut Handle, Handle, u64) -> i32;
|
||||
/// `CUgraphExecUpdateResultInfo`.
|
||||
#[repr(C)]
|
||||
struct UpdateInfo {
|
||||
result: i32,
|
||||
error_node: Handle,
|
||||
error_from_node: Handle,
|
||||
}
|
||||
type ExecUpdate = unsafe extern "C" fn(Handle, Handle, *mut UpdateInfo) -> i32;
|
||||
type GraphCall = unsafe extern "C" fn(Handle) -> i32;
|
||||
type GraphStream = unsafe extern "C" fn(Handle, Handle) -> i32;
|
||||
type CopyH2d = unsafe extern "C" fn(u64, *const c_void, usize, Handle) -> i32;
|
||||
@@ -86,7 +78,6 @@ mod platform {
|
||||
end: End,
|
||||
nodes: Nodes,
|
||||
instantiate: Instantiate,
|
||||
exec_update: ExecUpdate,
|
||||
graph_destroy: GraphCall,
|
||||
exec_destroy: GraphCall,
|
||||
upload: GraphStream,
|
||||
@@ -134,7 +125,6 @@ mod platform {
|
||||
end: sym!(c"cuStreamEndCapture", End),
|
||||
nodes: sym!(c"cuGraphGetNodes", Nodes),
|
||||
instantiate: sym!(c"cuGraphInstantiateWithFlags", Instantiate),
|
||||
exec_update: sym!(c"cuGraphExecUpdate_v2", ExecUpdate),
|
||||
graph_destroy: sym!(c"cuGraphDestroy", GraphCall),
|
||||
exec_destroy: sym!(c"cuGraphExecDestroy", GraphCall),
|
||||
upload: sym!(c"cuGraphUpload", GraphStream),
|
||||
@@ -255,19 +245,6 @@ mod platform {
|
||||
}
|
||||
Ok(e as usize)
|
||||
}
|
||||
/// `cuGraphExecUpdate`: `Ok(true)` when the executable now runs `g`'s parameters, `Ok(false)` when the
|
||||
/// driver refused the update (topology or node kind differ; the executable is unchanged and still valid).
|
||||
pub(crate) fn exec_update(&self, e: usize, g: usize) -> Result<bool> {
|
||||
let mut info = UpdateInfo { result: 0, error_node: std::ptr::null_mut(), error_from_node: std::ptr::null_mut() };
|
||||
// SAFETY: live executable and graph of the current context; `info` is a valid out-parameter.
|
||||
let code = unsafe { (self.exec_update)(e as Handle, g as Handle, &mut info) };
|
||||
// CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE (910): a refused update, not a fault.
|
||||
match code {
|
||||
0 => Ok(info.result == 0),
|
||||
910 => Ok(false),
|
||||
_ => check("cuGraphExecUpdate", code).map(|()| false),
|
||||
}
|
||||
}
|
||||
pub(crate) fn graph_destroy(&self, g: usize) -> Result<()> {
|
||||
check("cuGraphDestroy", unsafe {
|
||||
(self.graph_destroy)(g as Handle)
|
||||
@@ -382,9 +359,6 @@ impl Api {
|
||||
pub(crate) fn instantiate(&self, _: usize) -> Result<usize> {
|
||||
Err(Error::UnsupportedPlatform)
|
||||
}
|
||||
pub(crate) fn exec_update(&self, _: usize, _: usize) -> Result<bool> {
|
||||
Err(Error::UnsupportedPlatform)
|
||||
}
|
||||
pub(crate) fn graph_destroy(&self, _: usize) -> Result<()> {
|
||||
Err(Error::UnsupportedPlatform)
|
||||
}
|
||||
|
||||
@@ -82,6 +82,9 @@ pub(crate) struct ExpertTierConfig {
|
||||
/// `--pcie-frac` (0.55, generate.cpp's default): the share of a group's missed experts staged over PCIe (by the
|
||||
/// copy kernel or DMA, `pcie_mode`). Only used while the tier is on.
|
||||
pub(crate) pcie_frac: f64,
|
||||
/// `pcie_frac` was set by the operator. Unset, a pageable (low-RAM, file-mapped) bank stages nothing over PCIe:
|
||||
/// its misses would be DMA'd from pageable pages (job report: 6.7 vs 10-12 tok/s on the 3080 laptop).
|
||||
pub(crate) pcie_frac_set: bool,
|
||||
/// `--pcie-mode` (auto).
|
||||
pub(crate) pcie_mode: PcieMode,
|
||||
/// `--adapt-every` (4) and `--adapt-swaps` (96); either 0 turns the adaptive tier off.
|
||||
@@ -101,6 +104,7 @@ impl ExpertTierConfig {
|
||||
reserve_mib: 700,
|
||||
decode_reserve_mib: 1024,
|
||||
pcie_frac: 0.55,
|
||||
pcie_frac_set: false,
|
||||
pcie_mode: PcieMode::Auto,
|
||||
adapt_every: 4,
|
||||
adapt_swaps: 96,
|
||||
@@ -128,6 +132,11 @@ impl ExpertTierConfig {
|
||||
pub(crate) fn pcie_num(&self) -> u32 {
|
||||
(self.pcie_frac * 256.0 + 0.5).clamp(0.0, 256.0) as u32
|
||||
}
|
||||
/// `pcie_num` for the bank the tier reads: the default 0.55 needs a registered (pinned, aliased) source; a
|
||||
/// pageable mapped bank takes 0 unless the operator set a share.
|
||||
pub(crate) fn pcie_num_for(&self, pageable_source: bool) -> u32 {
|
||||
if pageable_source && !self.pcie_frac_set { 0 } else { self.pcie_num() }
|
||||
}
|
||||
pub(crate) fn adaptive(&self) -> bool {
|
||||
self.adapt_every > 0 && self.adapt_swaps > 0
|
||||
}
|
||||
@@ -155,6 +164,7 @@ impl ExpertTierConfig {
|
||||
number("DECODE_RESERVE_MIB", &mut config.decode_reserve_mib)?;
|
||||
if let Some(v) = var("PCIE_FRAC") {
|
||||
config.pcie_frac = v.parse().map_err(|_| Error::InvalidDimension)?;
|
||||
config.pcie_frac_set = true;
|
||||
}
|
||||
if let Some(v) = var("PCIE_MODE") {
|
||||
config.pcie_mode = match v.as_str() {
|
||||
@@ -343,10 +353,41 @@ impl ResidencyStats {
|
||||
pub(crate) struct ResidencyState {
|
||||
usage: Vec<f32>,
|
||||
pub(crate) stats: ResidencyStats,
|
||||
/// generate.cpp `--dump-routing FILE` (`LELEKA_ORIGINAL_SERVE_DUMP_ROUTING`): every decode window row's routed
|
||||
/// experts, as `tools/make_profile.py` reads them (layer i32, k i32, k ids i32, k weights f32).
|
||||
routing: Option<std::io::BufWriter<std::fs::File>>,
|
||||
}
|
||||
impl ResidencyState {
|
||||
pub(crate) fn new(config: &ExpertTierConfig) -> Self {
|
||||
Self { usage: if config.adaptive() { vec![0.0; LAYERS * EXPERTS] } else { Vec::new() }, stats: ResidencyStats::default() }
|
||||
let routing = std::env::var_os("LELEKA_ORIGINAL_SERVE_DUMP_ROUTING")
|
||||
.and_then(|path| std::fs::File::create(path).ok())
|
||||
.map(std::io::BufWriter::new);
|
||||
Self {
|
||||
usage: if config.adaptive() { vec![0.0; LAYERS * EXPERTS] } else { Vec::new() },
|
||||
stats: ResidencyStats::default(),
|
||||
routing,
|
||||
}
|
||||
}
|
||||
/// Write the buffered routing records out (end of a request).
|
||||
pub(crate) fn flush_routing(&mut self) {
|
||||
if let Some(routing) = self.routing.as_mut() {
|
||||
let _ = std::io::Write::flush(routing);
|
||||
}
|
||||
}
|
||||
fn record_routing(&mut self, layer: usize, ids: &[i32], weights: &[f32]) {
|
||||
let Some(routing) = self.routing.as_mut() else { return };
|
||||
if ids.len() != weights.len() {
|
||||
return;
|
||||
}
|
||||
let mut record = Vec::with_capacity(8 + 8 * TOP_K);
|
||||
for (row, w) in ids.chunks_exact(TOP_K).zip(weights.chunks_exact(TOP_K)) {
|
||||
record.clear();
|
||||
record.extend_from_slice(&(layer as i32).to_le_bytes());
|
||||
record.extend_from_slice(&(TOP_K as i32).to_le_bytes());
|
||||
row.iter().for_each(|e| record.extend_from_slice(&e.to_le_bytes()));
|
||||
w.iter().for_each(|x| record.extend_from_slice(&x.to_le_bytes()));
|
||||
let _ = std::io::Write::write_all(routing, &record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,6 +416,7 @@ impl<'ctx> OriginalServePool<'ctx> for GpuExpertPool<'_, '_, 'ctx> {
|
||||
return Err(Error::InvalidDimension);
|
||||
}
|
||||
let mut clock = super::original_serve_pool::window_trace::now();
|
||||
self.state.record_routing(layer, rows.ids, rows.route_weights);
|
||||
if !self.state.usage.is_empty() {
|
||||
for &e in rows.ids {
|
||||
if (0..EXPERTS as i32).contains(&e) {
|
||||
@@ -727,6 +769,10 @@ mod tests {
|
||||
assert_eq!(with_profile.effective_slots(), -1);
|
||||
assert_eq!(ExpertTierConfig { slots: 2048, ..off.clone() }.effective_slots(), 2048);
|
||||
assert_eq!(ExpertTierConfig { pcie_frac: 0.55, ..off.clone() }.pcie_num(), 141);
|
||||
// the default share needs a pinned source; an operator's share applies to a pageable bank too
|
||||
assert_eq!(off.pcie_num_for(false), 141);
|
||||
assert_eq!(off.pcie_num_for(true), 0);
|
||||
assert_eq!(ExpertTierConfig { pcie_frac: 0.3, pcie_frac_set: true, ..off.clone() }.pcie_num_for(true), 77);
|
||||
assert_eq!(ExpertTierConfig { pcie_frac: 1.0, ..off.clone() }.pcie_num(), 256);
|
||||
assert!(ExpertTierConfig { slots: -2, ..off.clone() }.validate().is_err());
|
||||
assert!(ExpertTierConfig { pcie_frac: 1.5, ..off.clone() }.validate().is_err());
|
||||
|
||||
@@ -495,7 +495,7 @@ impl<'a, 'ctx> OriginalServeStack<'a, 'ctx> {
|
||||
}
|
||||
// generate.cpp `ver.set_pcie_mode`: only a window that can stage anything over PCIe records the copy kernel.
|
||||
let pcie_mode = match (expert_cache.as_ref(), moe.original_expert_bank()) {
|
||||
(Some(_), Some(bank)) if config.expert_tier.pcie_num() > 0 => {
|
||||
(Some(_), Some(bank)) if config.expert_tier.pcie_num_for(bank.pageable()) > 0 => {
|
||||
config.expert_tier.pcie_mode.graph_mode(bank.pageable(), blobs.spans_tile_blobs()).ok_or(Error::Unsupported(
|
||||
super::contract::Stage::Session,
|
||||
))?
|
||||
@@ -540,6 +540,7 @@ impl<'a, 'ctx> OriginalServeStack<'a, 'ctx> {
|
||||
let mut gpu_pool;
|
||||
let pool: &mut dyn OriginalServePool<'ctx> = match (expert_cache.as_mut(), moe.original_expert_bank()) {
|
||||
(Some(cache), Some(bank)) => {
|
||||
let pcie_num = config.expert_tier.pcie_num_for(bank.pageable());
|
||||
gpu_pool = GpuExpertPool {
|
||||
binding,
|
||||
moe: &*moe,
|
||||
@@ -547,7 +548,7 @@ impl<'a, 'ctx> OriginalServeStack<'a, 'ctx> {
|
||||
bank,
|
||||
cpu: &mut *pool,
|
||||
state: &mut *residency,
|
||||
pcie_num: config.expert_tier.pcie_num(),
|
||||
pcie_num,
|
||||
adapt_every: config.expert_tier.adapt_every,
|
||||
adapt_swaps: config.expert_tier.adapt_swaps as usize,
|
||||
};
|
||||
@@ -1010,6 +1011,7 @@ impl<'a, 'ctx> RequestOwners for OriginalServeStack<'a, 'ctx> {
|
||||
profile::add("mtp.instantiate", instantiate_ms);
|
||||
profile::add("prefill.phase", self.timing.0);
|
||||
profile::report("request");
|
||||
self.residency.flush_routing();
|
||||
result
|
||||
}
|
||||
fn finish(&mut self, ended: std::result::Result<(), ServeError>) {
|
||||
|
||||
+70
-1
@@ -49,7 +49,7 @@ The load must be the explicit KAR PLE MTP load, as for the windowed256 modes.
|
||||
| `LELEKA_ORIGINAL_SERVE_EXPERT_SLOTS` = `auto` \| N | `--expert-cache` | off (a profile alone means auto) |
|
||||
| `LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=yes` | `--expert-cache-per-layer` | global |
|
||||
| `LELEKA_ORIGINAL_SERVE_EXPERT_PROFILE=P` | `--expert-profile` | none |
|
||||
| `LELEKA_ORIGINAL_SERVE_PCIE_FRAC` | `--pcie-frac` | 0.55 (job 802) |
|
||||
| `LELEKA_ORIGINAL_SERVE_PCIE_FRAC` | `--pcie-frac` | 0.55 over a pinned bank (job 802); 0 over the pageable low-RAM bank unless set |
|
||||
| `LELEKA_ORIGINAL_SERVE_PCIE_MODE` = `auto` \| `dma` \| `kernel` | `--pcie-mode` | auto (the copy kernel when the bank has device aliases) |
|
||||
| `LELEKA_ORIGINAL_SERVE_ADAPT_EVERY` / `_ADAPT_SWAPS` | `--adapt-every` / `--adapt-swaps` | 4 / 96 |
|
||||
| `LELEKA_ORIGINAL_SERVE_VRAM_RESERVE_MIB` / `_DECODE_RESERVE_MIB` | `--vram-reserve-mib` / port only | 700 / 1024 (auto sizing) |
|
||||
@@ -255,3 +255,72 @@ With `STRATA_CKPT_REREAD=1` (separate process) F, S and Q2 re-read are token-ide
|
||||
(S: same chunks, unlike the full read); P differs because the re-read from 0 also cuts the root boundary. The
|
||||
existing serve smoke passes with the cache on by default. Job 412 (same requests, cache off) shows the stack is
|
||||
deterministic within and across processes for identical inputs and identical chunks.
|
||||
|
||||
## Round overhead (jobs 800-804)
|
||||
|
||||
RTX 5090, Ryzen 9 9950X3D, driver 595.99.02; one binary per job with A/B environment switches; 6 prompts of
|
||||
`~/work/gpu-runs/prompts.txt` x 2 passes x 128 greedy tokens (`LELEKA_SMOKE_MIN_P=0.5`), expert tier on (2048 slots,
|
||||
per layer, profile, `PCIE_FRAC=0.55`), `LELEKA_SERVE_PROFILE=1`. "Static" = `LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=0`
|
||||
(placement independent of copy timing, so arms are compared token for token). Per-round figures are profile sums
|
||||
over the 12 corpus requests divided by their rounds.
|
||||
|
||||
Job 803 (round-overhead 3e8e10e on port-gpu-bringup f845d86, static, arms A B C D D C B A):
|
||||
|
||||
| arm | decode tok/s (12 req) | ms/round | window | PCIe plan | publish | draft | vs old |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| old (serial publish, no overlap, DMA) | 47.5 / 47.4 | 52.5 / 52.6 | 50.0 / 50.1 | 2.36 | 0.24 | 2.48 | - |
|
||||
| new (all three) | 49.1 / 49.2 | 50.8 / 50.6 | 48.6 / 48.4 | 0.10 | 0.20 | 2.19 | 12/12 identical (x2) |
|
||||
| new, DMA staging | 49.1 / 47.7 | 51.0 / 52.3 | 48.8 / 50.0 | 2.24-2.34 | 0.17 | 2.18 | 10/12, 12/12 |
|
||||
| new, no overlap | 48.9 / 48.9 | 50.9 / 50.9 | 48.5 / 48.5 | 0.09 | 0.19 | 2.44 | 12/12 identical (x2) |
|
||||
|
||||
"Identical" = every corpus request's tokens and round count, plus the smoke's greedy, seeded-sampled and short
|
||||
requests. The 10/12 DMA arm differs from its own repeat as well: the two other DMA-staged arms (old x2, DMA-2) agree.
|
||||
TTFT is unchanged by these (793-803 ms means; the conversation cache resumes pass 1).
|
||||
|
||||
With the adaptive tier (default) the fenced publication removed the per-round context synchronizes (publish 1.9 ->
|
||||
0.2 ms, draft 3.3 -> 2.2 ms) but the swap copies then overlap the next window and its CPU share (CPU pool +1-2
|
||||
ms/round; 62.6 / 63.8 vs 63.7 / 64.4 tok/s with `LELEKA_SERVE_PUBLISH=serial`); the swaps are now awaited at the
|
||||
round start (3eb7405, job 804).
|
||||
|
||||
Job 802 (`--pcie-frac` 0 vs 0.55 with the copy kernel, adaptive, a b b a): 41.9 / 42.7 vs 62.2 / 63.6 tok/s, TTFT
|
||||
1214 / 1209 vs 1212 / 1207 ms; the default is now 0.55 (placement differs, so tokens do).
|
||||
|
||||
Job 801: queueing the prompt's lent-slot refill beside the window capture saved nothing (TTFT 1215 vs 1218 ms; the
|
||||
~49 ms is host span validation) and was reverted.
|
||||
|
||||
Job 800 profile of the old path (adaptive, before the merge of f845d86) per round: window 36.6 ms (CPU share 25.0,
|
||||
PCIe plan 1.6 of it), publish 1.3 (twelve checkpoints, each with a context synchronize that waits for the swaps),
|
||||
draft 3.5; per request: verifier assembly 111 ms (canonical GDN upload 17, seven graph captures 92), teardown 13.
|
||||
|
||||
Job 804 (3eb7405-era binary rt-b8, static, o m x x m o): sharing the verify window's sealed modules across the
|
||||
per-request verifiers (`Context::window_modules`, `LELEKA_WINDOW_MODULE_CACHE=off` to disable) cut the verifier
|
||||
assembly from 118 / 118 to 70 / 70 ms (module loading 49 -> 0.4 ms; capture 29 and instantiate 21 ms remain) and
|
||||
the TTFT mean over the 12 requests from 807 / 812 to 763 / 755 ms, outputs 12/12 identical, decode unchanged
|
||||
(49.2 / 49.4 vs 49.1 / 49.2 tok/s). Re-using the previous verifier's graph executables through cuGraphExecUpdate
|
||||
(6fa92c1) broke the stack in both arms that enabled it (window `CudaExecution` after a few requests; the 3080
|
||||
laptop saw the same on its third request) and was reverted (c45bcaa); the root cause was not isolated: the failure
|
||||
appears only when the update is accepted (with the module cache off the functions differ, the update is refused,
|
||||
the graph is instantiated and the runs pass).
|
||||
|
||||
### Expert residency (job 805, rt-b9 = round-overhead 973e0d2 on port-gpu-bringup 0850cfe)
|
||||
|
||||
`~/work/gpu-runs/baseline/profile.bin` is a placeholder: `make_profile.py --no-base` without a trace, i.e. every
|
||||
(layer, expert) pair in index order interleaved across the layers. With it, static residency serves 7-9 % of the
|
||||
routed entries from VRAM (random placement: 2048 of 24,576 experts is 8.3 %). Same 6 prompts x 2 passes x 128 tokens:
|
||||
|
||||
| residency | profile | decode tok/s (12 req, 2 runs) | VRAM hits per request |
|
||||
| --- | --- | --- | --- |
|
||||
| static | placeholder | 49.9 / 49.9 | 7-9 % |
|
||||
| static | shipped `data/expert-profile.bin` (sha256 8f59b4aa, the laptop's) | 51.0 / 51.0 | 4-19 % |
|
||||
| static | trace of 12 unrelated prompts x 256 tokens (`LELEKA_ORIGINAL_SERVE_DUMP_ROUTING` + `make_profile.py`) | 54.9 / 54.9 | 12-22 % |
|
||||
| adaptive (default) | placeholder | 66.8 / 67.0 | pass 0: 15-43 %, pass 1: 31-64 % |
|
||||
| adaptive | shipped | 67.2 / 67.2 | pass 0: 11-50 %, pass 1: 31-59 % |
|
||||
| adaptive | trace | 67.1 | pass 0: 15-48 %, pass 1: 35-62 % |
|
||||
| adaptive, swaps polled (`LELEKA_SERVE_SWAP_WAIT=off`) | placeholder | 64.8 | |
|
||||
| adaptive, old host path (serial publish, no overlap, DMA, polled) | placeholder | 69.2 (one run) | |
|
||||
|
||||
The adaptive tier's gain is residency matched to the conversation being served (it swaps in what these very
|
||||
requests route): no static ranking from another workload gets there, and under adaptation the starting profile
|
||||
hardly matters. The prompt's own routing (computed by the prefill) would be the earliest signal for a first
|
||||
request; that needs a hook in the prompt path and is not done. The single old-path run was faster than the new
|
||||
default with adaptation (window 32.9 vs 35.4 ms at an equal CPU share): job 807 separates the PCIe staging mode.
|
||||
|
||||
Reference in New Issue
Block a user