fix(kar): do not refuse KAR routed experts just because the serving MoE cache exists
The serving backend always constructs a MoeWeightCache and step_cached passes Some(cache) to MoeExpertStage::execute on every token. The KAR branch returned IdentityMismatch whenever a cache was present, so with kar_expert_source set every token failed at layer 0 and the feature was unreachable from serve_load. The KAR branch never consults the cache for routed experts; it now ignores it (the shared expert takes the existing uncached projection path). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
7f9bf42a6e
commit
875dd12ddf
@@ -106,24 +106,23 @@ impl MoeExpertStage {
|
||||
// One immutable, step-local owner only on the explicitly selected
|
||||
// cache path. It never enters the weight cache or recurrence state.
|
||||
let (result, prepared_close) = if let Some(kar) = binding.kar_expert_source() {
|
||||
// Routed experts come from the KAR archive; the optimized MMQ
|
||||
// weight cache is a different owner and is refused, not mixed.
|
||||
if cache.is_some() {
|
||||
(Err(Error::IdentityMismatch), Ok(()))
|
||||
} else {
|
||||
(
|
||||
execute_cuda_kar(
|
||||
context,
|
||||
binding,
|
||||
&weights,
|
||||
&activation,
|
||||
&route,
|
||||
input.mixed(),
|
||||
(layer.get(), kar),
|
||||
),
|
||||
Ok(()),
|
||||
)
|
||||
}
|
||||
// Routed experts come from the KAR archive and never touch the MMQ
|
||||
// weight cache. The serving backend always owns a cache and hands
|
||||
// it to every step, so a present cache cannot be a reason to
|
||||
// refuse: it is simply not consulted for any expert here (the
|
||||
// shared expert takes the uncached path inside the KAR branch).
|
||||
(
|
||||
execute_cuda_kar(
|
||||
context,
|
||||
binding,
|
||||
&weights,
|
||||
&activation,
|
||||
&route,
|
||||
input.mixed(),
|
||||
(layer.get(), kar),
|
||||
),
|
||||
Ok(()),
|
||||
)
|
||||
} else if cache.is_some() {
|
||||
match context.prepare_routed_gate_up_q8(&activation) {
|
||||
Ok(prepared) => {
|
||||
|
||||
Reference in New Issue
Block a user