SWDEV-374402 - Added check for invalid events in hipExtLaunchKernel
Change-Id: I8dfd69aa1ef38971a72b98c723d2099347a66d11
此提交包含在:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
新增問題並參考
封鎖使用者