Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongreig committed Dec 14, 2023
1 parent 771b743 commit 6a83d3e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions source/adapters/cuda/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,15 +1145,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceCreateWithNativeHandle(

std::vector<ur_platform_handle_t> Platforms(NumPlatforms);

Result = urPlatformGet(&AdapterHandle, 1, Platforms.size(), Platforms.data(),
nullptr);
Result =
urPlatformGet(&AdapterHandle, 1, NumPlatforms, Platforms.data(), nullptr);
if (Result != UR_RESULT_SUCCESS)
return Result;

// Iterate through platforms to find device that matches nativeHandle
for (auto Platform : Platforms) {
auto SearchRes = std::find_if(begin(Platform->Devices),
end(Platform->Devices), IsDevice);
for (const auto Platform : Platforms) {
auto SearchRes = std::find_if(std::begin(Platform->Devices),
std::end(Platform->Devices), IsDevice);
if (SearchRes != end(Platform->Devices)) {
*phDevice = static_cast<ur_device_handle_t>((*SearchRes).get());
return UR_RESULT_SUCCESS;
Expand Down
3 changes: 2 additions & 1 deletion source/adapters/cuda/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ struct ur_event_handle_t_ {
static ur_event_handle_t
makeNative(ur_command_t Type, ur_queue_handle_t Queue, CUstream Stream,
uint32_t StreamToken = std::numeric_limits<uint32_t>::max()) {
bool ProfilingEnabled = Queue->URFlags & UR_QUEUE_FLAG_PROFILING_ENABLE;
const bool ProfilingEnabled =
Queue->URFlags & UR_QUEUE_FLAG_PROFILING_ENABLE;
native_type EvEnd = nullptr, EvQueued = nullptr, EvStart = nullptr;
UR_CHECK_ERROR(cuEventCreate(
&EvEnd, ProfilingEnabled ? CU_EVENT_DEFAULT : CU_EVENT_DISABLE_TIMING));
Expand Down
3 changes: 2 additions & 1 deletion source/adapters/cuda/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ ur_result_t ur_program_handle_t_::buildProgram(const char *BuildOptions) {

if (!this->BuildOptions.empty()) {
unsigned int MaxRegs;
bool Valid = getMaxRegistersJitOptionValue(this->BuildOptions, MaxRegs);
const bool Valid =
getMaxRegistersJitOptionValue(this->BuildOptions, MaxRegs);
if (Valid) {
Options.push_back(CU_JIT_MAX_REGISTERS);
OptionVals.push_back(reinterpret_cast<void *>(MaxRegs));
Expand Down

0 comments on commit 6a83d3e

Please sign in to comment.