Skip to content

Commit 3512914

Browse files
Use DPCTLQueue_CreateForDevice instead of wrapping sycl::queue pointer
1 parent ff104ad commit 3512914

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

libsyclinterface/tests/test_sycl_usm_interface.cpp

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,26 +142,41 @@ TEST_F(TestDPCTLSyclUSMInterface, AlignedAllocShared)
142142

143143
TEST_F(TestDPCTLSyclUSMInterface, AlignedAllocDevice)
144144
{
145-
sycl::queue q;
146-
DPCTLSyclQueueRef Q = dpctl::syclinterface::wrap<sycl::queue>(&q);
147-
ASSERT_TRUE(Q);
145+
DPCTLSyclDeviceSelectorRef DSRef = DPCTLDefaultSelector_Create();
146+
ASSERT_TRUE(DSRef);
147+
DPCTLSyclDeviceRef DRef = DPCTLDevice_CreateFromSelector(DSRef);
148+
DPCTLDeviceSelector_Delete(DSRef);
149+
ASSERT_TRUE(DRef);
150+
DPCTLSyclQueueRef QRef = DPCTLQueue_CreateForDevice(DRef);
151+
DPCTLDevice_Delete(DRef);
152+
ASSERT_TRUE(QRef);
153+
148154
const size_t nbytes = SIZE;
149-
auto Ptr = DPCTLaligned_alloc_device(64, nbytes, Q);
155+
auto Ptr = DPCTLaligned_alloc_device(64, nbytes, QRef);
150156
EXPECT_TRUE(bool(Ptr));
151-
common_test_body(nbytes, Ptr, Q, DPCTLSyclUSMType::DPCTL_USM_DEVICE);
152-
DPCTLfree_with_queue(Ptr, Q);
157+
common_test_body(nbytes, Ptr, QRef, DPCTLSyclUSMType::DPCTL_USM_DEVICE);
158+
DPCTLfree_with_queue(Ptr, QRef);
159+
DPCTLQueue_Delete(QRef);
153160
}
154161

155162
TEST_F(TestDPCTLSyclUSMInterface, AlignedAllocHost)
156163
{
157-
sycl::queue q;
158-
DPCTLSyclQueueRef Q = dpctl::syclinterface::wrap<sycl::queue>(&q);
159-
ASSERT_TRUE(Q);
164+
DPCTLSyclDeviceSelectorRef DSRef = DPCTLDefaultSelector_Create();
165+
ASSERT_TRUE(DSRef);
166+
DPCTLSyclDeviceRef DRef = DPCTLDevice_CreateFromSelector(DSRef);
167+
DPCTLDeviceSelector_Delete(DSRef);
168+
ASSERT_TRUE(DRef);
169+
DPCTLSyclQueueRef QRef = DPCTLQueue_CreateForDevice(DRef);
170+
DPCTLDevice_Delete(DRef);
171+
ASSERT_TRUE(QRef);
172+
160173
const size_t nbytes = SIZE;
161-
auto Ptr = DPCTLaligned_alloc_host(64, nbytes, Q);
174+
auto Ptr = DPCTLaligned_alloc_host(64, nbytes, QRef);
162175
EXPECT_TRUE(bool(Ptr));
163-
common_test_body(nbytes, Ptr, Q, DPCTLSyclUSMType::DPCTL_USM_HOST);
164-
DPCTLfree_with_queue(Ptr, Q);
176+
common_test_body(nbytes, Ptr, QRef, DPCTLSyclUSMType::DPCTL_USM_HOST);
177+
DPCTLfree_with_queue(Ptr, QRef);
178+
179+
DPCTLQueue_Delete(QRef);
165180
}
166181

167182
struct TestDPCTLSyclUSMNullArgs : public ::testing::Test

0 commit comments

Comments
 (0)