diff --git a/dpctl-capi/include/dpctl_sycl_device_interface.h b/dpctl-capi/include/dpctl_sycl_device_interface.h index 819592fb1d..4e50861e95 100644 --- a/dpctl-capi/include/dpctl_sycl_device_interface.h +++ b/dpctl-capi/include/dpctl_sycl_device_interface.h @@ -164,7 +164,7 @@ DPCTLDevice_GetDeviceType(__dpctl_keep const DPCTLSyclDeviceRef DRef); */ DPCTL_API __dpctl_give const char * -DPCTLDevice_GetDriverInfo(__dpctl_keep const DPCTLSyclDeviceRef DRef); +DPCTLDevice_GetDriverVersion(__dpctl_keep const DPCTLSyclDeviceRef DRef); /*! * @brief Wrapper over device.get_info(). @@ -253,7 +253,7 @@ DPCTLDevice_GetName(__dpctl_keep const DPCTLSyclDeviceRef DRef); */ DPCTL_API __dpctl_give const char * -DPCTLDevice_GetVendorName(__dpctl_keep const DPCTLSyclDeviceRef DRef); +DPCTLDevice_GetVendor(__dpctl_keep const DPCTLSyclDeviceRef DRef); /*! * @brief Returns True if the device and the host share a unified memory diff --git a/dpctl-capi/source/dpctl_sycl_device_interface.cpp b/dpctl-capi/source/dpctl_sycl_device_interface.cpp index dc31326403..c4c6a130ea 100644 --- a/dpctl-capi/source/dpctl_sycl_device_interface.cpp +++ b/dpctl-capi/source/dpctl_sycl_device_interface.cpp @@ -299,7 +299,7 @@ DPCTLDevice_GetName(__dpctl_keep const DPCTLSyclDeviceRef DRef) } __dpctl_give const char * -DPCTLDevice_GetVendorName(__dpctl_keep const DPCTLSyclDeviceRef DRef) +DPCTLDevice_GetVendor(__dpctl_keep const DPCTLSyclDeviceRef DRef) { char *cstr_vendor = nullptr; auto D = unwrap(DRef); @@ -325,7 +325,7 @@ DPCTLDevice_GetVendorName(__dpctl_keep const DPCTLSyclDeviceRef DRef) } __dpctl_give const char * -DPCTLDevice_GetDriverInfo(__dpctl_keep const DPCTLSyclDeviceRef DRef) +DPCTLDevice_GetDriverVersion(__dpctl_keep const DPCTLSyclDeviceRef DRef) { char *cstr_driver = nullptr; auto D = unwrap(DRef); diff --git a/dpctl-capi/tests/test_sycl_device_interface.cpp b/dpctl-capi/tests/test_sycl_device_interface.cpp index 4cd8acc23d..a17145e5cb 100644 --- a/dpctl-capi/tests/test_sycl_device_interface.cpp +++ b/dpctl-capi/tests/test_sycl_device_interface.cpp @@ -102,7 +102,7 @@ TEST_P(TestDPCTLSyclDeviceInterface, ChkGetDeviceType) TEST_P(TestDPCTLSyclDeviceInterface, ChkGetDriverInfo) { const char *DriverInfo = nullptr; - EXPECT_NO_FATAL_FAILURE(DriverInfo = DPCTLDevice_GetDriverInfo(DRef)); + EXPECT_NO_FATAL_FAILURE(DriverInfo = DPCTLDevice_GetDriverVersion(DRef)); EXPECT_TRUE(DriverInfo != nullptr); EXPECT_NO_FATAL_FAILURE(DPCTLCString_Delete(DriverInfo)); } @@ -118,7 +118,7 @@ TEST_P(TestDPCTLSyclDeviceInterface, ChkGetName) TEST_P(TestDPCTLSyclDeviceInterface, ChkGetVendorName) { const char *VendorName = nullptr; - EXPECT_NO_FATAL_FAILURE(VendorName = DPCTLDevice_GetVendorName(DRef)); + EXPECT_NO_FATAL_FAILURE(VendorName = DPCTLDevice_GetVendor(DRef)); EXPECT_TRUE(VendorName != nullptr); EXPECT_NO_FATAL_FAILURE(DPCTLCString_Delete(VendorName)); } diff --git a/dpctl/_backend.pxd b/dpctl/_backend.pxd index cbb49c6d4b..cb6188d8a2 100644 --- a/dpctl/_backend.pxd +++ b/dpctl/_backend.pxd @@ -155,7 +155,7 @@ cdef extern from "dpctl_sycl_device_interface.h": const DPCTLSyclDeviceRef DRef) cdef DPCTLSyclDeviceType DPCTLDevice_GetDeviceType( const DPCTLSyclDeviceRef DRef) - cdef const char *DPCTLDevice_GetDriverInfo(const DPCTLSyclDeviceRef DRef) + cdef const char *DPCTLDevice_GetDriverVersion(const DPCTLSyclDeviceRef DRef) cdef uint32_t DPCTLDevice_GetMaxComputeUnits(const DPCTLSyclDeviceRef DRef) cdef uint32_t DPCTLDevice_GetMaxNumSubGroups(const DPCTLSyclDeviceRef DRef) cdef size_t DPCTLDevice_GetMaxWorkGroupSize(const DPCTLSyclDeviceRef DRef) @@ -164,7 +164,7 @@ cdef extern from "dpctl_sycl_device_interface.h": cdef const char *DPCTLDevice_GetName(const DPCTLSyclDeviceRef DRef) cdef DPCTLSyclPlatformRef DPCTLDevice_GetPlatform( const DPCTLSyclDeviceRef DRef) - cdef const char *DPCTLDevice_GetVendorName(const DPCTLSyclDeviceRef DRef) + cdef const char *DPCTLDevice_GetVendor(const DPCTLSyclDeviceRef DRef) cdef bool DPCTLDevice_IsAccelerator(const DPCTLSyclDeviceRef DRef) cdef bool DPCTLDevice_IsCPU(const DPCTLSyclDeviceRef DRef) cdef bool DPCTLDevice_IsGPU(const DPCTLSyclDeviceRef DRef) diff --git a/dpctl/_sycl_device.pxd b/dpctl/_sycl_device.pxd index f1d656896f..51d6dd7d35 100644 --- a/dpctl/_sycl_device.pxd +++ b/dpctl/_sycl_device.pxd @@ -32,8 +32,8 @@ cdef class _SyclDevice: ''' Wrapper data owner class for a Sycl Device ''' cdef DPCTLSyclDeviceRef _device_ref - cdef const char *_vendor_name - cdef const char *_device_name + cdef const char *_vendor + cdef const char *_name cdef const char *_driver_version cdef size_t *_max_work_item_sizes diff --git a/dpctl/_sycl_device.pyx b/dpctl/_sycl_device.pyx index ad3beb8d1c..495b54c90a 100644 --- a/dpctl/_sycl_device.pyx +++ b/dpctl/_sycl_device.pyx @@ -34,16 +34,16 @@ from ._backend cimport ( DPCTLDeviceVector_Delete, DPCTLDeviceVector_GetAt, DPCTLDeviceVector_Size, - DPCTLDevice_AreEq, DPCTLDevice_GetBackend, + DPCTLDevice_AreEq, DPCTLDevice_GetDeviceType, - DPCTLDevice_GetDriverInfo, + DPCTLDevice_GetDriverVersion, DPCTLDevice_GetMaxComputeUnits, DPCTLDevice_GetMaxNumSubGroups, DPCTLDevice_GetMaxWorkGroupSize, DPCTLDevice_GetMaxWorkItemDims, DPCTLDevice_GetMaxWorkItemSizes, - DPCTLDevice_GetVendorName, + DPCTLDevice_GetVendor, DPCTLDevice_GetName, DPCTLDevice_IsAccelerator, DPCTLDevice_IsCPU, @@ -106,8 +106,8 @@ cdef class _SyclDevice: def __dealloc__(self): DPCTLDevice_Delete(self._device_ref) - DPCTLCString_Delete(self._device_name) - DPCTLCString_Delete(self._vendor_name) + DPCTLCString_Delete(self._name) + DPCTLCString_Delete(self._vendor) DPCTLCString_Delete(self._driver_version) DPCTLSize_t_Array_Delete(self._max_work_item_sizes) @@ -199,9 +199,9 @@ cdef class SyclDevice(_SyclDevice): @staticmethod cdef void _init_helper(_SyclDevice device, DPCTLSyclDeviceRef DRef): device._device_ref = DRef - device._device_name = DPCTLDevice_GetName(DRef) - device._driver_version = DPCTLDevice_GetDriverInfo(DRef) - device._vendor_name = DPCTLDevice_GetVendorName(DRef) + device._name = DPCTLDevice_GetName(DRef) + device._driver_version = DPCTLDevice_GetDriverVersion(DRef) + device._vendor = DPCTLDevice_GetVendor(DRef) device._max_work_item_sizes = DPCTLDevice_GetMaxWorkItemSizes(DRef) @staticmethod @@ -222,12 +222,12 @@ cdef class SyclDevice(_SyclDevice): self._device_ref = DPCTLDevice_Copy(other._device_ref) if (self._device_ref is NULL): return -1 - self._device_name = DPCTLDevice_GetName(self._device_ref) - self._driver_version = DPCTLDevice_GetDriverInfo(self._device_ref) + self._name = DPCTLDevice_GetName(self._device_ref) + self._driver_version = DPCTLDevice_GetDriverVersion(self._device_ref) self._max_work_item_sizes = ( DPCTLDevice_GetMaxWorkItemSizes(self._device_ref) ) - self._vendor_name = DPCTLDevice_GetVendorName(self._device_ref) + self._vendor = DPCTLDevice_GetVendor(self._device_ref) return 0 cdef int _init_from_selector(self, DPCTLSyclDeviceSelectorRef DSRef): @@ -653,10 +653,10 @@ cdef class SyclDevice(_SyclDevice): return DPCTLDevice_GetPreferredVectorWidthHalf(self._device_ref) @property - def vendor_name(self): + def vendor(self): """ Returns the device vendor name as a string. """ - return self._vendor_name.decode() + return self._vendor.decode() @property def driver_version(self): @@ -665,10 +665,10 @@ cdef class SyclDevice(_SyclDevice): return self._driver_version.decode() @property - def device_name(self): + def name(self): """ Returns the name of the device as a string """ - return self._device_name.decode() + return self._name.decode() @property def __name__(self): @@ -677,7 +677,7 @@ cdef class SyclDevice(_SyclDevice): def __repr__(self): return ("".format(hex(id(self))) ) + " " + self.name + "] at {}>".format(hex(id(self))) ) cdef list create_sub_devices_equally(self, size_t count): """ Returns a vector of sub devices partitioned from this SYCL device diff --git a/examples/cython/sycl_buffer/bench.py b/examples/cython/sycl_buffer/bench.py index e063735ccd..ecc74c7e25 100644 --- a/examples/cython/sycl_buffer/bench.py +++ b/examples/cython/sycl_buffer/bench.py @@ -27,7 +27,7 @@ dpctl.set_global_queue("opencl:cpu") print( "SYCL({}) result: {}".format( - dpctl.get_current_queue().get_sycl_device().get_device_name(), + dpctl.get_current_queue().sycl_device.name, sb.columnwise_total(X), ) ) @@ -35,7 +35,7 @@ dpctl.set_default_queue("opencl:gpu") print( "SYCL({}) result: {}".format( - dpctl.get_current_queue().get_sycl_device().get_device_name(), + dpctl.get_current_queue().sycl_device.name, sb.columnwise_total(X), ) ) diff --git a/examples/cython/sycl_buffer/run.py b/examples/cython/sycl_buffer/run.py index 467fdbc226..3bba707e88 100644 --- a/examples/cython/sycl_buffer/run.py +++ b/examples/cython/sycl_buffer/run.py @@ -30,9 +30,9 @@ import dpctl with dpctl.device_context("opencl:gpu"): - print("Running on: ", dpctl.get_current_queue().get_sycl_device().get_device_name()) + print("Running on: ", dpctl.get_current_queue().sycl_device.name) print(sb.columnwise_total(X)) with dpctl.device_context("opencl:cpu"): - print("Running on: ", dpctl.get_current_queue().get_sycl_device().get_device_name()) + print("Running on: ", dpctl.get_current_queue().sycl_device.name) print(sb.columnwise_total(X)) diff --git a/examples/cython/usm_memory/run.py b/examples/cython/usm_memory/run.py index 16ccdda957..4bf50b0040 100644 --- a/examples/cython/usm_memory/run.py +++ b/examples/cython/usm_memory/run.py @@ -57,11 +57,7 @@ def gen_option_params(n_opts, pl, ph, sl, sh, tl, th, rl, rh, vl, vh, dtype): for _ in range(3): dpctl.set_global_queue("opencl:cpu:0") - print( - "Using : {}".format( - dpctl.get_current_queue().get_sycl_device().get_device_name() - ) - ) + print("Using : {}".format(dpctl.get_current_queue().sycl_device.name)) t0 = timeit.default_timer() 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): # compute on GPU sycl device dpctl.set_global_queue("level_zero:gpu:0") - print( - "Using : {}".format( - dpctl.get_current_queue().get_sycl_device().get_device_name() - ) - ) + print("Using : {}".format(dpctl.get_current_queue().sycl_device.name)) t0 = timeit.default_timer() opts2 = gen_option_params(