| 117 | } |
| 118 | |
| 119 | ICLSVMMemoryRegion::~ICLSVMMemoryRegion() |
| 120 | { |
| 121 | if (_ptr != nullptr) |
| 122 | { |
| 123 | try |
| 124 | { |
| 125 | // Can only use the blocking finish instead of the non-blocking flush here, because clSVMFree requires all |
| 126 | // commands that may use the svm pointer to finish beforehand |
| 127 | // https://registry.khronos.org/OpenCL/sdk/3.0/docs/man/html/clSVMFree.html |
| 128 | clFinish(CLScheduler::get().queue().get()); |
| 129 | _mem = cl::Buffer(); |
| 130 | clSVMFree(_ctx.get(), _ptr); |
| 131 | } |
| 132 | catch (...) |
| 133 | { |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | void *ICLSVMMemoryRegion::ptr() |
| 139 | { |