PR #16520: [ROCM] ResetStream function for GemmAlgorithmPicker (BlasSupport interface) #17712
+61
−56
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.
PR #16520: [ROCM] ResetStream function for GemmAlgorithmPicker (BlasSupport interface)
Imported from GitHub PR #16520
Here I added ResetStream function which sets the underlying stream for cublas/rocblas libraries to default stream 0.
This is useful for GemmAlgorithmPicker which uses a temporary stream object for autotuning. In rocblas, rocblas_set_stream function is persistent, meaning that once the stream value is set, it will be used in all subsequent computations until new stream value is set.
In case of GemmAlgorithmPicker, we leave a destroyed stream object set into the math library. This does not produce any error behaviour but merely just a warning on ROCM side: "Stream Capture Check Failed".
With this new ResetStream function, one can reset the stream value in GemmAlgorithmPicker destructor. Potentially, it can also be useful in other places where temporary stream value is used.
Besides, I have also made some small code restructure for GemmAlgorithmPicker
@xla-rotation: could you have a look please?
Copybara import of the project:
--
2bd0cf2 by Pavel Emeliyanenko [email protected]:
set stream to null at the end of rocm_blas gemm function call
--
436d073 by Pavel Emeliyanenko [email protected]:
fixing buildbreaks
--
9347c71 by Pavel Emeliyanenko [email protected]:
added test for reset_stream
--
bb009b0 by Pavel Emeliyanenko [email protected]:
changed IsMainStreamSet interface
Merging this change closes #16520
FUTURE_COPYBARA_INTEGRATE_REVIEW=#16520 from ROCm:ci_blas_reset_stream bb009b0