调用aclrtRecordEvent接口在Stream中记录一个Event时,日志中存在报错信息,关键日志信息如下,提示Event ID申请失败:
[ERROR] DRV ******[devdrv][drvEventIdAlloc 647] error. [ERROR] RUNTIME ****** EventIdAlloc:drvEventIdAlloc:errorcode = 7 [INFO] RUNTIME EventIdAlloc:id = -1
分析上述日志信息,可能存在以下故障原因:Event ID的数量超过上限。
多Stream之间同步等待的场景下,Event ID的资源是可以复用的,复用Event ID的流程是:在调用aclrtRecordEvent接口+aclrtStreamWaitEvent接口后,若指定的Event已完成,则需要及时调用aclrtResetEvent接口释放Event资源。
需要用户按照复用Event ID的流程优化代码逻辑。