Skip to content

Enhance test_autoquant_compile to support ROCm #2100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
28 changes: 20 additions & 8 deletions test/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1593,15 +1593,27 @@ def test_autoquant_one_input(self, device, dtype, m, k, n):
@unittest.skipIf(not TORCH_VERSION_AT_LEAST_2_5, "autoquant requires 2.5+.")
def test_autoquant_compile(self, device, dtype, m1, m2, k, n):
undo_recommended_configs()
if device != "cuda" or not torch.cuda.is_available():

is_supported_device = device == "cuda" and (
torch.cuda.is_available() or torch.version.hip is not None
)

if not is_supported_device:
self.skipTest(f"autoquant currently does not support {device}")
if torch.cuda.is_available() and torch.cuda.get_device_capability() < (8, 0):
if dtype == torch.bfloat16:
self.skipTest("bfloat16 requires sm80+")
if m1 == 1 or m2 == 1:
self.skipTest(f"Shape {(m1, m2, k, n)} requires sm80+")
# This test fails on v0.4.0 and torch 2.4, so skipping for now.
if m1 == 1 or m2 == 1 and not TORCH_VERSION_AT_LEAST_2_5:

# Check CUDA-specific requirements if running on CUDA
if (
is_supported_device and torch.version.hip is None
): # Only apply to CUDA, not ROCm
device_capability = torch.cuda.get_device_capability()
if device_capability < (8, 0):
if dtype == torch.bfloat16:
self.skipTest("bfloat16 requires sm80+")
if m1 == 1 or m2 == 1:
self.skipTest(f"Shape {(m1, m2, k, n)} requires sm80+")

# Skip certain shapes on older PyTorch versions
if (m1 == 1 or m2 == 1) and not TORCH_VERSION_AT_LEAST_2_5:
self.skipTest(f"Shape {(m1, m2, k, n)} requires torch version > 2.4")
model = (
torch.nn.Sequential(
Expand Down
Loading