Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions aten/src/ATen/cuda/detail/CUDAHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@ const std::vector<std::string>& CUDAHooks::getHipblasltPreferredArchs() const {
#if ROCM_VERSION >= 70000
"gfx950",
#endif
#if ROCM_VERSION >= 71300
"gfx1100", "gfx1101", "gfx1151",
#endif
#if ROCM_VERSION >= 70200
"gfx1250"
#endif
Expand Down
16 changes: 12 additions & 4 deletions test/test_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,10 +681,18 @@ def _check_default():
self.assertTrue(default == torch._C._BlasBackend.Cublas)
else:
# ROCm logic is less so, it's cublaslt for some Instinct, cublas for all else
gcn_arch = str(
torch.cuda.get_device_properties(0).gcnArchName.split(":", 1)[0]
)
if gcn_arch in ["gfx90a", "gfx942", "gfx950", "gfx1200", "gfx1201", "gfx1250"]:
# Mirror CUDAHooks::getHipblasltPreferredArchs in CUDAHooks.cpp
ROCM_VERSION = tuple(int(v) for v in torch.version.hip.split(".")[:2])
archs = ["gfx90a", "gfx942"]
if ROCM_VERSION >= (6, 4):
archs.extend(["gfx1200", "gfx1201"])
if ROCM_VERSION >= (7, 0):
archs.append("gfx950")
if ROCM_VERSION >= (7, 13):
archs.extend(["gfx1100", "gfx1101", "gfx1151"])
gcn_arch_name = torch.cuda.get_device_properties(0).gcnArchName
hipblaslt_preferred = any(arch in gcn_arch_name for arch in archs)
if hipblaslt_preferred:
self.assertTrue(default == torch._C._BlasBackend.Cublaslt)
else:
self.assertTrue(default == torch._C._BlasBackend.Cublas)
Expand Down