[GraphTrainer] Enhance FP8 region compilation - #3989
Conversation
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows. |
6b98299 to
ca8a3c2
Compare
Only full inductor supported for now
ca8a3c2 to
37d7991
Compare
|
Removed the cudagraph restriction in previous implementation, now we can turn on cudagraph for fp8 nodes in GraphTrainer.
|
tianyu-l
left a comment
There was a problem hiding this comment.
seems not graph trainer only
Added QuantizationSignature for precompile to avoid using old cache when the quantization config changes, but it does seem to carry some other signatures unrelated to quantization, and precompile with fp8 has not been well tested yet. |
e66c42a to
37d7991
Compare
|
Refactored in #4384 |
Summary
Add opt-in FP8 support to GraphTrainer for already-quantized TorchAO modules.
The implementation:
backward-weight partitioning;
Design
Quantized modules annotate traced nodes with their module FQN, quantization kind,
and emulation mode. The FP8 passes use this provenance together with actual FP8
operand dtypes to distinguish supported
_scaled_mmcompute from unrelatedscaled operations.
For regional Inductor, FP8 components are identified after graph rewrites and
tagged only when the identified component is complete. GraphPP first validates
the complete stage joint graph, then re-identifies regions independently in
each extracted callable.
GraphPP may produce shared FP8 quantization in the backward-input graph and pass
the quantized tensor into the backward-weight graph. Such FP8 placeholders are
treated as valid callable boundaries, allowing the local
_scaled_mmregion tobe compiled without duplicating quantization work.
Strict validation detects missing provenance or unsupported lowering instead of
silently falling back to eager execution. Emulated Float8Linear modules are
exempt from the
_scaled_mmrequirement because they intentionally usehigher-precision compute.
Current limitations
cudagraph_passmust bedisabled.
Inductor should be used for those graphs.
remains follow-up work.
Testing