Skip to content
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

[SYCL][UR][L0] Distinguish min/max calls from macros #1045

Merged
merged 1 commit into from
Nov 8, 2023
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
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 @@ -177,7 +177,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 @@ -1240,7 +1240,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
Loading