Skip to content

Commit 525ac9a

Browse files
1e-toetotmeni
andauthored
Fixes names (#378)
* Fixes function names names for device name and vendor name properties * Fix sycl_device call in examples Co-authored-by: etotmeni <elena.totmenina@intel.com>
1 parent 162d87c commit 525ac9a

File tree

9 files changed

+32
-40
lines changed

9 files changed

+32
-40
lines changed

dpctl-capi/include/dpctl_sycl_device_interface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ DPCTLDevice_GetDeviceType(__dpctl_keep const DPCTLSyclDeviceRef DRef);
164164
*/
165165
DPCTL_API
166166
__dpctl_give const char *
167-
DPCTLDevice_GetDriverInfo(__dpctl_keep const DPCTLSyclDeviceRef DRef);
167+
DPCTLDevice_GetDriverVersion(__dpctl_keep const DPCTLSyclDeviceRef DRef);
168168

169169
/*!
170170
* @brief Wrapper over device.get_info<info::device::max_compute_units>().
@@ -253,7 +253,7 @@ DPCTLDevice_GetName(__dpctl_keep const DPCTLSyclDeviceRef DRef);
253253
*/
254254
DPCTL_API
255255
__dpctl_give const char *
256-
DPCTLDevice_GetVendorName(__dpctl_keep const DPCTLSyclDeviceRef DRef);
256+
DPCTLDevice_GetVendor(__dpctl_keep const DPCTLSyclDeviceRef DRef);
257257

258258
/*!
259259
* @brief Returns True if the device and the host share a unified memory

dpctl-capi/source/dpctl_sycl_device_interface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ DPCTLDevice_GetName(__dpctl_keep const DPCTLSyclDeviceRef DRef)
299299
}
300300

301301
__dpctl_give const char *
302-
DPCTLDevice_GetVendorName(__dpctl_keep const DPCTLSyclDeviceRef DRef)
302+
DPCTLDevice_GetVendor(__dpctl_keep const DPCTLSyclDeviceRef DRef)
303303
{
304304
char *cstr_vendor = nullptr;
305305
auto D = unwrap(DRef);
@@ -325,7 +325,7 @@ DPCTLDevice_GetVendorName(__dpctl_keep const DPCTLSyclDeviceRef DRef)
325325
}
326326

327327
__dpctl_give const char *
328-
DPCTLDevice_GetDriverInfo(__dpctl_keep const DPCTLSyclDeviceRef DRef)
328+
DPCTLDevice_GetDriverVersion(__dpctl_keep const DPCTLSyclDeviceRef DRef)
329329
{
330330
char *cstr_driver = nullptr;
331331
auto D = unwrap(DRef);

dpctl-capi/tests/test_sycl_device_interface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ TEST_P(TestDPCTLSyclDeviceInterface, ChkGetDeviceType)
102102
TEST_P(TestDPCTLSyclDeviceInterface, ChkGetDriverInfo)
103103
{
104104
const char *DriverInfo = nullptr;
105-
EXPECT_NO_FATAL_FAILURE(DriverInfo = DPCTLDevice_GetDriverInfo(DRef));
105+
EXPECT_NO_FATAL_FAILURE(DriverInfo = DPCTLDevice_GetDriverVersion(DRef));
106106
EXPECT_TRUE(DriverInfo != nullptr);
107107
EXPECT_NO_FATAL_FAILURE(DPCTLCString_Delete(DriverInfo));
108108
}
@@ -118,7 +118,7 @@ TEST_P(TestDPCTLSyclDeviceInterface, ChkGetName)
118118
TEST_P(TestDPCTLSyclDeviceInterface, ChkGetVendorName)
119119
{
120120
const char *VendorName = nullptr;
121-
EXPECT_NO_FATAL_FAILURE(VendorName = DPCTLDevice_GetVendorName(DRef));
121+
EXPECT_NO_FATAL_FAILURE(VendorName = DPCTLDevice_GetVendor(DRef));
122122
EXPECT_TRUE(VendorName != nullptr);
123123
EXPECT_NO_FATAL_FAILURE(DPCTLCString_Delete(VendorName));
124124
}

dpctl/_backend.pxd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ cdef extern from "dpctl_sycl_device_interface.h":
155155
const DPCTLSyclDeviceRef DRef)
156156
cdef DPCTLSyclDeviceType DPCTLDevice_GetDeviceType(
157157
const DPCTLSyclDeviceRef DRef)
158-
cdef const char *DPCTLDevice_GetDriverInfo(const DPCTLSyclDeviceRef DRef)
158+
cdef const char *DPCTLDevice_GetDriverVersion(const DPCTLSyclDeviceRef DRef)
159159
cdef uint32_t DPCTLDevice_GetMaxComputeUnits(const DPCTLSyclDeviceRef DRef)
160160
cdef uint32_t DPCTLDevice_GetMaxNumSubGroups(const DPCTLSyclDeviceRef DRef)
161161
cdef size_t DPCTLDevice_GetMaxWorkGroupSize(const DPCTLSyclDeviceRef DRef)
@@ -164,7 +164,7 @@ cdef extern from "dpctl_sycl_device_interface.h":
164164
cdef const char *DPCTLDevice_GetName(const DPCTLSyclDeviceRef DRef)
165165
cdef DPCTLSyclPlatformRef DPCTLDevice_GetPlatform(
166166
const DPCTLSyclDeviceRef DRef)
167-
cdef const char *DPCTLDevice_GetVendorName(const DPCTLSyclDeviceRef DRef)
167+
cdef const char *DPCTLDevice_GetVendor(const DPCTLSyclDeviceRef DRef)
168168
cdef bool DPCTLDevice_IsAccelerator(const DPCTLSyclDeviceRef DRef)
169169
cdef bool DPCTLDevice_IsCPU(const DPCTLSyclDeviceRef DRef)
170170
cdef bool DPCTLDevice_IsGPU(const DPCTLSyclDeviceRef DRef)

dpctl/_sycl_device.pxd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ cdef class _SyclDevice:
3232
''' Wrapper data owner class for a Sycl Device
3333
'''
3434
cdef DPCTLSyclDeviceRef _device_ref
35-
cdef const char *_vendor_name
36-
cdef const char *_device_name
35+
cdef const char *_vendor
36+
cdef const char *_name
3737
cdef const char *_driver_version
3838
cdef size_t *_max_work_item_sizes
3939

dpctl/_sycl_device.pyx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ from ._backend cimport (
3434
DPCTLDeviceVector_Delete,
3535
DPCTLDeviceVector_GetAt,
3636
DPCTLDeviceVector_Size,
37-
DPCTLDevice_AreEq,
3837
DPCTLDevice_GetBackend,
38+
DPCTLDevice_AreEq,
3939
DPCTLDevice_GetDeviceType,
40-
DPCTLDevice_GetDriverInfo,
40+
DPCTLDevice_GetDriverVersion,
4141
DPCTLDevice_GetMaxComputeUnits,
4242
DPCTLDevice_GetMaxNumSubGroups,
4343
DPCTLDevice_GetMaxWorkGroupSize,
4444
DPCTLDevice_GetMaxWorkItemDims,
4545
DPCTLDevice_GetMaxWorkItemSizes,
46-
DPCTLDevice_GetVendorName,
46+
DPCTLDevice_GetVendor,
4747
DPCTLDevice_GetName,
4848
DPCTLDevice_IsAccelerator,
4949
DPCTLDevice_IsCPU,
@@ -106,8 +106,8 @@ cdef class _SyclDevice:
106106

107107
def __dealloc__(self):
108108
DPCTLDevice_Delete(self._device_ref)
109-
DPCTLCString_Delete(self._device_name)
110-
DPCTLCString_Delete(self._vendor_name)
109+
DPCTLCString_Delete(self._name)
110+
DPCTLCString_Delete(self._vendor)
111111
DPCTLCString_Delete(self._driver_version)
112112
DPCTLSize_t_Array_Delete(self._max_work_item_sizes)
113113

@@ -199,9 +199,9 @@ cdef class SyclDevice(_SyclDevice):
199199
@staticmethod
200200
cdef void _init_helper(_SyclDevice device, DPCTLSyclDeviceRef DRef):
201201
device._device_ref = DRef
202-
device._device_name = DPCTLDevice_GetName(DRef)
203-
device._driver_version = DPCTLDevice_GetDriverInfo(DRef)
204-
device._vendor_name = DPCTLDevice_GetVendorName(DRef)
202+
device._name = DPCTLDevice_GetName(DRef)
203+
device._driver_version = DPCTLDevice_GetDriverVersion(DRef)
204+
device._vendor = DPCTLDevice_GetVendor(DRef)
205205
device._max_work_item_sizes = DPCTLDevice_GetMaxWorkItemSizes(DRef)
206206

207207
@staticmethod
@@ -222,12 +222,12 @@ cdef class SyclDevice(_SyclDevice):
222222
self._device_ref = DPCTLDevice_Copy(other._device_ref)
223223
if (self._device_ref is NULL):
224224
return -1
225-
self._device_name = DPCTLDevice_GetName(self._device_ref)
226-
self._driver_version = DPCTLDevice_GetDriverInfo(self._device_ref)
225+
self._name = DPCTLDevice_GetName(self._device_ref)
226+
self._driver_version = DPCTLDevice_GetDriverVersion(self._device_ref)
227227
self._max_work_item_sizes = (
228228
DPCTLDevice_GetMaxWorkItemSizes(self._device_ref)
229229
)
230-
self._vendor_name = DPCTLDevice_GetVendorName(self._device_ref)
230+
self._vendor = DPCTLDevice_GetVendor(self._device_ref)
231231
return 0
232232

233233
cdef int _init_from_selector(self, DPCTLSyclDeviceSelectorRef DSRef):
@@ -653,10 +653,10 @@ cdef class SyclDevice(_SyclDevice):
653653
return DPCTLDevice_GetPreferredVectorWidthHalf(self._device_ref)
654654

655655
@property
656-
def vendor_name(self):
656+
def vendor(self):
657657
""" Returns the device vendor name as a string.
658658
"""
659-
return self._vendor_name.decode()
659+
return self._vendor.decode()
660660

661661
@property
662662
def driver_version(self):
@@ -665,10 +665,10 @@ cdef class SyclDevice(_SyclDevice):
665665
return self._driver_version.decode()
666666

667667
@property
668-
def device_name(self):
668+
def name(self):
669669
""" Returns the name of the device as a string
670670
"""
671-
return self._device_name.decode()
671+
return self._name.decode()
672672

673673
@property
674674
def __name__(self):
@@ -677,7 +677,7 @@ cdef class SyclDevice(_SyclDevice):
677677
def __repr__(self):
678678
return ("<dpctl." + self.__name__ + " [" +
679679
str(self.backend) + ", " + str(self.device_type) +", " +
680-
" " + self.device_name + "] at {}>".format(hex(id(self))) )
680+
" " + self.name + "] at {}>".format(hex(id(self))) )
681681

682682
cdef list create_sub_devices_equally(self, size_t count):
683683
""" Returns a vector of sub devices partitioned from this SYCL device

examples/cython/sycl_buffer/bench.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
dpctl.set_global_queue("opencl:cpu")
2828
print(
2929
"SYCL({}) result: {}".format(
30-
dpctl.get_current_queue().get_sycl_device().get_device_name(),
30+
dpctl.get_current_queue().sycl_device.name,
3131
sb.columnwise_total(X),
3232
)
3333
)
3434

3535
dpctl.set_default_queue("opencl:gpu")
3636
print(
3737
"SYCL({}) result: {}".format(
38-
dpctl.get_current_queue().get_sycl_device().get_device_name(),
38+
dpctl.get_current_queue().sycl_device.name,
3939
sb.columnwise_total(X),
4040
)
4141
)

examples/cython/sycl_buffer/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
import dpctl
3131

3232
with dpctl.device_context("opencl:gpu"):
33-
print("Running on: ", dpctl.get_current_queue().get_sycl_device().get_device_name())
33+
print("Running on: ", dpctl.get_current_queue().sycl_device.name)
3434
print(sb.columnwise_total(X))
3535

3636
with dpctl.device_context("opencl:cpu"):
37-
print("Running on: ", dpctl.get_current_queue().get_sycl_device().get_device_name())
37+
print("Running on: ", dpctl.get_current_queue().sycl_device.name)
3838
print(sb.columnwise_total(X))

examples/cython/usm_memory/run.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ def gen_option_params(n_opts, pl, ph, sl, sh, tl, th, rl, rh, vl, vh, dtype):
5757
for _ in range(3):
5858

5959
dpctl.set_global_queue("opencl:cpu:0")
60-
print(
61-
"Using : {}".format(
62-
dpctl.get_current_queue().get_sycl_device().get_device_name()
63-
)
64-
)
60+
print("Using : {}".format(dpctl.get_current_queue().sycl_device.name))
6561

6662
t0 = timeit.default_timer()
6763
opts1 = gen_option_params(
@@ -74,11 +70,7 @@ def gen_option_params(n_opts, pl, ph, sl, sh, tl, th, rl, rh, vl, vh, dtype):
7470

7571
# compute on GPU sycl device
7672
dpctl.set_global_queue("level_zero:gpu:0")
77-
print(
78-
"Using : {}".format(
79-
dpctl.get_current_queue().get_sycl_device().get_device_name()
80-
)
81-
)
73+
print("Using : {}".format(dpctl.get_current_queue().sycl_device.name))
8274

8375
t0 = timeit.default_timer()
8476
opts2 = gen_option_params(

0 commit comments

Comments
 (0)