[AMD] Improved error estimate for the matmul example #5571
+14
−10
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.
This PR addresses the issue related numerical accuracy of the matmul verification test in
03-matrix-multiplication.py
. Instead of the hard-codedatol
andrtol
numbers, the absolute error is taken as the forward error computed as:where is the Frobenius norm; is the output matrix; - -
float64
;float16
.Regarding Issue#5283, the accuracy-test is not failing now when the reference solution is computed using a CPU GEMM implementation (e.g.,
numpy
). Note, this was the issue before.The forward error stays the same on a system because we throw the same seed value before generating random matrices (see here). In my case, it is equal to
2.4012
which may seem quite high for some people. However, this value is the upper bound of the error relative to the quasi-accurate solution (double precision).The new approach was tested on MI300, MI200 and H100 GPUs with ✅ in all cases.
Closes #5283