MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / simd_width

Method simd_width

op_builder/builder.py:447–462  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

445 return hwcap is not None and hwcap & (1 << (ord('V') - ord('A'))) != 0 # COMPAT_HWCAP_ISA_V
446
447 def simd_width(self):
448 arch, flags = _cpu_info()
449 if arch == 'X86_64':
450 if 'avx512f' in flags:
451 return '-D__AVX512__'
452 elif 'avx2' in flags:
453 return '-D__AVX256__'
454 elif (arch or '').startswith('ARM') and 'sve' in flags:
455 return '-D__SVE__'
456 elif arch == 'ARM_8':
457 # NEON is baseline on AArch64; vdivq/vsqrtq used by simd.h are A64-only,
458 # so do not advertise it for 32-bit ARM.
459 return '-D__NEON__'
460 elif arch == 'RISCV_64' and self._riscv_has_vector():
461 return '-D__RVV__'
462 return '-D__SCALAR__'
463
464 def warning(self, msg):
465 self.error_log = f"{msg}"

Calls 2

_riscv_has_vectorMethod · 0.95
_cpu_infoFunction · 0.85