Commit 7cee465
committed
Fixes #447
DPCLTDeviceMgr_GetDevices should not rely of the cached unordered map
of root sycl devices to sycl contexts. Because unordered map can change
the ordering.
Changed implementation to iterate over device::get_devices instead.
Confirmation of the fix:
```
In [1]: import dpctl
In [2]: d0 = dpctl.SyclDevice("gpu:0")
In [3]: d0.filter_string
Out[3]: 'opencl:gpu:0'
In [4]: [i for i, di in enumerate(dpctl.get_devices(dpctl.backend_type.all, dpctl.device_type.gpu)) if di == d0]
Out[4]: [0]
In [5]: d0 == dpctl.SyclDevice(d0.filter_string)
Out[5]: True
In [6]: d1 = dpctl.SyclDevice("gpu:1")
In [7]: d1.filter_string
Out[7]: 'level_zero:gpu:0'
In [8]: [i for i, di in enumerate(dpctl.get_devices(dpctl.backend_type.all, dpctl.device_type.gpu)) if di == d1]
Out[8]: [1]
In [9]: d1 == dpctl.SyclDevice(d1.filter_string)
Out[9]: True
```1 parent 49373f8 commit 7cee465
1 file changed
+8
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
| 150 | + | |
150 | 151 | | |
151 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
152 | 155 | | |
153 | | - | |
| 156 | + | |
154 | 157 | | |
155 | | - | |
| 158 | + | |
156 | 159 | | |
157 | | - | |
| 160 | + | |
158 | 161 | | |
159 | 162 | | |
160 | 163 | | |
| |||
0 commit comments