Skip to content

[UR][CUDA][HIP] Cleanup adapter code #18370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 13, 2025
Merged
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
10 changes: 1 addition & 9 deletions unified-runtime/source/adapters/cuda/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ ur_context_handle_t_::getOwningURPool(umf_memory_pool_t *UMFPool) {
}

/// Create a UR CUDA context.
///
/// By default creates a scoped context and keeps the last active CUDA context
/// on top of the CUDA context stack.
/// With the __SYCL_PI_CONTEXT_PROPERTIES_CUDA_PRIMARY key/id and a value of
/// PI_TRUE creates a primary CUDA context and activates it on the CUDA context
/// stack.
///
UR_APIEXPORT ur_result_t UR_APICALL
urContextCreate(uint32_t DeviceCount, const ur_device_handle_t *phDevices,
const ur_context_properties_t * /*pProperties*/,
Expand Down Expand Up @@ -94,8 +87,7 @@ urContextRelease(ur_context_handle_t hContext) {
return UR_RESULT_SUCCESS;
}
hContext->invokeExtendedDeleters();

std::unique_ptr<ur_context_handle_t_> Context{hContext};
delete hContext;

return UR_RESULT_SUCCESS;
}
Expand Down
5 changes: 2 additions & 3 deletions unified-runtime/source/adapters/cuda/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(ur_platform_handle_t hPlatform,
uint32_t NumEntries,
ur_device_handle_t *phDevices,
uint32_t *pNumDevices) {
ur_result_t Result = UR_RESULT_SUCCESS;
const bool AskingForAll = DeviceType == UR_DEVICE_TYPE_ALL;
const bool AskingForDefault = DeviceType == UR_DEVICE_TYPE_DEFAULT;
const bool AskingForGPU = DeviceType == UR_DEVICE_TYPE_GPU;
Expand All @@ -1234,13 +1233,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(ur_platform_handle_t hPlatform,
phDevices[i] = hPlatform->Devices[i].get();
}
}

return Result;
} catch (ur_result_t Err) {
return Err;
} catch (...) {
return UR_RESULT_ERROR_OUT_OF_RESOURCES;
}

return UR_RESULT_SUCCESS;
}

/// Gets the native CUDA handle of a UR device object
Expand Down
Loading
Loading