Merged
Conversation
diptorupd
reviewed
May 20, 2021
Contributor
|
LGTM bar the minor naming nitpick. |
This function is more general that DPCTL_GetRelativeId(DRef). The latter corresponds to DPCTLDeviceMgr_GetPositionInDevices(DRef, DPCTLDevice_GetBackend(DRef) | DPCTLDevice_GetDeviceType(DRef)); The function can be used to generate filter selector based on a pattern, expressed by device_mask (any backend, given type), or (any backend, any type), or (given backend, given type).
f4d93b4 to
92161ff
Compare
dpctl.SyclDevice.filter_string property gives fully specified filter selector, which includes backend, device_type and relative id. get_filter_string(include_backend, include_device_type) allows one to construct filter strings which would omit either backend or device_type or both, guaranteeing that dpctl.SyclDevice(obtained_selector_string) will give back the same device. ``` In [1]: import dpctl In [2]: default_dev = dpctl.SyclDevice() In [3]: default_dev.get_filter_string(include_backend=False) Out[3]: 'gpu:1' In [4]: default_dev.get_filter_string(include_device_type=False) Out[4]: 'level_zero:0' In [5]: default_dev.get_filter_string(include_device_type=False, include_backend=False) Out[5]: '4' ```
92161ff to
c31be27
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dpctl-capi/:
DPCTLDeviceMgr_GetPositionInDevices(DRef, device_mask)that returns ordinal of the given DRef in the filtered vector returned bysycl::device::get_devices(), or -1 if not found (e.g.DRefpoints to a sub-device).dpctl/:
DPCTLDeviceMgr_GetPositionInDevicesto_backend.pxddpctl.SyclDevice:get_overall_ordinal(self)- index in unfiltered vector returned byget_devices().get_backend_ordinal(self)- index in vector filtered to only contain devices with the backend of this deviceget_device_type_ordinal(self)- index in vector filtered to only contain devices with device_type as in this deviceget_backend_and_device_type_ordinal(self)- indexed in vector filtered to only contain devices with device_type and backend of this device* Added Python visible method
get_filter_string(self, include_backend=True, include_device_type=True)which producer filter selector string selecting this device that would include or omit backend/device_type as requested.* Test added
Example: