|
18 | 18 | #include <chrono> |
19 | 19 | #include <limits> |
20 | 20 | #include <memory> |
| 21 | +#include <mutex> |
21 | 22 | #include <vector> |
22 | 23 |
|
23 | 24 | struct _ze_event_handle_t {}; |
@@ -206,12 +207,24 @@ struct Event : _ze_event_handle_t { |
206 | 207 | uint32_t getMaxKernelCount() const { |
207 | 208 | return maxKernelCount; |
208 | 209 | } |
209 | | - void setKernelForPrintf(Kernel *inputKernelPtr) { |
210 | | - kernelWithPrintf = inputKernelPtr; |
| 210 | + void setKernelForPrintf(std::weak_ptr<Kernel> inputKernelWeakPtr) { |
| 211 | + kernelWithPrintf = inputKernelWeakPtr; |
211 | 212 | } |
212 | | - Kernel *getKernelForPrintf() { |
| 213 | + std::weak_ptr<Kernel> getKernelForPrintf() { |
213 | 214 | return kernelWithPrintf; |
214 | 215 | } |
| 216 | + void resetKernelForPrintf() { |
| 217 | + kernelWithPrintf.reset(); |
| 218 | + } |
| 219 | + void setKernelWithPrintfDeviceMutex(std::mutex *mutexPtr) { |
| 220 | + kernelWithPrintfDeviceMutex = mutexPtr; |
| 221 | + } |
| 222 | + std::mutex *getKernelWithPrintfDeviceMutex() { |
| 223 | + return kernelWithPrintfDeviceMutex; |
| 224 | + } |
| 225 | + void resetKernelWithPrintfDeviceMutex() { |
| 226 | + kernelWithPrintfDeviceMutex = nullptr; |
| 227 | + } |
215 | 228 |
|
216 | 229 | bool isSignalScope() const { |
217 | 230 | return !!signalScope; |
@@ -280,7 +293,8 @@ struct Event : _ze_event_handle_t { |
280 | 293 | void *hostAddress = nullptr; |
281 | 294 | Device *device = nullptr; |
282 | 295 | EventPool *eventPool = nullptr; |
283 | | - Kernel *kernelWithPrintf = nullptr; |
| 296 | + std::weak_ptr<Kernel> kernelWithPrintf = std::weak_ptr<Kernel>{}; |
| 297 | + std::mutex *kernelWithPrintfDeviceMutex = nullptr; |
284 | 298 | std::shared_ptr<InOrderExecInfo> inOrderExecInfo; |
285 | 299 | CommandQueue *latestUsedCmdQueue = nullptr; |
286 | 300 |
|
|
0 commit comments