Skip to content

test_dtensor.py (float8 TP compile): aten.abs.default NotImplemented on Float8TrainingTensor after removing allow-in-graph autograd wrappers #4864

Description

@github-actions

Commits affected: ca7488145beeda7416ceee0db43eb6f5124b2ebc
Run: https://github.com/pytorch/ao/actions/runs/33666967452

Summary

_test_fp8_mlp_tensor_parallelism_compile in test/float8/test_dtensor.py fails at inductor compile time with NotImplementedError: attempting to run aten.abs.default, this is not supported, raised from Float8TrainingTensor.__torch_dispatch__. Routing the Float8 autograd.Function classes through the standard Dynamo AutogradFunctionApply HOP (this commit) causes the backward to be retraced via make_fx, and torch.abs in the amax computation now dispatches onto a Float8TrainingTensor, which has no abs handler.

Failure details

  • Failed job(s) (both fail identically, deterministically):
    • test (H100, mt-l-x86iamx-88-900-h100-4, --pre torch torchvision --index-url .../nightly/cu126)
    • test (H100 2.13, mt-l-x86iamx-88-900-h100-4, torch==2.13.0 torchvision==0.28.0 --index-url .../cu126)
  • Test step: ./test/float8/test_everything_multi_gpu.sh → test/float8/test_dtensor.py FAILED (torchrun ChildFailedError, exit code 1). Preceding subtests (✅ All Tests Passed ✅) pass; the failure is isolated to the compile TP dtensor test.
  • Representative error:
    Test _test_fp8_mlp_tensor_parallelism_compile failed with error: backend='inductor' raised:
    NotImplementedError: attempting to run aten.abs.default, this is not supported
    
    While executing %abs_1 : [num_users=1] = call_function[target=torch.abs](args = (%grad_output_reshaped,), kwargs = {})
    
  • Dispatch chain (from the original traceback):
    • torchao/float8/float8_linear.py:112 backward → hp_tensor_to_float8_dynamic
    • torchao/float8/float8_scaling_utils.py:56 → tensor_to_scale
    • torchao/float8/float8_utils.py:106 tensor_to_scale → tensor_to_amax
    • torchao/float8/float8_utils.py:65 tensor_to_amax → amax = torch.max(torch.abs(x))
    • raised at torchao/float8/float8_training_tensor.py:373 __torch_dispatch__: raise NotImplementedError(f"attempting to run {func}, this is not supported")
  • Compile-time framing: the backward runs under torch._functorch.autograd_function.backward → torch.fx.Interpreter(bwd).run(...) during AOTAutograd make_fx tracing, i.e. the op executes against the Float8 subclass while retracing, not during normal eager backward.

Root cause

Commit ca74881 ("Remove Float8 allow-in-graph custom autograd wrappers") routes the four Float8 autograd.Function classes through the standard Dynamo AutogradFunctionApply higher-order op instead of the previous allow-in-graph trampoline. Under torch.compile + DTensor tensor parallelism, the backward is now captured and retraced by make_fx/FX Interpreter. During that retrace, tensor_to_amax's torch.abs(grad_output_reshaped) is dispatched onto a Float8TrainingTensor, whose __torch_dispatch__ only services ops present in FLOAT8_OPS_TABLE; aten.abs.default is not registered there, so it raises NotImplementedError and inductor compilation fails.

Evidence this is a regression introduced by this commit (not flaky/infra):

  • The immediately preceding 4xH100 run on main (parent commit a195aaf8a2da5b8496018d39e5261e93d01fb0ca, run 33632094558) and the prior 7 runs of this workflow were all green.
  • The failing code path — Float8 autograd backward tracing through the HOP — is exactly what this commit changed.
  • The failure is deterministic and reproduces identically on both the torch-nightly and torch-2.13.0 matrix legs, ruling out a per-run flake or a single-nightly toolchain change.

Classification

real regression — a deterministic compile-time failure in the exact code path modified by the triggering commit, green on the parent commit and reproducing on both matrix legs. Not intermittent (so not a flaky test) and not an environment/toolchain issue (so not infra).

Suggested fix

  • In Float8TrainingTensor's op table (torchao/float8/float8_ops.py / float8_training_tensor.py), the abs/amax path taken during HOP-based backward retracing needs to resolve against the underlying high-precision tensor rather than the subclass. Options:
    • Have tensor_to_amax/tensor_to_scale operate on the plain (dequantized/underlying) tensor data so torch.abs/torch.max never dispatch onto Float8TrainingTensor during retrace; or
    • Register aten.abs.default (and any other amax-path ops surfaced) in FLOAT8_OPS_TABLE to delegate to the underlying data.
  • Add a regression test that compiles the Float8 backward through the AutogradFunctionApply HOP path (the TP-compile dtensor scenario) so this is caught pre-merge.
  • If a fix is not immediately available, consider reverting ca74881's autograd-wrapper change or gating it until the amax dispatch under retrace is handled.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ci-failureAutomated report of CI failure on main

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions