-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fp8 support for MatMul on cuda #22698
Draft
amarin16
wants to merge
39
commits into
microsoft:main
Choose a base branch
from
amarin16:dev/amarin16/fp8
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+586
−2
Draft
Changes from 34 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
61c4cb0
add test skeleton and config option for cuda fp8
amarin16 f67ec74
update MatMul_float8E4M3FN
amarin16 36d403c
add initial cublasLtMatmul logic
amarin16 a0a43b1
Merge branch 'main' into HEAD
amarin16 dc84631
update logic
amarin16 967f174
update spacing
amarin16 7d2f528
Use min_cuda_architecture 900
amarin16 0328f94
create and use 1.0 scales instead of getting them from the input
amarin16 e2fd3c3
compute scale using model weights as float
amarin16 4936cd2
remove unnecessary span
amarin16 e63e597
small update
amarin16 ffbefc0
merge main
amarin16 97bf3f1
introduce ComputeScaleKernel
amarin16 35fc798
use kernel to compute scale
amarin16 d3b6685
use instantiation to get rid of runtime error
amarin16 ba18ef8
only keep needed instantiations
amarin16 46a4bd0
Merge branch 'main' into dev/amarin16/fp8
amarin16 c3a2434
small fixes
amarin16 784cffe
refator fp8 logic into separate function
amarin16 b3d7731
Specialize ComputeDefault for MLFloat16
amarin16 ba17d9c
remove template from kernel wrapper
amarin16 1e5326c
handle case when deviation is 0
amarin16 e723488
cublasLtMatmulAlgoGetHeuristic no longer returns error
amarin16 046c5dc
create fp8 tensors for left_X, right_X
amarin16 34cdd15
Add transpose kernel
amarin16 0b46a22
use cuda allocator, existing transpose kernel
amarin16 a2f8390
compute scale using fp16, copy to device and use it
amarin16 52fb51c
use DefaultCudaStream in PrePack
amarin16 f2176b7
update print, use CUDA_R8_F_E4MR for ADesc and BDesc
amarin16 1b64388
merge main
amarin16 1256074
cleanup
amarin16 926268b
fix cublasLtMatmulAlgoGetHeuristic result
amarin16 6c2b078
Merge branch 'main' into dev/amarin16/fp8
amarin16 07c91ae
update interface after merge
amarin16 2d28c7d
Add cublaSetStream call
amarin16 fe8f7b4
use CublasLtHandle() instead of cublasLtCreate()
amarin16 402ade6
use {2, 16} dimensions in test
amarin16 de23a1a
Merge branch 'main' into dev/amarin16/fp8
amarin16 ca2cc8f
use M=16, K=32, N=16 in test
amarin16 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -284,6 +284,12 @@ | |
// - "1": Gemm FastMath mode is enabled. | ||
static const char* const kOrtSessionOptionsMlasGemmFastMathArm64Bfloat16 = "mlas.enable_gemm_fastmath_arm64_bfloat16"; | ||
|
||
// Gemm fp8 mode provides fp16 gemm acceleration with float8E4M3FN based matmul. | ||
// Option values: | ||
// - "0": Gemm fp8 mode is not enabled. [DEFAULT] | ||
// - "1": Gemm fp8 mode is enabled. | ||
static const char* const kOrtSessionOptionsGemmCudaFloat8E4M3FN = "enable_gemm_cuda_float8E4M3FN"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is CUDA EP specific, should this be a generic session option or a CUDA EP provider option ? |
||
|
||
// When converting DQ + MatMul -> MatMulNBits, the accuracy level of the MatMulNBits is controlled by this option. | ||
// Refer to MatMulNBits op schema for more details. | ||
// If not provided, default is 4. | ||
|
Oops, something went wrong.
Oops, something went wrong.
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.
Check notice
Code scanning / CodeQL
Unused static variable Note