Optimizing NRM2 & I_AMAX kernel for x86-64 in Rust

1 minute read

The nrm2 and i_amax kernels compute the Euclidean distance between vectors and finds the index of the maximum absolute value, respectively. The SIMD implementation is straight-forward, but with few caveats to consider, for nrm2, we need to handle overflow and for i_amax, vectorizing the stupid scalar loop is… fragile?, given with few notable edge cases.