-
Notifications
You must be signed in to change notification settings - Fork 30
Refactor/device properties #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
915e7ba
to
cf5b5f6
Compare
@PokhodenkoSA @1e-to @oleksandr-pavlyk should the attributes of SyclDevice be defined using |
I was not aware of cached_property, but if it exists, cached property works too. |
Was referring to https://pypi.org/project/cached-property/. Not sure if it worth the trouble. |
@diptorupd please don't use 3rd party package for cached properties. I think cached properties are not necessary because our properties don't contain heavy executions. |
dpctl/_sycl_device.pyx
Outdated
max_work_item_sizes = [] | ||
for n in range(3): | ||
max_work_item_sizes.append(self._max_work_item_sizes[n]) | ||
return tuple(max_work_item_sizes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cython will generate more efficient code from doing
return (
self._max_work_item_sizes[0],
self._max_work_item_sizes[1],
self._max_work_item_sizes[2],
)
This avoids needless list temporary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the changes, but am now getting this error
Traceback (most recent call last):
File "/home/diptorupd/Desktop/devel/dpctl/dpctl/tests/test_sycl_queue.py", line 326, in test_valid_filter_selectors
check(device)
File "/home/diptorupd/Desktop/devel/dpctl/dpctl/tests/test_sycl_queue.py", line 66, in check_get_max_work_item_sizes
max_work_item_sizes = device.max_work_item_sizes
File "dpctl/_sycl_device.pyx", line 421, in dpctl._sycl_device.SyclDevice.max_work_item_sizes.__get__
return tuple(
TypeError: tuple expected at most 1 argument, got 3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than my prior suggestion, this is good to go, I would like to urge to not put off merging it for longer than absolutely necessary :)
* Convert all device attributes to properties.
SyclDevice no longer stores attributes related to SYCL device_info types (except for vendor_name, driver_version, device_name, and _max_work_item_sizes). All device_info values are converted to properties.
Contains everything in #323 and should be merged after #323 is merged.