Skip to content

Commit 97551b6

Browse files
Removed host-related functions/methods
Removed `DPCTLDevice_IsHost`, `DPCTLHostSelector_Create`, `DPCTLContext_IsHost` and use of is_host from Python API.
1 parent ad85e04 commit 97551b6

13 files changed

+5
-144
lines changed

dpctl/_backend.pxd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ cdef extern from "syclinterface/dpctl_sycl_device_interface.h":
172172
cdef bool DPCTLDevice_IsAccelerator(const DPCTLSyclDeviceRef DRef)
173173
cdef bool DPCTLDevice_IsCPU(const DPCTLSyclDeviceRef DRef)
174174
cdef bool DPCTLDevice_IsGPU(const DPCTLSyclDeviceRef DRef)
175-
cdef bool DPCTLDevice_IsHost(const DPCTLSyclDeviceRef DRef)
176175
cdef bool DPCTLDevice_GetSubGroupIndependentForwardProgress(const DPCTLSyclDeviceRef DRef)
177176
cdef uint32_t DPCTLDevice_GetPreferredVectorWidthChar(const DPCTLSyclDeviceRef DRef)
178177
cdef uint32_t DPCTLDevice_GetPreferredVectorWidthShort(const DPCTLSyclDeviceRef DRef)

dpctl/_sycl_device.pyx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ from ._backend cimport ( # noqa: E211
7373
DPCTLDevice_IsAccelerator,
7474
DPCTLDevice_IsCPU,
7575
DPCTLDevice_IsGPU,
76-
DPCTLDevice_IsHost,
7776
DPCTLDeviceMgr_GetDeviceInfoStr,
7877
DPCTLDeviceMgr_GetDevices,
7978
DPCTLDeviceMgr_GetPositionInDevices,
@@ -710,15 +709,6 @@ cdef class SyclDevice(_SyclDevice):
710709
"""
711710
return DPCTLDevice_IsGPU(self._device_ref)
712711

713-
@property
714-
def is_host(self):
715-
""" Returns True if the SyclDevice instance is a SYCL host device.
716-
717-
Returns:
718-
bool: True if the SyclDevice is a SYCL host device, else False.
719-
"""
720-
return DPCTLDevice_IsHost(self._device_ref)
721-
722712
@property
723713
def max_work_item_dims(self):
724714
""" Returns the maximum dimensions that specify the global and local
@@ -847,11 +837,9 @@ cdef class SyclDevice(_SyclDevice):
847837
int: The maximum number of sub-groups support per work-group by
848838
the device.
849839
"""
850-
cdef uint32_t max_num_sub_groups = 0
851-
if (not self.is_host):
852-
max_num_sub_groups = (
853-
DPCTLDevice_GetMaxNumSubGroups(self._device_ref)
854-
)
840+
cdef uint32_t max_num_sub_groups = (
841+
DPCTLDevice_GetMaxNumSubGroups(self._device_ref)
842+
)
855843
return max_num_sub_groups
856844

857845
@property

dpctl/tests/_device_attributes_checks.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def check_max_work_group_size(device):
108108
def check_max_num_sub_groups(device):
109109
max_num_sub_groups = device.max_num_sub_groups
110110
# Special case for FPGA simulator
111-
if device.is_accelerator or device.is_host:
111+
if device.is_accelerator:
112112
assert max_num_sub_groups >= 0
113113
else:
114114
assert max_num_sub_groups > 0
@@ -273,13 +273,6 @@ def check_is_gpu(device):
273273
pytest.fail("is_gpu call failed")
274274

275275

276-
def check_is_host(device):
277-
try:
278-
device.is_host
279-
except Exception:
280-
pytest.fail("is_hostcall failed")
281-
282-
283276
def check_max_read_image_args(device):
284277
try:
285278
device.max_read_image_args
@@ -563,7 +556,7 @@ def check_driver_version(device):
563556

564557
def check_vendor(device):
565558
ve = device.vendor
566-
assert ve or device.is_host
559+
assert ve
567560
assert type(ve) is str
568561

569562

@@ -617,7 +610,6 @@ def check_global_mem_cache_line_size(device):
617610
check_is_accelerator,
618611
check_is_cpu,
619612
check_is_gpu,
620-
check_is_host,
621613
check_sub_group_independent_forward_progress,
622614
check_preferred_vector_width_char,
623615
check_preferred_vector_width_short,

dpctl/tests/test_tensor_asarray.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@
3535
)
3636
def test_asarray_change_usm_type(src_usm_type, dst_usm_type):
3737
d = dpctl.SyclDevice()
38-
if d.is_host:
39-
pytest.skip(
40-
"Skip test of host device, which only "
41-
"supports host USM allocations"
42-
)
4338
X = dpt.empty(10, dtype="u1", usm_type=src_usm_type)
4439
Y = dpt.asarray(X, usm_type=dst_usm_type)
4540
assert X.shape == Y.shape

libsyclinterface/include/dpctl_sycl_context_interface.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,6 @@ DPCTL_API
130130
__dpctl_give DPCTLDeviceVectorRef
131131
DPCTLContext_GetDevices(__dpctl_keep const DPCTLSyclContextRef CRef);
132132

133-
/*!
134-
* @brief Returns true if this SYCL context is a host context.
135-
*
136-
* @param CtxRef An opaque pointer to a sycl::context.
137-
* @return True if the SYCL context is a host context, else False.
138-
* @ingroup ContextInterface
139-
*/
140-
DPCTL_API
141-
bool DPCTLContext_IsHost(__dpctl_keep const DPCTLSyclContextRef CtxRef);
142-
143133
/*!
144134
* @brief Returns the sycl backend for the DPCTLSyclContextRef pointer.
145135
*

libsyclinterface/include/dpctl_sycl_device_interface.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,6 @@ bool DPCTLDevice_IsCPU(__dpctl_keep const DPCTLSyclDeviceRef DRef);
120120
DPCTL_API
121121
bool DPCTLDevice_IsGPU(__dpctl_keep const DPCTLSyclDeviceRef DRef);
122122

123-
/*!
124-
* @brief Returns true if this SYCL device is a host device.
125-
*
126-
* @param DRef Opaque pointer to a ``sycl::device``
127-
* @return True if the device is a host device, else False.
128-
* @ingroup DeviceInterface
129-
*/
130-
DPCTL_API
131-
bool DPCTLDevice_IsHost(__dpctl_keep const DPCTLSyclDeviceRef DRef);
132-
133123
/*!
134124
* @brief Returns the backend for the device.
135125
*

libsyclinterface/include/dpctl_sycl_device_selector_interface.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,6 @@ DPCTLFilterSelector_Create(__dpctl_keep const char *filter_str);
8686
DPCTL_API
8787
__dpctl_give DPCTLSyclDeviceSelectorRef DPCTLGPUSelector_Create(void);
8888

89-
/*!
90-
* @brief Returns an opaque wrapper for dpctl_host_selector object.
91-
*
92-
* @return An opaque pointer to a dpctl_host_selector object.
93-
* @ingroup DeviceSelectors
94-
*/
95-
DPCTL_API
96-
__dpctl_give DPCTLSyclDeviceSelectorRef DPCTLHostSelector_Create(void);
97-
9889
/*!
9990
* @brief Deletes the DPCTLSyclDeviceSelectorRef after casting it to a
10091
* sycl::device_selector.

libsyclinterface/source/dpctl_sycl_context_interface.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,6 @@ size_t DPCTLContext_DeviceCount(__dpctl_keep const DPCTLSyclContextRef CRef)
169169
return Devices.size();
170170
}
171171

172-
bool DPCTLContext_IsHost(__dpctl_keep const DPCTLSyclContextRef CtxRef)
173-
{
174-
auto Ctx = unwrap<context>(CtxRef);
175-
if (Ctx) {
176-
return false;
177-
}
178-
return false;
179-
}
180-
181172
void DPCTLContext_Delete(__dpctl_take DPCTLSyclContextRef CtxRef)
182173
{
183174
delete unwrap<context>(CtxRef);

libsyclinterface/source/dpctl_sycl_device_interface.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,6 @@ bool DPCTLDevice_IsGPU(__dpctl_keep const DPCTLSyclDeviceRef DRef)
176176
return false;
177177
}
178178

179-
bool DPCTLDevice_IsHost(__dpctl_keep const DPCTLSyclDeviceRef DRef)
180-
{
181-
auto D = unwrap<device>(DRef);
182-
if (D) {
183-
return false;
184-
}
185-
return false;
186-
}
187-
188179
DPCTLSyclBackendType
189180
DPCTLDevice_GetBackend(__dpctl_keep const DPCTLSyclDeviceRef DRef)
190181
{

libsyclinterface/source/dpctl_sycl_device_selector_interface.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,6 @@ __dpctl_give DPCTLSyclDeviceSelectorRef DPCTLGPUSelector_Create()
9797
}
9898
}
9999

100-
__dpctl_give DPCTLSyclDeviceSelectorRef DPCTLHostSelector_Create()
101-
{
102-
try {
103-
auto Selector = new dpctl_host_selector();
104-
return wrap<dpctl_device_selector>(Selector);
105-
} catch (std::exception const &e) {
106-
error_handler(e, __FILE__, __func__, __LINE__);
107-
return nullptr;
108-
}
109-
}
110-
111100
int DPCTLDeviceSelector_Score(__dpctl_keep DPCTLSyclDeviceSelectorRef DSRef,
112101
__dpctl_keep DPCTLSyclDeviceRef DRef)
113102
{

libsyclinterface/tests/test_sycl_context_interface.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -162,21 +162,6 @@ TEST_P(TestDPCTLContextInterface, ChkAreEq)
162162
EXPECT_NO_FATAL_FAILURE(DPCTLContext_Delete(CRef3));
163163
}
164164

165-
TEST_P(TestDPCTLContextInterface, ChkIsHost)
166-
{
167-
DPCTLSyclContextRef CRef = nullptr;
168-
bool is_host_device = false, is_host_context = false;
169-
170-
EXPECT_NO_FATAL_FAILURE(CRef = DPCTLContext_Create(DRef, nullptr, 0));
171-
ASSERT_TRUE(CRef);
172-
173-
EXPECT_NO_FATAL_FAILURE(is_host_device = DPCTLDevice_IsHost(DRef));
174-
EXPECT_NO_FATAL_FAILURE(is_host_context = DPCTLContext_IsHost(CRef));
175-
EXPECT_TRUE(is_host_device == is_host_context);
176-
177-
EXPECT_NO_FATAL_FAILURE(DPCTLContext_Delete(CRef));
178-
}
179-
180165
TEST_P(TestDPCTLContextInterface, ChkGetBackend)
181166
{
182167
DPCTLSyclContextRef CRef = nullptr;
@@ -262,13 +247,6 @@ TEST_F(TestDPCTLContextNullArgs, ChkDeviceCount)
262247
ASSERT_TRUE(count == 0);
263248
}
264249

265-
TEST_F(TestDPCTLContextNullArgs, ChkIsHost)
266-
{
267-
bool is_host = true;
268-
EXPECT_NO_FATAL_FAILURE(is_host = DPCTLContext_IsHost(Null_CRef));
269-
ASSERT_FALSE(is_host);
270-
}
271-
272250
TEST_F(TestDPCTLContextNullArgs, ChkHash)
273251
{
274252
size_t hash = 0;

libsyclinterface/tests/test_sycl_device_interface.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,6 @@ TEST_P(TestDPCTLSyclDeviceInterface, ChkIsGPU)
242242
EXPECT_NO_FATAL_FAILURE(DPCTLDevice_IsGPU(DRef));
243243
}
244244

245-
TEST_P(TestDPCTLSyclDeviceInterface, ChkIsHost)
246-
{
247-
EXPECT_NO_FATAL_FAILURE(DPCTLDevice_IsHost(DRef));
248-
}
249-
250245
TEST_P(TestDPCTLSyclDeviceInterface, ChkGetSubGroupIndependentForwardProgress)
251246
{
252247
bool sub_group_progress = 0;
@@ -528,13 +523,6 @@ TEST_F(TestDPCTLSyclDeviceNullArgs, ChkIsGPU)
528523
ASSERT_FALSE(is_gpu);
529524
}
530525

531-
TEST_F(TestDPCTLSyclDeviceNullArgs, ChkIsHost)
532-
{
533-
bool is_host = true;
534-
EXPECT_NO_FATAL_FAILURE(is_host = DPCTLDevice_IsHost(Null_DRef));
535-
ASSERT_FALSE(is_host);
536-
}
537-
538526
TEST_F(TestDPCTLSyclDeviceNullArgs, ChkGetMaxComputeUnits)
539527
{
540528
uint32_t mcu = -1;

libsyclinterface/tests/test_sycl_device_selector_interface.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -159,27 +159,6 @@ TEST_F(TestDeviceSelectorInterface, ChkDPCTLGPUSelectorCreate)
159159
EXPECT_NO_FATAL_FAILURE(DPCTLDevice_Delete(DRef));
160160
}
161161

162-
TEST_F(TestDeviceSelectorInterface, ChkDPCTLHostSelectorCreate)
163-
{
164-
DPCTLSyclDeviceSelectorRef DSRef = nullptr;
165-
DPCTLSyclDeviceRef DRef = nullptr;
166-
167-
EXPECT_NO_FATAL_FAILURE(DSRef = DPCTLHostSelector_Create());
168-
EXPECT_NO_FATAL_FAILURE(DRef = DPCTLDevice_CreateFromSelector(DSRef));
169-
170-
if (!DRef) {
171-
EXPECT_NO_FATAL_FAILURE(DPCTLDeviceSelector_Delete(DSRef));
172-
EXPECT_NO_FATAL_FAILURE(DPCTLDevice_Delete(DRef));
173-
GTEST_SKIP_("Device not found. Skip tests.");
174-
}
175-
176-
EXPECT_NO_FATAL_FAILURE(DPCTLDeviceMgr_PrintDeviceInfo(DRef));
177-
// FIXME: DPCPP's host_selector returns a CPU device for some reason.
178-
// EXPECT_TRUE(DPCTLDevice_IsHost(DRef));
179-
EXPECT_NO_FATAL_FAILURE(DPCTLDeviceSelector_Delete(DSRef));
180-
EXPECT_NO_FATAL_FAILURE(DPCTLDevice_Delete(DRef));
181-
}
182-
183162
TEST_P(TestFilterSelector, ChkDPCTLFilterSelectorCreate)
184163
{
185164
ASSERT_TRUE(DRef != nullptr);

0 commit comments

Comments
 (0)