@@ -36,7 +36,7 @@ urPlatformGetInfo(ur_platform_handle_t, ur_platform_info_t propName,
3636 return ReturnValue (" " );
3737 }
3838 case UR_PLATFORM_INFO_ADAPTER: {
39- return ReturnValue (& adapter);
39+ return ReturnValue (ur::hip:: adapter. get () );
4040 }
4141 default :
4242 return UR_RESULT_ERROR_INVALID_ENUMERATION;
@@ -56,7 +56,6 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries,
5656 try {
5757 static std::once_flag InitFlag;
5858 static uint32_t NumPlatforms = 1 ;
59- static ur_platform_handle_t_ Platform;
6059
6160 UR_ASSERT (phPlatforms || pNumPlatforms, UR_RESULT_ERROR_INVALID_VALUE);
6261 UR_ASSERT (!phPlatforms || NumEntries > 0 , UR_RESULT_ERROR_INVALID_VALUE);
@@ -87,18 +86,20 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries,
8786
8887 // Use the default stream to record base event counter
8988 UR_CHECK_ERROR (hipEventRecord (EvBase, 0 ));
90- Platform.Devices .emplace_back (
91- new ur_device_handle_t_{Device, EvBase, &Platform, i});
89+ ur::hip::adapter->Platform ->Devices .emplace_back (
90+ new ur_device_handle_t_{Device, EvBase,
91+ ur::hip::adapter->Platform .get (), i});
9292
93- ScopedDevice Active (Platform.Devices .front ().get ());
93+ ScopedDevice Active (
94+ ur::hip::adapter->Platform ->Devices .front ().get ());
9495 }
9596 } catch (const std::bad_alloc &) {
9697 // Signal out-of-memory situation
97- Platform. Devices .clear ();
98+ ur::hip::adapter-> Platform -> Devices .clear ();
9899 Err = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
99100 } catch (ur_result_t CatchErr) {
100101 // Clear and rethrow to allow retry
101- Platform. Devices .clear ();
102+ ur::hip::adapter-> Platform -> Devices .clear ();
102103 Err = CatchErr;
103104 throw CatchErr;
104105 } catch (...) {
@@ -113,7 +114,7 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries,
113114 }
114115
115116 if (phPlatforms != nullptr ) {
116- *phPlatforms = & Platform;
117+ *phPlatforms = ur::hip::adapter-> Platform . get () ;
117118 }
118119
119120 return Result;
0 commit comments