Commit 8456b01
authored
[SYCL] Fix memory leak for sub-devices (#20370)
Current `device_impl` implementation assumes shared ownership and
manages the handle via `urRetain`/`urRelease` in constructor/destructor.
Whenever we get temporary device handles via
`urDeviceGet`/`urDevicePartition` (which implicitly return device handle
with `refcount == 1`) and wrap those handles in `device_impl`, we have
to release temporary handles at
the end of scope to avoid memory leak.
It's done here for devices:
https://github.com/intel/llvm/blob/6b29cf120c267118dc8ad737e54e8b844bfb4e06/sycl/source/detail/platform_impl.cpp#L560-L563
Same needs to be done when we create sub-devices. But currently we were
missing release calls for temporary handles after creating `device_impl`
objects wrapping those handles. This PR fixes that issue by releasing
temporary handles at the end of the scope.1 parent 93a515d commit 8456b01
File tree
2 files changed
+68
-0
lines changed- sycl
- source/detail
- unittests/context_device
2 files changed
+68
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
170 | 176 | | |
171 | 177 | | |
172 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
32 | 65 | | |
33 | 66 | | |
34 | 67 | | |
| |||
52 | 85 | | |
53 | 86 | | |
54 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
0 commit comments