inductor_utils.py 507 B

1234567891011121314151617181920212223
  1. from subprocess import CalledProcessError
  2. from torch._inductor.codecache import CppCodeCache
  3. from torch._inductor.utils import has_triton
  4. from torch.testing._internal.common_utils import (
  5. IS_FBCODE,
  6. TEST_WITH_ROCM,
  7. )
  8. import torch
  9. HAS_CPU = False
  10. try:
  11. CppCodeCache.load("")
  12. HAS_CPU = not IS_FBCODE
  13. except (
  14. CalledProcessError,
  15. OSError,
  16. torch._inductor.exc.InvalidCxxCompiler,
  17. torch._inductor.exc.CppCompileError,
  18. ):
  19. pass
  20. HAS_CUDA = has_triton() and not TEST_WITH_ROCM