Skip to content
Open
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
8 changes: 5 additions & 3 deletions sycl/unittests/thread_safety/DeviceGlobalProgramHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ struct KernelInfo<DevGlobHandleTestKernel>
static sycl::unittest::MockDeviceImage generateHandleTestImage() {
using namespace sycl::unittest;

sycl::detail::device_global_map::add(&g_TestDevGlobal,
DevGlobHandleTestGlobalName);

MockPropertySet PropSet;
MockProperty DevGlobInfo =
makeDeviceGlobalInfo(DevGlobHandleTestGlobalName, sizeof(DevGlobElem),
Expand Down Expand Up @@ -159,6 +156,11 @@ static ur_result_t blocking_urProgramBuildExp(void *) {
class DeviceGlobalProgramHandleTest : public ::testing::Test {
protected:
void SetUp() override {
// Register the device_global here rather than during static initialization
// to avoid static initialization order fiasco with GlobalHandler
sycl::detail::device_global_map::add(&g_TestDevGlobal,
DevGlobHandleTestGlobalName);

{
std::lock_guard<std::mutex> HLock(g_HandlesMtx);
g_CapturedHandles.clear();
Expand Down
Loading