pub fn for_each_token_permutation(
policy: CompileTimePolicy,
f: impl FnMut(&TokenPermutation),
) -> PermutationReportAvailable on crate feature
std only.Expand description
Run f once for every unique combination of available SIMD tokens disabled.
Acquires a process-wide mutex to prevent concurrent token manipulation.
Re-enables all tokens after each invocation, even if f panics.
§Permutation logic
- Resets any stale disabled state from previous tests
- Discovers which tokens are available on this CPU (
summon()→Some) - Excludes tokens that can’t be disabled (compile-time guaranteed),
applying
policy - Skips tokens the CPU doesn’t have — they’d produce duplicate states
- Generates all valid combinations respecting cascade hierarchy (disabling a parent implies its descendants are disabled too)
- Runs
ffor each unique effective state
§Panics
- If
policyisCompileTimePolicy::Failand any available token is compile-time guaranteed. - If
fpanics (after re-enabling tokens and releasing the mutex).