Repository navigation
[CUDA] Add opt-in direct scales for FP16 group-32 MatMulNBits M=1 #33586
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
Saiyam Bharara (saiyambharara)
wants to merge
6
commits into
microsoft:main
Choose a base branch
from
saiyambharara:perf/32382-direct-scales
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.
+408
−40
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
71e1dac
CUDA: add opt-in direct scales for group-32 MatMulNBits M=1
saiyambharara 31b2079
CUDA: apply provider math-header workaround to kernel tests
saiyambharara af5c14f
Fix CUDA test build flags and exercise MatMul4Bits M1 modes in CI
saiyambharara ffdd3fd
Isolate CUDA kernel tests and verify MatMul4Bits M1 dispatch
saiyambharara 39f906b
Pin SentencePiece to restore transformer CI compatibility
saiyambharara e04e0d9
Keep upstream Pillow pin alongside SentencePiece fix
saiyambharara 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 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
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
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
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
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
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
42 changes: 42 additions & 0 deletions
42
onnxruntime/test/contrib_ops/cuda_kernels/matmul_4bits_m1_test.cc
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #include <string> | ||
|
|
||
| #include <cuda_runtime_api.h> | ||
|
|
||
| #include "gtest/gtest.h" | ||
|
|
||
| namespace onnxruntime::cuda::test { | ||
|
|
||
| std::string CompareMatMul4BitsM1DirectScales(int max_unroll, int k, int n, int pattern); | ||
|
|
||
| namespace { | ||
|
|
||
| template <int MaxUnroll> | ||
| void TestDirectScales() { | ||
| int device_count = 0; | ||
| if (cudaGetDeviceCount(&device_count) != cudaSuccess || device_count == 0) { | ||
| GTEST_SKIP() << "CUDA device unavailable"; | ||
| } | ||
| const auto compare = [](int k, int n, int pattern) { | ||
| SCOPED_TRACE(::testing::Message() << "K=" << k << ", N=" << n << ", pattern=" << pattern); | ||
| EXPECT_EQ("", CompareMatMul4BitsM1DirectScales(MaxUnroll, k, n, pattern)); | ||
| }; | ||
| for (int k : {8, 264, 1032, 3072, 4088, 4096, 4104, 8192}) { | ||
| compare(k, 24, 0); | ||
| } | ||
| compare(3072, 1024, 0); | ||
| compare(3072, 24, 1); | ||
| } | ||
|
|
||
| TEST(CUDA_EP_Unittest, MatMul4BitsM1DirectScalesUnroll4) { | ||
| TestDirectScales<4>(); | ||
| } | ||
|
|
||
| TEST(CUDA_EP_Unittest, MatMul4BitsM1DirectScalesUnroll16) { | ||
| TestDirectScales<16>(); | ||
| } | ||
|
|
||
| } // namespace | ||
| } // namespace onnxruntime::cuda::test |
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.
Uh oh!
There was an error while loading. Please reload this page.