Utils.h 922 B

12345678910111213141516171819202122232425262728
  1. #if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
  2. #pragma once
  3. #include <string>
  4. #include <unordered_map>
  5. #include <ATen/core/ivalue.h>
  6. #include <c10/macros/Export.h>
  7. namespace at::cpu {
  8. // Returns a map of CPU capabilities detected at runtime via cpuinfo.
  9. // Keys are capability names (e.g., "avx2", "neon"), values are bools
  10. // for ISA flags, integers for cache sizes/core counts, or strings
  11. // for architecture/CPU name.
  12. TORCH_API std::unordered_map<std::string, c10::IValue> get_cpu_capabilities();
  13. // Detect if CPU supports AVX512 Vector Neural Network Instructions.
  14. TORCH_API bool is_avx512_vnni_supported();
  15. // Enable the system to use AMX instructions.
  16. TORCH_API bool init_amx();
  17. } // namespace at::cpu
  18. #else
  19. #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
  20. #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)