okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
d39d20f52
main
1// tools/vision/own/cpu_ops.cpp - the dispatcher of the CPU tower's kernel tiers and the tiers' out-of-line library helpers (ISA-neutral, no special compile flags) 2#include "cpu_kernels.h" 3 4#include <cmath> 5#include <cstdlib> 6 7namespace strata_vit { 8 9const CpuOps & cpu_ops (quant::Isa isa ) { 10if (isa == quant::Isa ::Neon )return quant::isa_ok (quant::Isa ::Neon ) ?cpu_ops_neon () :cpu_ops_scalar (); 11if (isa == quant::Isa ::Avx512 && quant::isa_ok (quant::Isa ::Avx512 ))return cpu_ops_avx512 (); 12if (isa >= quant::Isa ::Avx2 && quant::isa_ok (quant::Isa ::Avx2 ))return cpu_ops_avx2 ();// (Neon was handled above: it ranks outside x86) 13if (isa >= quant::Isa ::Avx && quant::isa_ok (quant::Isa ::Avx ))return cpu_ops_avx (); 14if (isa >= quant::Isa ::Sse41 && quant::isa_ok (quant::Isa ::Sse41 ))return cpu_ops_sse41 (); 15return cpu_ops_scalar (); 16} 17 18float cpu_tier_expf (float x ) {return std::exp (x ); } 19 20bool cpu_tier_one_vector_tail () { 21static const bool on = [] {const char * e = std::getenv ("STRATA_VIT_CPU_TAIL1" );return !(e && std::atoi (e )== 0 ); }(); 22return on ; 23} 24 25}// namespace strata_vit