STRA-338 params e03: MTP expert transport takes ExpertWeights/SelectedRoute/RoutedExpert; first-seed restore takes RetainedFirstSeed; adaptive wave left to e05

This commit is contained in:
Pavlo Ratushnyi
2026-11-08 02:15:10 +01:00
parent 80c9c4aca0
commit f1e216a316
15 changed files with 129 additions and 100 deletions
@@ -5,7 +5,7 @@ use super::*;
mod adaptive_wave_fn;
use crate::model_binding::qwen4exp_input::{MoeRoutedSourceScope, MoeWeightDescriptor};
use crate::qwen_forward::cpu_expert_miss::{CpuMissRows, CpuMissWorkspace, PreparedCpuMiss, runtime_error};
use adaptive_wave_fn::{AdaptiveWave, WaveState};
use adaptive_wave_fn::AdaptiveWave;
#[allow(clippy::too_many_arguments)]
pub(super) fn project_adaptive_groups<'ctx>(
@@ -27,8 +27,8 @@ pub(super) fn project_adaptive_groups<'ctx>(
}
let (residents, misses) = split_resident_misses(binding, rows, groups, cache)?;
let job_allowance = wave_job_allowance(residents.capacity(), misses.capacity())?;
let wave = AdaptiveWave { context, binding, rows, scope, origins, prepared, actual };
wave.run(&mut WaveState { cache, down, cancelled }, &residents, &misses, job_allowance)
let wave = AdaptiveWave { context, binding, rows, scope, origins, prepared };
wave.run(cache, down, cancelled, actual, &residents, &misses, job_allowance)
}
/// Actual outer wave directories coexist with owned jobs until join.
@@ -6,57 +6,45 @@ use crate::qwen_forward::cpu_expert_miss::{CpuMissRows, CpuMissWorkspace, runtim
/// The shared inputs of one adaptive wave: resident groups on the GPU, misses on the owned CPU pool.
#[derive(Clone, Copy)]
pub(super) struct AdaptiveWave<'a, 'ctx, 'txn, 'driver> {
pub(super) struct AdaptiveWave<'a, 'ctx> {
pub(super) context: &'ctx Context<'ctx>,
pub(super) binding: &'a ModelBinding,
pub(super) rows: &'a [ChunkFfnRow],
pub(super) scope: &'a DownScope<'ctx>,
pub(super) origins: &'a [Rc<DownOrigin>],
pub(super) prepared: &'a [RoutedGateUpQ8<'a>],
pub(super) actual: Option<&'a QwenChunkTxn<'txn, 'driver>>,
}
/// What an adaptive wave mutates while it runs: the weight cache, the down-projection slots and the cancellation
/// poll, which is checked before every batch and every completed member.
pub(super) struct WaveState<'w, 'cache, 'ctx, F: FnMut() -> bool> {
pub(super) cache: &'w mut MoeWeightCache<'cache>,
pub(super) down: &'w mut [[Option<ActualDown<'ctx>>; K]],
pub(super) cancelled: &'w mut F,
}
/// One batch of CPU miss groups, with the resident GPU groups that run overlapped with it (first batch only).
#[derive(Clone, Copy)]
struct MissBatch<'a> {
groups: &'a [&'a [Pair]],
residents: Option<&'a [&'a [Pair]]>,
}
impl<'ctx> AdaptiveWave<'_, 'ctx, '_, '_> {
impl<'a, 'ctx> AdaptiveWave<'a, 'ctx> {
/// Run the miss batches in order; the resident GPU groups run once, overlapped with the first batch.
pub(super) fn run<F: FnMut() -> bool>(
#[allow(clippy::too_many_arguments)]
pub(super) fn run(
&self,
state: &mut WaveState<'_, '_, 'ctx, F>,
cache: &mut MoeWeightCache<'_>,
down: &mut [[Option<ActualDown<'ctx>>; K]],
cancelled: &mut impl FnMut() -> bool,
actual: Option<&QwenChunkTxn<'_, '_>>,
residents: &[&[Pair]],
misses: &[&[Pair]],
job_allowance: usize,
) -> Result<()> {
let mut gpu_done = false;
let cpu_owner = state.cache.cpu_miss_owner(self.binding)?;
let cpu_owner = cache.cpu_miss_owner(self.binding)?;
let mut cpu = cpu_owner.try_borrow_mut().map_err(|_| Error::IdentityMismatch)?;
let mut offset = 0usize;
while offset < misses.len() {
let end = miss_batch_end(self.rows, misses, offset)?;
let groups = &misses[offset..end];
let batch = &misses[offset..end];
offset = end;
if (state.cancelled)() {
if cancelled() {
return Err(Error::Unsupported(Stage::Executor));
}
let resident = if gpu_done { None } else { Some(residents) };
self.run_batch(state, &mut cpu, MissBatch { groups, residents: resident }, job_allowance)?;
self.run_batch(cache, down, cancelled, actual, &mut cpu, batch, resident, job_allowance)?;
gpu_done = true;
}
if !gpu_done {
self.project_residents(residents, state)?;
self.project_residents(residents, cache, down, cancelled)?;
}
Ok(())
}
@@ -65,19 +53,23 @@ impl<'ctx> AdaptiveWave<'_, 'ctx, '_, '_> {
/// the CPU side, then upload the completed rows. Model-lifetime stacks/native scratch were admitted before the
/// pool. This request admits <=16 jobs and <=48MiB INCLUDING actual directory, preparation and start/join
/// metadata/capacities. Callees measure their own retained capacities against this remaining allowance before send.
fn run_batch<F: FnMut() -> bool>(
#[allow(clippy::too_many_arguments)]
fn run_batch(
&self,
state: &mut WaveState<'_, '_, 'ctx, F>,
cache: &mut MoeWeightCache<'_>,
down: &mut [[Option<ActualDown<'ctx>>; K]],
cancelled: &mut impl FnMut() -> bool,
actual: Option<&QwenChunkTxn<'_, '_>>,
cpu: &mut CpuMissWorkspace,
batch: MissBatch<'_>,
batch: &[&[Pair]],
residents: Option<&[&[Pair]]>,
job_allowance: usize,
) -> Result<()> {
let MissBatch { groups: batch, residents } = batch;
let jobs = prepare_cpu_jobs(self.binding, self.rows, batch, cpu, job_allowance)?;
let pending = cpu.start(jobs, job_allowance).map_err(runtime_error)?;
let gpu_result = match residents {
None => Ok(()),
Some(residents) => self.project_residents(residents, state),
Some(residents) => self.project_residents(residents, cache, down, cancelled),
};
// Always drain actual CPU consumers, including GPU failure/cancellation.
// Preserve the primary GPU failure; no source allocation outlives join.
@@ -87,28 +79,33 @@ impl<'ctx> AdaptiveWave<'_, 'ctx, '_, '_> {
if completed.len() != batch.len() {
return Err(Error::IdentityMismatch);
}
self.finish_members(state, completed, batch)
self.finish_members(cache, down, cancelled, actual, completed, batch)
}
fn finish_members<F: FnMut() -> bool>(
fn finish_members(
&self,
state: &mut WaveState<'_, '_, 'ctx, F>,
cache: &mut MoeWeightCache<'_>,
down: &mut [[Option<ActualDown<'ctx>>; K]],
cancelled: &mut impl FnMut() -> bool,
actual: Option<&QwenChunkTxn<'_, '_>>,
completed: Vec<CpuMissRows>,
batch: &[&[Pair]],
) -> Result<()> {
for (values, pairs) in completed.into_iter().zip(batch) {
if (state.cancelled)() {
if cancelled() {
return Err(Error::Unsupported(Stage::Executor));
}
self.finish_member(state, pairs, values)?;
self.finish_member(cache, down, actual, pairs, values)?;
}
Ok(())
}
fn project_residents<F: FnMut() -> bool>(
fn project_residents(
&self,
residents: &[&[Pair]],
state: &mut WaveState<'_, '_, 'ctx, F>,
cache: &mut MoeWeightCache<'_>,
down: &mut [[Option<ActualDown<'ctx>>; K]],
cancelled: &mut impl FnMut() -> bool,
) -> Result<()> {
let (context, binding, rows) = (self.context, self.binding, self.rows);
project_residents(
@@ -116,24 +113,25 @@ impl<'ctx> AdaptiveWave<'_, 'ctx, '_, '_> {
binding,
rows,
residents,
state.cache,
cache,
self.prepared,
self.scope,
self.origins,
state.down,
state.cancelled,
down,
cancelled,
)
}
fn finish_member<F: FnMut() -> bool>(
fn finish_member(
&self,
state: &mut WaveState<'_, '_, 'ctx, F>,
cache: &mut MoeWeightCache<'_>,
down: &mut [[Option<ActualDown<'ctx>>; K]],
actual: Option<&QwenChunkTxn<'_, '_>>,
pairs: &[Pair],
values: CpuMissRows,
) -> Result<()> {
let (context, binding, rows, origins) = (self.context, self.binding, self.rows, self.origins);
let (cache, down) = (&mut *state.cache, &mut *state.down);
let keys = completed_keys(context, binding, rows, pairs, &values, cache, origins, down, self.actual)?;
let keys = completed_keys(context, binding, rows, pairs, &values, cache, origins, down, actual)?;
upload_completed_rows(self.scope, binding, &keys, pairs, &values, origins, down)?;
drop(values.into_values());
Ok(())
@@ -15,12 +15,12 @@ mod kv_only;
#[path = "mtp_state.rs"]
mod state;
pub(super) use kv_only::produce_chunk_kv_only;
pub(in crate::qwen_forward) use state::MtpCheckpoint;
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
pub(in crate::qwen_forward) use state::MtpChunkNumericSnapshot;
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
pub(crate) use state::PrefixDraftSnapshot;
pub(super) use state::{DenseKv, MtpChunkStage, MtpKvPrefill, MtpSession, ReadyMtpKvPrefill};
pub(in crate::qwen_forward) use state::{MtpCheckpoint, RetainedFirstSeed};
/// Created only from a successful current target product or a checked draft
/// successor. Reset/rewind invalidates every prior branch capability.
@@ -3,16 +3,9 @@
#[allow(unused_imports)]
use super::*;
use crate::qwen_forward::mtp::MtpCheckpoint;
use crate::qwen_forward::mtp::{MtpCheckpoint, RetainedFirstSeed};
pub(super) type WindowResult<T> = std::result::Result<T, MtpWindowError>;
/// The draft checkpoint taken after the first draft step, kept with the frame it was taken at so a window can
/// restore it instead of warming the draft again.
pub(super) struct RetainedFirstSeed {
pub(super) checkpoint: MtpCheckpoint,
pub(super) frame: mtp::MtpFrame,
}
pub(super) type FirstSeed = Option<RetainedFirstSeed>;
/// The authoritative first prediction of a window and the number of draft steps its depth and the context allow.
@@ -4,6 +4,7 @@
use super::*;
use super::batched_support::*;
use crate::qwen_forward::mtp::RetainedFirstSeed;
impl MtpDecoder {
/// Selected only by the existing explicit IQ3 integer/native Down policy.
@@ -175,7 +176,7 @@ impl MtpDecoder {
if source.predicted(target)? != frame.token() || source.position(target)? != frame.position() {
return Err(Error::IdentityMismatch.into());
}
self.draft.restore_first_seed(binding, target, frame, &seed.checkpoint, &mut st.draft_priors[0])?;
self.draft.restore_first_seed(binding, target, seed, &mut st.draft_priors[0])?;
Ok(())
}
@@ -60,12 +60,10 @@ mod impl_role;
#[allow(unused_imports)]
use impl_role::at;
#[allow(unused_imports)]
use impl_role::routed;
use impl_role::{RoutedExpert, routed};
#[path = "mtp_expert_transport/shared_project_fn.rs"]
mod shared_project_fn;
#[allow(unused_imports)]
pub(super) use shared_project_fn::compose;
#[allow(unused_imports)]
use shared_project_fn::compose_inner;
#[cfg(test)]
#[allow(unused_imports)]
@@ -77,3 +75,5 @@ pub(super) use shared_project_fn::fixed_reference;
use shared_project_fn::shared;
#[allow(unused_imports)]
use shared_project_fn::shared_project;
#[allow(unused_imports)]
pub(super) use shared_project_fn::{ExpertWeights, SelectedRoute, compose};
@@ -224,14 +224,21 @@ fn routed_down(
cleanup?;
Ok(output)
}
/// One routed expert of a token: the slot it fills in the route and its expert id.
#[derive(Clone, Copy)]
pub(super) struct RoutedExpert {
pub(super) slot: usize,
pub(super) expert: u32,
}
pub(super) fn routed(
transport: &mut Transport<'_>,
bank: &DeviceBuffer<'_>,
slot: usize,
expert: u32,
selected: RoutedExpert,
q: usize,
scales: usize,
) -> Result<Finite> {
let RoutedExpert { slot, expert } = selected;
if slot >= K || expert >= 512 {
return Err(Error::InvalidExpert);
}
@@ -134,20 +134,32 @@ impl Packed {
})
}
}
/// The routed expert bank and the four shared-expert weight buffers one MTP expert block reads.
#[derive(Clone, Copy)]
pub(in super::super) struct ExpertWeights<'a, 'ctx> {
pub(in super::super) bank: &'a DeviceBuffer<'ctx>,
pub(in super::super) shared: [&'a DeviceBuffer<'ctx>; 4],
}
/// The routed experts a token selected and the routing weights that scale their outputs.
#[derive(Clone, Copy)]
pub(in super::super) struct SelectedRoute {
pub(in super::super) ids: [u32; K],
pub(in super::super) weights: [f32; K],
}
pub(in super::super) fn compose(
context: &Context<'_>,
bank: &DeviceBuffer<'_>,
shared_weights: [&DeviceBuffer<'_>; 4],
expert_weights: ExpertWeights<'_, '_>,
mixed: &[f32],
ids: [u32; K],
weights: [f32; K],
route: SelectedRoute,
failed: Rc<Cell<bool>>,
) -> Result<Box<[f32]>> {
validate_values(mixed, N)?;
let signed = ids.map(|id| i32::try_from(id).unwrap_or(-1));
validate_route(signed, &weights)?;
let signed = route.ids.map(|id| i32::try_from(id).unwrap_or(-1));
validate_route(signed, &route.weights)?;
let mut transport = Transport::new(context, failed)?;
let result = compose_inner(&mut transport, bank, shared_weights, mixed, ids, weights);
let result = compose_inner(&mut transport, expert_weights, mixed, route);
transport.finish(result)
}
/// Every routed expert's Down, packed in slot order; the first failure stops before any later expert runs.
@@ -159,19 +171,19 @@ fn pack_routed(
(q, scales): (usize, usize),
) -> Result<()> {
for (slot, expert) in ids.into_iter().enumerate() {
let down = routed(transport, bank, slot, expert, q, scales)?;
let down = routed(transport, bank, RoutedExpert { slot, expert }, q, scales)?;
packed.pack(transport, down)?;
}
Ok(())
}
pub(super) fn compose_inner(
transport: &mut Transport<'_>,
bank: &DeviceBuffer<'_>,
shared_weights: [&DeviceBuffer<'_>; 4],
expert_weights: ExpertWeights<'_, '_>,
mixed: &[f32],
ids: [u32; K],
weights: [f32; K],
route: SelectedRoute,
) -> Result<Box<[f32]>> {
let ExpertWeights { bank, shared: shared_weights } = expert_weights;
let SelectedRoute { ids, weights } = route;
let input = transport.upload(mixed)?;
let mut packed = Packed::new(transport, ids)?;
let (q, scales) = transport.quantize(input, false)?;
@@ -186,18 +198,16 @@ pub(super) fn compose_inner(
#[cfg(test)]
pub(super) fn compose_observed(
context: &Context<'_>,
bank: &DeviceBuffer<'_>,
shared_weights: [&DeviceBuffer<'_>; 4],
expert_weights: ExpertWeights<'_, '_>,
mixed: &[f32],
ids: [u32; K],
weights: [f32; K],
route: SelectedRoute,
failed: Rc<Cell<bool>>,
) -> Result<ObservedOutput> {
validate_values(mixed, N)?;
validate_route(ids.map(|id| i32::try_from(id).unwrap_or(-1)), &weights)?;
validate_route(route.ids.map(|id| i32::try_from(id).unwrap_or(-1)), &route.weights)?;
let mut transport = Transport::new(context, failed)?;
transport.observations = Some(Vec::new());
let result = compose_inner(&mut transport, bank, shared_weights, mixed, ids, weights);
let result = compose_inner(&mut transport, expert_weights, mixed, route);
let observations = transport.observations.take().ok_or(Error::IdentityMismatch)?;
let values = transport.finish(result)?;
Ok((values, observations))
@@ -205,12 +215,11 @@ pub(super) fn compose_observed(
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
pub(in super::super) fn fixed_reference(
context: &Context<'_>,
bank: &DeviceBuffer<'_>,
shared: [&DeviceBuffer<'_>; 4],
expert_weights: ExpertWeights<'_, '_>,
mixed: &[f32],
ids: [u32; K],
weights: [f32; K],
route: SelectedRoute,
) -> Result<FixedReference> {
let (output, observed) = compose_observed(context, bank, shared, mixed, ids, weights, Rc::new(Cell::new(false)))?;
let failed = Rc::new(Cell::new(false));
let (output, observed) = compose_observed(context, expert_weights, mixed, route, failed)?;
Ok((output, observed.into_iter().map(|(role, values)| (format!("{role:?}"), values)).collect()))
}
@@ -227,7 +227,8 @@ pub(super) fn compare_observed(
expected: &Original,
failed: Rc<Cell<bool>>,
) {
let (output, observed) = compose_observed(ctx, bank, w, mixed, IDS, ROUTE, failed).unwrap();
let (weights, route) = (ExpertWeights { bank, shared: w }, SelectedRoute { ids: IDS, weights: ROUTE });
let (output, observed) = compose_observed(ctx, weights, mixed, route, failed).unwrap();
assert_eq!(observed.len(), 38);
let parts: Vec<f32> = expected.routed.iter().flat_map(|v| v.iter().copied()).collect();
let mut words = 0;
@@ -28,7 +28,8 @@ impl<'c> Env<'c> {
mixed: &[f32],
(ids, route): ([u32; K], [f32; K]),
) -> Result<Box<[f32]>> {
compose(self.ctx, bank, w, mixed, ids, route, self.failed.clone())
let route = SelectedRoute { ids, weights: route };
compose(self.ctx, ExpertWeights { bank, shared: w }, mixed, route, self.failed.clone())
}
pub(super) fn pair_cases(&self, bank: &DeviceBuffer<'_>, w: Weights<'_, '_>) {
let ctx = self.ctx;
@@ -113,11 +114,12 @@ impl<'c> Env<'c> {
mixed: &[f32],
) {
let foreign = device.create_context(144 * 1024 * 1024).unwrap();
let result = compose(&foreign, bank, w, mixed, IDS, ROUTE, Rc::new(Cell::new(false)));
let (weights, route) = (ExpertWeights { bank, shared: w }, SelectedRoute { ids: IDS, weights: ROUTE });
let result = compose(&foreign, weights, mixed, route, Rc::new(Cell::new(false)));
refusal(result, Error::IdentityMismatch, &foreign, 0, &self.refusals);
foreign.close().unwrap();
let low = device.create_context(DEVICE_PEAK - 1).unwrap();
let result = compose(&low, bank, w, mixed, IDS, ROUTE, Rc::new(Cell::new(false)));
let result = compose(&low, weights, mixed, route, Rc::new(Cell::new(false)));
refusal(result, Error::InputAllocation, &low, 0, &self.refusals);
low.close().unwrap();
}
@@ -28,7 +28,7 @@ fn slot_guards(
count: Count<'_>,
) {
let (q, scales) = t.quantize(input, false).unwrap();
let wrong_slot = routed(t, bank, 1, IDS[1], q, scales).unwrap();
let wrong_slot = routed(t, bank, RoutedExpert { slot: 1, expert: IDS[1] }, q, scales).unwrap();
let charge = ctx.allocated_bytes();
refusal(packed.pack(t, wrong_slot), Error::IdentityMismatch, ctx, charge, count);
assert_eq!(packed.next, 0);
@@ -54,7 +54,7 @@ pub(super) fn private_owner_guards(
slot_guards(ctx, &mut t, &mut packed, (bank, w, input), count);
let rival_input = rival.upload(mixed).unwrap();
let (rq, rs) = rival.quantize(rival_input, false).unwrap();
let foreign_invocation = routed(&mut rival, bank, 0, IDS[0], rq, rs).unwrap();
let foreign_invocation = routed(&mut rival, bank, RoutedExpert { slot: 0, expert: IDS[0] }, rq, rs).unwrap();
let charge = ctx.allocated_bytes();
refusal(packed.pack(&mut t, foreign_invocation), Error::IdentityMismatch, ctx, charge, count);
assert_eq!(packed.next, 0);
@@ -94,7 +94,7 @@ pub(in crate::qwen_forward) struct MtpExpertWorkspace<'ctx> {
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
mod fixed_workspace_gpu {
use super::super::mtp_expert_transport::fixed_reference;
use super::super::mtp_expert_transport::{ExpertWeights, SelectedRoute, fixed_reference};
use super::*;
use leleka_cuda_driver::Driver;
const BANK_BYTES: usize = 707_788_800;
@@ -244,7 +244,9 @@ mod fixed_workspace_gpu {
}
fn compare_pattern(&self, storage: &mut FixedBuffers<'ctx>, mixed: &[f32]) -> usize {
// Original allocation path and its direct unchanged quantizers FIRST.
let (expected, original) = fixed_reference(self.ctx, &self.bank, self.w(), mixed, IDS, ROUTE).unwrap();
let (weights, route) =
(ExpertWeights { bank: &self.bank, shared: self.w() }, SelectedRoute { ids: IDS, weights: ROUTE });
let (expected, original) = fixed_reference(self.ctx, weights, mixed, route).unwrap();
let scales = reference_scale_sets(self.ctx, mixed, &original);
assert_eq!(original.len(), 38);
assert_eq!(scales.len(), 11);
@@ -295,14 +297,22 @@ mod fixed_workspace_gpu {
corpus[at..at + 2].copy_from_slice(&0x7c00u16.to_le_bytes());
self.bank.copy_from(corpus).unwrap();
assert_eq!(
fixed_reference(self.ctx, &self.bank, self.w(), mixed, IDS, ROUTE).err(),
fixed_reference(
self.ctx,
ExpertWeights { bank: &self.bank, shared: self.w() },
mixed,
SelectedRoute { ids: IDS, weights: ROUTE }
)
.err(),
Some(Error::NonFinite)
);
assert_eq!(self.compose_with(storage, mixed, false).err(), Some(Error::NonFinite));
storage.check().unwrap();
corpus[at..at + 2].copy_from_slice(&saved);
self.bank.copy_from(corpus).unwrap();
let (expected, _) = fixed_reference(self.ctx, &self.bank, self.w(), mixed, IDS, ROUTE).unwrap();
let route = SelectedRoute { ids: IDS, weights: ROUTE };
let (expected, _) =
fixed_reference(self.ctx, ExpertWeights { bank: &self.bank, shared: self.w() }, mixed, route).unwrap();
let actual = self.compose_with(storage, mixed, false).unwrap();
exact(&expected, &actual);
actual.len()
@@ -134,7 +134,9 @@ impl<'a, 'k> Bound<'a, '_, '_, 'k> {
failed,
)
} else {
mtp_expert_transport::compose(self.context, bank, shared, input.mixed(), ids, route_weights, failed)
let expert_weights = mtp_expert_transport::ExpertWeights { bank, shared };
let route = mtp_expert_transport::SelectedRoute { ids, weights: route_weights };
mtp_expert_transport::compose(self.context, expert_weights, input.mixed(), route, failed)
}
}
}
@@ -63,6 +63,13 @@ pub(in crate::qwen_forward) struct MtpCheckpoint {
retained: Rc<Cell<usize>>,
}
/// The draft checkpoint taken after the first draft step, kept with the frame it was taken at so a window can
/// restore it instead of warming the draft again.
pub(in crate::qwen_forward) struct RetainedFirstSeed {
pub(in crate::qwen_forward) checkpoint: MtpCheckpoint,
pub(in crate::qwen_forward) frame: MtpFrame,
}
#[cfg(test)]
#[path = "mtp_state/tests.rs"]
mod tests;
@@ -124,15 +124,14 @@ impl MtpSession {
&mut self,
binding: &ModelBinding,
target: &crate::qwen_forward::session::QwenSession<'_>,
expected: &MtpFrame,
seed: &MtpCheckpoint,
seed: &RetainedFirstSeed,
original: &mut MtpCheckpoint,
) -> Result<()> {
expected.validate(binding, target)?;
seed.frame.validate(binding, target)?;
if !self.binding.matches(&binding.identity()) {
return Err(Error::IdentityMismatch);
}
self.restore_first_seed_checked(expected, seed, original)
self.restore_first_seed_checked(&seed.frame, &seed.checkpoint, original)
}
pub(super) fn restore_first_seed_checked(