SWDEV-374402 - Added check for invalid events in hipExtLaunchKernel

Change-Id: I8dfd69aa1ef38971a72b98c723d2099347a66d11
此提交包含在:
Ioannis Assiouras
2022-12-20 17:38:26 +00:00
父節點 845bf0adb4
當前提交 b83271b4ca
共有 3 個檔案被更改,包括 17 行新增1 行删除
+15
查看文件
@@ -260,6 +260,21 @@ hipError_t Event::addMarker(hipStream_t stream, amd::Command* command, bool reco
return status;
}
// ================================================================================================
bool isValid(hipEvent_t event) {
// NULL event is always valid
if (event == nullptr) {
return true;
}
amd::ScopedLock lock(eventSetLock);
if (eventSet.find(event) == eventSet.end()) {
return false;
}
return true;
}
} // namespace hip
// ================================================================================================
hipError_t ihipEventCreateWithFlags(hipEvent_t* event, unsigned flags) {
+1
查看文件
@@ -516,6 +516,7 @@ namespace hip {
int getDeviceID(amd::Context& ctx);
/// Check if stream is valid
extern bool isValid(hipStream_t& stream);
extern bool isValid(hipEvent_t event);
extern amd::Monitor hipArraySetLock;
extern std::unordered_set<hipArray*> hipArraySet;
}; // namespace hip
+1 -1
查看文件
@@ -497,7 +497,7 @@ extern "C" hipError_t hipExtLaunchKernel(const void* hostFunction, dim3 gridDim,
HIP_INIT_API(hipExtLaunchKernel, hostFunction, gridDim, blockDim, args, sharedMemBytes,
stream, startEvent, stopEvent, flags);
if (!hip::isValid(stream)) {
if (!hip::isValid(stream) || !hip::isValid(startEvent) || !hip::isValid(stopEvent)) {
HIP_RETURN(hipErrorInvalidValue);
}