[Hipblastl][tensilelite] Speed up AlmostEqual#4909
Merged
Alex-Vasile merged 1 commit intodevelopfrom Mar 2, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (76.88%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #4909 +/- ##
========================================
Coverage 66.18% 66.18%
========================================
Files 1742 1742
Lines 269819 269819
Branches 37507 37507
========================================
Hits 178577 178577
Misses 75570 75570
Partials 15672 15672
*This pull request uses carry forward flags. Click here to find out more. 🚀 New features to boost your workflow:
|
74b1745 to
8cd9c60
Compare
carsonbrownlee
approved these changes
Feb 27, 2026
8cd9c60 to
7abee7c
Compare
perfci run on commit cb6bbf6 |
Signed-off-by: Alex Vasile <48962821+Alex-Vasile@users.noreply.github.com>
7abee7c to
26f5b04
Compare
perfci run on commit 6601702 |
bstefanuk
approved these changes
Mar 2, 2026
assistant-librarian bot
pushed a commit
to ROCm/hipBLASLt
that referenced
this pull request
Mar 2, 2026
[Hipblastl][tensilelite] Speed up AlmostEqual ## Motivation Current Implementation of AlmostEquals stores intermediary results back in input datatypes (e.g. Half or Float8) which are not natively supported by cpus. This results in a lot of conversions back and forth within the the hot loop of ReferenceValidator.cpp. So much so, that for several Tensile yaml files, this comparison function **ends up taking more time than the reference gemm calculation**. This part 1 of 2. Follow up PR will focus on restructuring to be able to vectorize and unroll the hot loop. Also, not all tests were correctly handling infinity and nan checks. ## Technical Details The current implementations keep intermediary results in input format (e.g. Half) which is not natively supported by CPUs. This introduces a lot of extra conversions for each calculation. For all non-native dtypes, cast them to float (which is big enough for their precision and range) and perform all operations with floats. Now all types which represent inf and nan will handle these cases correctly using the first part of the check (`a == b || <abs_diff_check>`). ## Test Plan 1. Run current tests. 2. Add extensive testing of current implementation. ## Test Result Passing tests ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests. Signed-off-by: Alex Vasile <48962821+Alex-Vasile@users.noreply.github.com>
kokolchin
pushed a commit
to kokolchin/rocm-libraries
that referenced
this pull request
Mar 4, 2026
## Motivation Current Implementation of AlmostEquals stores intermediary results back in input datatypes (e.g. Half or Float8) which are not natively supported by cpus. This results in a lot of conversions back and forth within the the hot loop of ReferenceValidator.cpp. So much so, that for several Tensile yaml files, this comparison function **ends up taking more time than the reference gemm calculation**. This part 1 of 2. Follow up PR will focus on restructuring to be able to vectorize and unroll the hot loop. Also, not all tests were correctly handling infinity and nan checks. ## Technical Details The current implementations keep intermediary results in input format (e.g. Half) which is not natively supported by CPUs. This introduces a lot of extra conversions for each calculation. For all non-native dtypes, cast them to float (which is big enough for their precision and range) and perform all operations with floats. Now all types which represent inf and nan will handle these cases correctly using the first part of the check (`a == b || <abs_diff_check>`). ## Test Plan 1. Run current tests. 2. Add extensive testing of current implementation. ## Test Result Passing tests ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests. Signed-off-by: Alex Vasile <48962821+Alex-Vasile@users.noreply.github.com>
NaveenElumalaiAMD
pushed a commit
that referenced
this pull request
Mar 6, 2026
## Motivation Current Implementation of AlmostEquals stores intermediary results back in input datatypes (e.g. Half or Float8) which are not natively supported by cpus. This results in a lot of conversions back and forth within the the hot loop of ReferenceValidator.cpp. So much so, that for several Tensile yaml files, this comparison function **ends up taking more time than the reference gemm calculation**. This part 1 of 2. Follow up PR will focus on restructuring to be able to vectorize and unroll the hot loop. Also, not all tests were correctly handling infinity and nan checks. ## Technical Details The current implementations keep intermediary results in input format (e.g. Half) which is not natively supported by CPUs. This introduces a lot of extra conversions for each calculation. For all non-native dtypes, cast them to float (which is big enough for their precision and range) and perform all operations with floats. Now all types which represent inf and nan will handle these cases correctly using the first part of the check (`a == b || <abs_diff_check>`). ## Test Plan 1. Run current tests. 2. Add extensive testing of current implementation. ## Test Result Passing tests ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests. Signed-off-by: Alex Vasile <48962821+Alex-Vasile@users.noreply.github.com>
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.
Motivation
Current Implementation of AlmostEquals stores intermediary results back in input datatypes (e.g. Half or Float8) which are not natively supported by cpus.
This results in a lot of conversions back and forth within the the hot loop of ReferenceValidator.cpp. So much so, that for several Tensile yaml files, this comparison function ends up taking more time than the reference gemm calculation.
This part 1 of 2. Follow up PR will focus on restructuring to be able to vectorize and unroll the hot loop.
Also, not all tests were correctly handling infinity and nan checks.
Technical Details
The current implementations keep intermediary results in input format (e.g. Half) which is not natively supported by CPUs. This introduces a lot of extra conversions for each calculation.
For all non-native dtypes, cast them to float (which is big enough for their precision and range) and perform all operations with floats.
Now all types which represent inf and nan will handle these cases correctly using the first part of the check (
a == b || <abs_diff_check>).Test Plan
Test Result
Passing tests
Submission Checklist