diff --git a/crates/metal2vulkan/src/pipeline/compile.rs b/crates/metal2vulkan/src/pipeline/compile.rs index 6606c657b..cd402744e 100644 --- a/crates/metal2vulkan/src/pipeline/compile.rs +++ b/crates/metal2vulkan/src/pipeline/compile.rs @@ -1199,11 +1199,7 @@ impl StageEntries { (&fd.linked, &fd.libraries), InputsFrom::Given(&inputs), Shared::Decode(self), - |r| { - m.weighted(crate::pipeline::compile::weights::SPECIALIZE, |m| { - specialize_one(r, m) - }) - }, + |r| specialize_one(r, m), ) })?; let specialized = Arc::new(specialized); @@ -2753,8 +2749,14 @@ struct Specialized { } /// Decode, cross-check a metallib function's container tags, and specialize: the AIR hash, the -/// entry name, the specialized entry, and what its code read before. +/// entry name, the specialized entry, and what its code read before. Its work weighs +/// [`weights::SPECIALIZE`] whoever asks. fn specialize_one(r: &Request<'_>, m: &mut Meter) -> Result { + m.weighted(weights::SPECIALIZE, |m| specialize_unweighed(r, m)) +} + +/// [`specialize_one`]'s work. +fn specialize_unweighed(r: &Request<'_>, m: &mut Meter) -> Result { #[cfg(test)] tests::inject::panic_if_armed(); // The creation's entry of this stage: the same request's, made by a check or key of the @@ -2819,9 +2821,7 @@ fn ordered_entry(r: &Request<'_>, p: &DeviceProfile, m: &mut Meter) -> Result Result<(Plan, KernelFacts), Error> { let (spec, memory, observed) = (&self.spec, &self.memory, self.observed); - let plan = crate::lower::select::select(spec, memory, p, (&self.inputs, widest), m)?; + let plan = m.weighted(weights::SELECT, |m| { + crate::lower::select::select(spec, memory, p, (&self.inputs, widest), m) + })?; let kernel = KernelFacts { max_total_threads: spec.ep.stage.max_total_threads(), work_group_size: spec.ep.stage.work_group_size(), diff --git a/crates/metal2vulkan/src/pipeline/compile/stage_bound.rs b/crates/metal2vulkan/src/pipeline/compile/stage_bound.rs index 0a7936024..8366c1992 100644 --- a/crates/metal2vulkan/src/pipeline/compile/stage_bound.rs +++ b/crates/metal2vulkan/src/pipeline/compile/stage_bound.rs @@ -143,9 +143,7 @@ pub(super) fn emit( let mut widest = WidestPin::Weighed; loop { let before = m.ledger(); - let (plan, kernel) = m.weighted(crate::pipeline::compile::weights::SELECT, |m| { - analyzed.select(p, widest, m) - })?; + let (plan, kernel) = analyzed.select(p, widest, m)?; plan.estimate.check(word_cap)?; let mut emitted = m.weighted(crate::pipeline::compile::weights::EMIT, |m| { crate::lower::emit::emit_module(&analyzed.spec, &plan, m)