Repository navigation
Honor e4m3_dtype/e5m2_dtype in Fp8DirectDotGeneralOp and Fp8Einsum - #5653
Open
vineethsaivs wants to merge 1 commit into
Open
vineethsaivs wants to merge 1 commit into
vineethsaivs wants to merge 1 commit into
Conversation
Both ops inherit e4m3_dtype and e5m2_dtype from Fp8DotGeneralBase, but fp8_scaled_dot_general hardcoded float8_e4m3fn for the inputs and quantized_dot's backward hardcoded float8_e5m2 for the output grad. A NANOO config (e4m3fnuz/e5m2fnuz) was accepted and silently ran with the OCP formats. Thread both dtypes through fp8_scaled_dot_general and quantized_dot, with defaults that keep existing callers unchanged.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fp8DirectDotGeneralOp(nn.Fp8DotGeneral) andFp8Einsumaccepte4m3_dtypeande5m2_dtypefromFp8DotGeneralBasebut ignore them.fp8_scaled_dot_generalhardcodesfloat8_e4m3fnfor the inputs, and thequantized_dotbackward hardcodesfloat8_e5m2for the output grad. So a NANOO config (e4m3fnuz/e5m2fnuz) runs with the OCP formats and nothing raises. Only the deprecatedFp8DotGeneralOpreads the fields.This threads both dtypes through
fp8_scaled_dot_generalandquantized_dot. The defaults keep existing callers unchanged.The new test
test_fp8_direct_ops_honor_fp8_dtypescovers both ops. On main the new input and kernel scales are 4/448 = 0.00892857 instead of 4/240 = 0.01666667, and dx is 0 instead of3 * 2**-17. All 13Fp8tests pass with the fix.Fixes # (none)
Checklist