Skip to content

Commit

Permalink
[SYCL][UR][L0] Distinguish min/max calls from macros
Browse files Browse the repository at this point in the history
  • Loading branch information
kswiecicki committed Oct 2, 2023
1 parent 133a525 commit 87f4bb1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion source/adapters/level_zero/command_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ ur_result_t calculateKernelWorkDimensions(
Device->ZeDeviceComputeProperties->maxGroupSizeX,
Device->ZeDeviceComputeProperties->maxGroupSizeY,
Device->ZeDeviceComputeProperties->maxGroupSizeZ};
GroupSize[I] = std::min(size_t(GroupSize[I]), GlobalWorkSize[I]);
GroupSize[I] = (std::min)(size_t(GroupSize[I]), GlobalWorkSize[I]);
while (GlobalWorkSize[I] % GroupSize[I]) {
--GroupSize[I];
}
Expand Down
4 changes: 2 additions & 2 deletions source/adapters/level_zero/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(

uint32_t ZeDeviceCount = MatchedDevices.size();

auto N = std::min(ZeDeviceCount, NumEntries);
auto N = (std::min)(ZeDeviceCount, NumEntries);
if (Devices)
std::copy_n(MatchedDevices.begin(), N, Devices);

Expand Down Expand Up @@ -1239,7 +1239,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceSelectBinary(
uint32_t *SelectedBinaryInd = SelectedBinary;

// Find the appropriate device image, fallback to spirv if not found
constexpr uint32_t InvalidInd = std::numeric_limits<uint32_t>::max();
constexpr uint32_t InvalidInd = (std::numeric_limits<uint32_t>::max)();
uint32_t Spirv = InvalidInd;

for (uint32_t i = 0; i < NumBinaries; ++i) {
Expand Down
8 changes: 4 additions & 4 deletions source/adapters/level_zero/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
UR_RESULT_ERROR_INVALID_VALUE);
if (LocalWorkSize) {
// L0
UR_ASSERT(LocalWorkSize[0] < std::numeric_limits<uint32_t>::max(),
UR_ASSERT(LocalWorkSize[0] < (std::numeric_limits<uint32_t>::max)(),
UR_RESULT_ERROR_INVALID_VALUE);
UR_ASSERT(LocalWorkSize[1] < std::numeric_limits<uint32_t>::max(),
UR_ASSERT(LocalWorkSize[1] < (std::numeric_limits<uint32_t>::max)(),
UR_RESULT_ERROR_INVALID_VALUE);
UR_ASSERT(LocalWorkSize[2] < std::numeric_limits<uint32_t>::max(),
UR_ASSERT(LocalWorkSize[2] < (std::numeric_limits<uint32_t>::max)(),
UR_RESULT_ERROR_INVALID_VALUE);
WG[0] = static_cast<uint32_t>(LocalWorkSize[0]);
WG[1] = static_cast<uint32_t>(LocalWorkSize[1]);
Expand All @@ -110,7 +110,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
Queue->Device->ZeDeviceComputeProperties->maxGroupSizeX,
Queue->Device->ZeDeviceComputeProperties->maxGroupSizeY,
Queue->Device->ZeDeviceComputeProperties->maxGroupSizeZ};
GroupSize[I] = std::min(size_t(GroupSize[I]), GlobalWorkSize[I]);
GroupSize[I] = (std::min)(size_t(GroupSize[I]), GlobalWorkSize[I]);
while (GlobalWorkSize[I] % GroupSize[I]) {
--GroupSize[I];
}
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformGet(
if (*NumPlatforms == 0)
*NumPlatforms = URPlatformsCache->size();
else
*NumPlatforms = std::min(URPlatformsCache->size(), (size_t)NumEntries);
*NumPlatforms = (std::min)(URPlatformsCache->size(), (size_t)NumEntries);
}

return UR_RESULT_SUCCESS;
Expand Down
8 changes: 4 additions & 4 deletions source/adapters/level_zero/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,8 +930,8 @@ ur_queue_handle_t_::ur_queue_handle_t_(
// Set-up to round-robin across allowed range of engines.
uint32_t FilterLowerIndex = getRangeOfAllowedComputeEngines().first;
uint32_t FilterUpperIndex = getRangeOfAllowedComputeEngines().second;
FilterUpperIndex = std::min((size_t)FilterUpperIndex,
FilterLowerIndex + ComputeQueues.size() - 1);
FilterUpperIndex = (std::min)((size_t)FilterUpperIndex,
FilterLowerIndex + ComputeQueues.size() - 1);
if (FilterLowerIndex <= FilterUpperIndex) {
ComputeQueueGroup.LowerIndex = FilterLowerIndex;
ComputeQueueGroup.UpperIndex = FilterUpperIndex;
Expand Down Expand Up @@ -959,8 +959,8 @@ ur_queue_handle_t_::ur_queue_handle_t_(
} else {
uint32_t FilterLowerIndex = Range.first;
uint32_t FilterUpperIndex = Range.second;
FilterUpperIndex = std::min((size_t)FilterUpperIndex,
FilterLowerIndex + CopyQueues.size() - 1);
FilterUpperIndex = (std::min)((size_t)FilterUpperIndex,
FilterLowerIndex + CopyQueues.size() - 1);
if (FilterLowerIndex <= FilterUpperIndex) {
CopyQueueGroup.ZeQueues = CopyQueues;
CopyQueueGroup.LowerIndex = FilterLowerIndex;
Expand Down

0 comments on commit 87f4bb1

Please sign in to comment.