-
Notifications
You must be signed in to change notification settings - Fork 294
Pre-swizzle scale data. #1042
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
Merged
Merged
Pre-swizzle scale data. #1042
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d22d754
Kind of works...
sdquiring 0da55c6
Might work?
sdquiring 6886ac4
Pass swizzling info into API and verify that it matches the KernelOpt…
sdquiring ab31ae3
Merge branch 'develop' of github.com:ROCm/rocm-libraries into users/s…
sdquiring 24836e4
Revert to single option (not A/B separate) for now.
sdquiring 755dd91
Code cleanup.
sdquiring c2c5e98
Fix formatting.
sdquiring f56d05d
Code cleanup.
sdquiring fae56dc
Code cleanup.
sdquiring 109a0ee
Update CMakeLists with new files.
sdquiring 85b0dc7
Move to vector for serialization simplicity.
sdquiring 2cc72a2
Merge branch 'develop' of github.com:ROCm/rocm-libraries into users/s…
sdquiring b68b405
Don't include invalid kernels.
sdquiring aadc196
Merge branch 'develop' of github.com:ROCm/rocm-libraries into users/s…
sdquiring 23a1d1e
Fix GEMM client test.
sdquiring b36c6c4
Address review feedback.
sdquiring e2d7e8d
Merge branch 'develop' of github.com:ROCm/rocm-libraries into users/s…
sdquiring f09ce99
Fix test across different archs.
sdquiring 8899c32
Merge branch 'develop' of github.com:ROCm/rocm-libraries into users/s…
sdquiring 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| /******************************************************************************* | ||
| * | ||
| * MIT License | ||
| * | ||
| * Copyright 2024-2025 AMD ROCm(TM) Software | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| * | ||
| *******************************************************************************/ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <vector> | ||
|
|
||
| #include <rocRoller/TensorDescriptor.hpp> | ||
|
|
||
| #include <client/GEMMParameters.hpp> | ||
|
|
||
| namespace rocRoller::Client | ||
| { | ||
|
|
||
| template <typename T> | ||
| inline std::vector<T> preSwizzle(std::vector<T> const& input, | ||
| TensorDescriptor const& desc, | ||
| std::vector<size_t> const& tile) | ||
| { | ||
| AssertFatal(tile.size() == 3, ShowValue(tile.size()), ShowValue(tile)); | ||
| AssertFatal(desc.dimensions() == 2, | ||
| "Batch dimension not yet supported.", | ||
| ShowValue(desc.dimensions()), | ||
| ShowValue(desc)); | ||
| AssertFatal(desc.totalAllocatedElements() == input.size(), | ||
| ShowValue(desc), | ||
| ShowValue(input.size())); | ||
|
|
||
| auto tileMN = tile[0]; | ||
| auto tileK = tile[1]; | ||
| auto subTileK = tile[2]; | ||
|
|
||
| size_t instPerTileK = tileK / subTileK; | ||
| size_t instKPerTileMN = tileMN / subTileK; | ||
|
|
||
| std::vector<size_t> srcSizes = {subTileK, | ||
| instPerTileK, | ||
| desc.size(0) / (tileK), | ||
| instKPerTileMN, | ||
| subTileK, | ||
| desc.size(1) / (tileMN)}; | ||
|
|
||
| TensorDescriptor src(desc.dataType(), srcSizes); | ||
|
|
||
| AssertFatal(src.totalAllocatedElements() == desc.totalAllocatedElements(), | ||
| ShowValue(src.totalAllocatedElements()), | ||
| ShowValue(desc.totalAllocatedElements()), | ||
| ShowValue(src.totalAllocatedElements() / desc.totalAllocatedElements()), | ||
| ShowValue(src), | ||
| ShowValue(desc)); | ||
|
|
||
| auto dst | ||
| = TensorDescriptor::ShuffledNoPadding(desc.dataType(), srcSizes, {4, 1, 2, 3, 0, 5}); | ||
|
|
||
| AssertFatal(src.totalAllocatedElements() == dst.totalAllocatedElements(), | ||
| ShowValue(src.totalAllocatedElements()), | ||
| ShowValue(dst.totalAllocatedElements()), | ||
| ShowValue(src), | ||
| ShowValue(dst)); | ||
|
|
||
| return shuffleDims(input, dst, src); | ||
| } | ||
|
|
||
| } |
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
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.