Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sycl/source/detail/device_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ device_impl::device_impl(ur_device_handle_t Device, platform_impl &Platform,
: get_info_impl<UR_DEVICE_INFO_PARENT_DEVICE>()),
// TODO catch an exception and put it to list of asynchronous exceptions:
MCache{*this} {
// Interoperability Constructor already calls DeviceRetain in
// urDeviceCreateWithNativeHandle.
getAdapter().call<UrApiKind::urDeviceRetain>(MDevice);
// urDeviceRetain(MDevice) should not be called here,
// because RefCounter is initialized with 1,
// when the device is created.
}

device_impl::~device_impl() {
Expand Down
9 changes: 2 additions & 7 deletions sycl/unittests/context_device/DeviceRefCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ TEST(DevRefCounter, DevRefCounter) {
sycl::platform Plt = sycl::platform();

Plt.get_devices();
EXPECT_NE(DevRefCounter, 0);
// This is the behavior that SYCL performs at shutdown, but there
// are timing differences Lin/Win and shared/static that make
// it not map correctly into our mock.
// So for this test, we just do it.
sycl::detail::GlobalHandler::instance().getPlatformCache().clear();

EXPECT_EQ(DevRefCounter, 0);
}
EXPECT_EQ(DevRefCounter, 0);
}