rocr: Allow 0/NULL/invalid signal handles for wait operations to be no-op

Remove hard assertions for signal validation on hsa_amd_signal_wait_* operations, instead ignore 0/NULL/invalid signals in the dependency condition evaluation to align with HSA specs for barrier-AND and barrier-OR packets.

Signed-off-by: zichguan-amd <zichuan.guan@amd.com>
This commit is contained in:
zichguan-amd
2025-03-04 11:38:51 -05:00
committed by Guan, Zichuan
parent 02b38d0614
commit e4d027191c
2 changed files with 59 additions and 21 deletions
+9 -5
View File
@@ -1209,8 +1209,9 @@ hsa_status_t HSA_API
* @details Allows waiting for all of several signal and condition pairs to be
* satisfied. The function returns 0 if all signals met their conditions and -1
* on a timeout. The value of each signal's satisfying value is returned in
* satisfying_value unless satisfying_value is nullptr. This function provides
* only relaxed memory semantics.
* satisfying_value unless satisfying_value is nullptr. NULL and invalid signals
* are considered to have value 0 and their conditions already satisfied. This
* function provides only relaxed memory semantics.
*/
uint32_t HSA_API hsa_amd_signal_wait_all(uint32_t signal_count, hsa_signal_t* signals,
hsa_signal_condition_t* conds, hsa_signal_value_t* values,
@@ -1222,9 +1223,12 @@ uint32_t HSA_API hsa_amd_signal_wait_all(uint32_t signal_count, hsa_signal_t* si
*
* @details Allows waiting for any of several signal and conditions pairs to be
* satisfied. The function returns the index into the list of signals of the
* first satisfying signal-condition pair. The value of the satisfying signal's
* value is returned in satisfying_value unless satisfying_value is NULL. This
* function provides only relaxed memory semantics.
* first satisfying signal-condition pair. The function returns
* std::numeric_limits<uint32_t>::max() if no valid signal is provided. The value
* of the satisfying signal's value is returned in satisfying_value, unless
* satisfying_value is nullptr or there's no valid signal in the signal-condition
* pairs. NULL and invalid signals are ignored. This function provides only
* relaxed memory semantics.
*/
uint32_t HSA_API
hsa_amd_signal_wait_any(uint32_t signal_count, hsa_signal_t* signals,