Skip to content

DUMMY PR: add support for hpu in float8 base and compile test for torch ao #2326

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 1 commit into
base: main
Choose a base branch
from

Conversation

akansehl
Copy link

@akansehl akansehl commented Jun 6, 2025

No description provided.

Copy link

pytorch-bot bot commented Jun 6, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/2326

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot
Copy link
Contributor

Hi @akansehl!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Copy link

@ankurneog ankurneog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have given some general comments , I think we can refine it further, for skips lets use the if not supported_device()

@@ -239,11 +240,11 @@ def test_axiswise_reshape(self):
(ScalingGranularity.TENSORWISE, ScalingGranularity.AXISWISE),
],
)
@unittest.skipIf(not torch.cuda.is_available(), "CUDA not available")
@unittest.skipIf(not is_sm_at_least_90(), "Requires CUDA capability >= 9.0")
@unittest.skipIf(not torch.hpu.is_available() and not torch.cuda.is_available(), "Accelerator not available")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -272,7 +273,7 @@ def test_axiswise_gemm(self, a_shape, a_granularity, b_granularity):
sqnr = compute_error(c_ref, c_fp8_compute)
assert sqnr >= 25.0

@unittest.skipIf(not torch.cuda.is_available(), "CUDA not available")
@unittest.skipIf(not torch.hpu.is_available() and not torch.cuda.is_available(), "Accelerator not available")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -337,7 +338,7 @@ def _test_linear_impl(
@pytest.mark.parametrize("linear_dtype", [torch.bfloat16, torch.float32])
@pytest.mark.parametrize("linear_bias", [False, True])
@pytest.mark.parametrize("use_ac", [False, True])
@unittest.skipIf(not torch.cuda.is_available(), "CUDA not available")
@unittest.skipIf(not torch.hpu.is_available() and not torch.cuda.is_available(), "Accelerator not available")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -379,23 +380,23 @@ def test_linear_from_config_params(
)
@pytest.mark.parametrize("x_shape", [(16, 16), (2, 16, 16), (3, 2, 16, 16)])
@pytest.mark.parametrize("linear_bias", [True, False])
@unittest.skipIf(not torch.cuda.is_available(), "CUDA not available")
@unittest.skipIf(not torch.hpu.is_available() and not torch.cuda.is_available(), "Accelerator not available")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -409,32 +410,32 @@ def test_linear_from_recipe(
@pytest.mark.parametrize(
"linear_dtype", [torch.float16, torch.bfloat16, torch.float32]
)
@unittest.skipIf(not torch.cuda.is_available(), "CUDA not available")
@unittest.skipIf(not torch.hpu.is_available() and not torch.cuda.is_available(), "Accelerator not available")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -590,8 +592,9 @@ def test_different_configs_error(self):
a @ b

@unittest.skipIf(
not torch.hpu.is_available() and

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -681,7 +684,7 @@ class TestNumerics:
torch.float8_e5m2fnuz,
],
)
@unittest.skipIf(not torch.cuda.is_available(), "CUDA not available")
@unittest.skipIf(not torch.hpu.is_available() and not torch.cuda.is_available(), "Accelerator not available")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -88,7 +90,7 @@ def _test_compile_base(
)
@pytest.mark.parametrize("emulate", [False, True] if is_sm_at_least_89() else [True])
@pytest.mark.parametrize("dtype", [torch.bfloat16, torch.float32])
@unittest.skipIf(not torch.cuda.is_available(), "CUDA not available")
@unittest.skipIf(not torch.hpu.is_available() and not torch.cuda.is_available(), "Accelerator not available")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -124,7 +126,7 @@ def test_eager_only(
[ScalingType.DYNAMIC],
)
@pytest.mark.parametrize("dtype", [torch.bfloat16, torch.float32])
@unittest.skipIf(not torch.cuda.is_available(), "CUDA not available")
@unittest.skipIf(not torch.hpu.is_available() and not torch.cuda.is_available(), "Accelerator not available")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

torch.finfo = wrap_torch_finfo


def supported_device_available():

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the skips you can use this as well, in conjunction to this can use the accelerator APIs directly : https://docs.pytorch.org/docs/stable/generated/torch.accelerator.is_available.html
eg:
supported accelerator:
if torch.accelerator.is_available() :
if hpu or cuda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants