11# SIMD Admission Policy
22
3- ` base64-ng ` is scalar by default and admits only one conservative accelerated
4- path in the ` 1.1.x ` line: std ` x86 ` /` x86_64 ` SSSE3/SSE4.1 encode for Standard
5- and URL-safe alphabet families. Future SIMD dispatch remains gated unless a
6- complete SIMD admission evidence package lands in the same release commit as
7- the active backend change. The crate uses ` #![deny(unsafe_code)] ` and permits
3+ ` base64-ng ` is scalar by default and admits conservative accelerated encode
4+ paths in the ` 1.1.x ` line: std ` x86 ` /` x86_64 ` AVX2 first, then SSSE3/SSE4.1,
5+ for Standard and URL-safe alphabet families. Future SIMD dispatch remains gated
6+ unless a complete SIMD admission evidence package lands in the same release
7+ commit as the active backend change. The crate uses ` #![deny(unsafe_code)] ` and permits
88reviewed ` allow(unsafe_code) ` exceptions only for audited cleanup in
99` src/cleanup.rs ` , CT comparison, byte accumulation, CT scan, and CT result-gate
1010helpers in ` src/ct/ ` , and the private ` src/simd/ ` boundary.
@@ -37,6 +37,12 @@ The SIMD roadmap separates implementation evidence from active acceleration:
3737 code after runtime CPU probing. Scalar remains the fallback for unsupported
3838 CPUs, ` no_std ` , custom alphabets, tails, padding, in-place encode, wrapped
3939 encode paths that select scalar fallback, and every decode path.
40+ - ` 1.1.7 ` admits std ` x86 ` /` x86_64 ` AVX2 encode dispatch for Standard and
41+ URL-safe alphabet families. AVX2 is selected before SSSE3/SSE4.1 when runtime
42+ CPU probing proves ` avx2 ` ; otherwise the existing SSSE3/SSE4.1 or scalar
43+ fallback path is used. Tails, padding, custom alphabets, ` no_std ` , in-place
44+ encode, wrapped encode paths that select scalar fallback, and every decode
45+ path remain scalar.
4046- ` 1.2.0 ` is the release where encode acceleration must be fully working for
4147 the admitted encode scope. Public encode APIs must dispatch to admitted
4248 encode backends when runtime policy and CPU features allow it, and must fall
@@ -71,8 +77,8 @@ runtime behavior for that line.
7177 Decode and in-place encode are still backed only by the scalar implementation.
7278- With the ` simd ` feature enabled, the private dispatch scaffold detects
7379 AVX-512 VBMI, AVX2, SSSE3/SSE4.1, NEON, and wasm ` simd128 ` candidates.
74- Only std ` x86 ` /` x86_64 ` SSSE3/SSE4.1 encode can become active; all other
75- candidates still execute scalar code.
80+ Only std ` x86 ` /` x86_64 ` AVX2 and SSSE3/SSE4.1 encode can become active; all
81+ other candidates still execute scalar code.
7682- AVX-512 VBMI detection is reporting-only until the implementation has full
7783 admission evidence. Detection requires the planned feature bundle:
7884 ` avx512f ` , ` avx512bw ` , ` avx512vl ` , and ` avx512vbmi ` .
@@ -99,12 +105,12 @@ runtime behavior for that line.
99105 ` std::is_x86_feature_detected! ` ; unsupported CPUs execute scalar code.
100106 Custom alphabets, tails, padding, ` no_std ` , in-place encode, and decode stay
101107 scalar.
102- - An inactive AVX2 fixed-block encode prototype exists behind the SIMD boundary
103- as real non-dispatchable vector encode evidence for Standard and URL-safe
104- alphabets. It uses AVX2 lane-local byte shuffling, vector shifts/masks, and
108+ - AVX2 encode is admitted for std ` x86 ` /` x86_64 ` Standard and URL-safe alphabet
109+ families. It uses AVX2 lane-local byte shuffling, vector shifts/masks, and
105110 byte blending for fixed 24-byte input blocks, then clears XMM/YMM state
106- before returning. It is tested against scalar output only when AVX2 is
107- available and is not reachable from runtime backend selection.
111+ before returning. Runtime dispatch uses ` std::is_x86_feature_detected! ` ;
112+ unsupported CPUs fall back to SSSE3/SSE4.1 or scalar. Custom alphabets, tails,
113+ padding, ` no_std ` , in-place encode, and decode stay scalar.
108114- An inactive AArch64 NEON fixed-block encode prototype exists behind the same
109115 boundary as real non-dispatchable vector encode evidence for Standard and
110116 URL-safe alphabets. It uses NEON table lookup, vector shifts/masks, and
@@ -132,8 +138,8 @@ runtime behavior for that line.
132138 current ARM builds, candidate detection is compile-time target-feature
133139 reporting. A binary compiled with ` -C target-feature=+avx2 ` can therefore
134140 report an AVX2 candidate even if it is deployed on a CPU that cannot execute
135- AVX2 instructions. Active SSSE3/SSE4.1 encode dispatch is std runtime-probed
136- only; any future ` no_std ` SIMD activation must require an explicit
141+ AVX2 instructions. Active AVX2 and SSSE3/SSE4.1 encode dispatch is std
142+ runtime-probed only; any future ` no_std ` SIMD activation must require an explicit
137143 caller-side CPU contract or remain disabled where runtime probing is
138144 unavailable.
139145- ` runtime::require_backend_policy() ` allows deployments to enforce scalar
@@ -157,8 +163,8 @@ runtime behavior for that line.
157163 strings suitable for CI and audit logs.
158164- Unit tests compare dispatch behavior against the scalar reference for
159165 canonical inputs, malformed inputs, and undersized output buffers.
160- - The ` simd ` feature enables only the admitted std x86/x86_64 SSSE3/SSE4.1
161- encode path where runtime CPU probing succeeds.
166+ - The ` simd ` feature enables only the admitted std x86/x86_64 AVX2 and
167+ SSSE3/SSE4.1 encode paths where runtime CPU probing succeeds.
162168- Current ` 1.1 ` development keeps every non-admitted backend scalar or
163169 prototype-only unless the SIMD admission manifest, scalar differential tests,
164170 fuzz evidence, unsafe inventory, architecture evidence, benchmark evidence,
@@ -200,31 +206,32 @@ scripts/check_backend_evidence.sh
200206
201207This prints the runtime backend-report test and runs the gated SIMD
202208scalar-equivalence tests with ` --nocapture ` , so local CPU evidence is easy to
203- copy into release notes or issue discussion. On x86/x86_64 hosts with
209+ copy into release notes or issue discussion. On x86/x86_64 hosts with AVX2 or
204210SSSE3/SSE4.1, the runtime report may show admitted encode acceleration as
205- active. AVX2 and AVX-512 tests still exercise inactive fixed-block vector
206- encode prototypes against scalar output. On AArch64 NEON-capable hosts, the
211+ active. AVX-512 tests still exercise inactive fixed-block vector encode
212+ prototypes against scalar output. On AArch64 NEON-capable hosts, the
207213NEON test exercises the inactive fixed-block vector prototype for Standard and
208214URL-safe alphabets; 32-bit ARM remains scaffold evidence. The script also writes
209215` target/release-evidence/backend/MANIFEST.txt ` with toolchain metadata,
210216commands, status values, artifact checksums, and explicit
211217` prototype_state=real-non-dispatchable ` labels for prototype-only backends and
212- ` active_backend_admitted=ssse3-sse4.1-encode ` for the admitted encode backend.
218+ ` active_backend_admitted=avx2-or-ssse3-sse4.1-encode ` for admitted encode
219+ backends.
213220
214221Capture generated assembly evidence for x86 encode paths:
215222
216223``` sh
217224scripts/generate_simd_asm_evidence.sh
218225```
219226
220- The script emits release test-harness assembly for the admitted SSSE3/SSE4.1
221- encode path plus AVX2 and AVX-512 VBMI prototype feature bundles , then checks
222- for expected vector and cleanup instructions. AVX2 and AVX-512 remain review
223- evidence only; they do not activate runtime dispatch.
227+ The script emits release test-harness assembly for the admitted AVX2 and
228+ SSSE3/SSE4.1 encode paths plus the AVX-512 VBMI prototype feature bundle , then
229+ checks for expected vector and cleanup instructions. AVX-512 remains review
230+ evidence only; it does not activate runtime dispatch.
224231
225232## Required Before SIMD Code Lands
226233
227- Any AVX2, NEON, AVX-512, wasm ` simd128 ` , decode, custom alphabet, in-place, or
234+ Any NEON, AVX-512, wasm ` simd128 ` , decode, custom alphabet, in-place, or
228235additional runtime-dispatch implementation
229236must include:
230237
@@ -251,13 +258,13 @@ must include:
251258backends. The gate currently requires:
252259
253260- ` ActiveBackend ` to expose only ` Scalar ` plus the std x86/x86_64
254- SSSE3/SSE4.1 encode variant .
255- - ` active_backend() ` to return SSSE3/SSE4.1 only after std runtime CPU probing,
256- and scalar otherwise.
257- - No accelerated ` ActiveBackend::Avx * ` , ` ActiveBackend::Neon ` ,
261+ AVX2 and SSSE3/SSE4.1 encode variants .
262+ - ` active_backend() ` to return AVX2 before SSSE3/SSE4.1 only after std runtime
263+ CPU probing, and scalar otherwise.
264+ - No accelerated ` ActiveBackend::Avx512 * ` , ` ActiveBackend::Neon ` ,
258265 ` ActiveBackend::Wasm* ` , or generic SIMD dispatch variants in source.
259- - ` docs/SIMD_ADMISSION.md ` to record the admitted SSSE3/SSE4.1 encode scope
260- and keep all other backends prototype-only.
266+ - ` docs/SIMD_ADMISSION.md ` to record the admitted AVX2 and SSSE3/SSE4.1 encode
267+ scope and keep all other backends prototype-only.
261268- Documentation for benchmark evidence, release-note restrictions, and
262269 vector-register retention cleanup strategy to remain packaged.
263270- The encode admission draft to remain packaged and validated before any
@@ -278,7 +285,7 @@ remain pending.
278285- Scalar remains the fallback for every build.
279286- Candidate detection must not imply activation; a detected candidate may still
280287 execute scalar until the accelerated backend is admitted.
281- - The only active non-scalar backend in ` 1.1.6 ` is std x86/x86_64
288+ - The active non-scalar backends in ` 1.1.7 ` are std x86/x86_64 AVX2 encode and
282289 SSSE3/SSE4.1 encode for Standard and URL-safe alphabet families.
283290- Prototype functions may exercise target-feature and unsafe plumbing without
284291 being eligible for dispatch.
0 commit comments