Skip to content

Commit

Permalink
fix windows build issue with numeric_limits
Browse files Browse the repository at this point in the history
  • Loading branch information
pengxin99 committed Mar 8, 2024
1 parent 10956de commit 16e00e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sdk/src/utils/ze_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ inline uint64_t GetDeviceTimestampMask(ze_device_handle_t device) {
o_api_string.c_str());
};
PTI_ASSERT(status == ZE_RESULT_SUCCESS);
return ((props.kernelTimestampValidBits == 64) ? std::numeric_limits<uint64_t>::max()
return ((props.kernelTimestampValidBits == 64) ? (std::numeric_limits<uint64_t>::max)()
: ((1ull << props.kernelTimestampValidBits) - 1ull));
}

Expand All @@ -533,7 +533,7 @@ inline uint64_t GetMetricTimestampMask(ze_device_handle_t device) {
if ((devicemask == 0x5600) || (devicemask == 0x4F00) || (devicemask == 0x0B00)) {
return (1ull << (props.kernelTimestampValidBits - 1)) - 1ull;
} else {
return ((props.kernelTimestampValidBits == 64) ? std::numeric_limits<uint64_t>::max()
return ((props.kernelTimestampValidBits == 64) ? (std::numeric_limits<uint64_t>::max)()
: ((1ull << props.kernelTimestampValidBits) - 1ull));
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions tools/oneprof/prof_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ProfOptions {
}

std::string GetLogFileName(
uint32_t pid = std::numeric_limits<uint32_t>::max()) const {
uint32_t pid = (std::numeric_limits<uint32_t>::max)()) const {
if (log_file_.empty()) {
return std::string();
}
Expand All @@ -74,7 +74,7 @@ class ProfOptions {
result << log_file_.substr(0, pos);
}

if (pid == std::numeric_limits<uint32_t>::max()) {
if (pid == (std::numeric_limits<uint32_t>::max)()) {
pid = utils::GetPid();
}
result << "." + std::to_string(pid);
Expand Down
4 changes: 2 additions & 2 deletions utils/ze_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ inline uint64_t GetDeviceTimestampMask(ze_device_handle_t device) {
ze_device_properties_t props{ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2, };
ze_result_t status = zeDeviceGetProperties(device, &props);
PTI_ASSERT(status == ZE_RESULT_SUCCESS);
return ((props.kernelTimestampValidBits == 64) ? std::numeric_limits<uint64_t>::max()
return ((props.kernelTimestampValidBits == 64) ? (std::numeric_limits<uint64_t>::max)()
: ((1ull << props.kernelTimestampValidBits) - 1ull));
}

Expand All @@ -372,7 +372,7 @@ inline uint64_t GetMetricTimestampMask(ze_device_handle_t device) {
return (1ull << (props.kernelTimestampValidBits - 1)) - 1ull;
}
else {
return ((props.kernelTimestampValidBits == 64) ? std::numeric_limits<uint64_t>::max()
return ((props.kernelTimestampValidBits == 64) ? (std::numeric_limits<uint64_t>::max)()
: ((1ull << props.kernelTimestampValidBits) - 1ull));
}
#endif
Expand Down

0 comments on commit 16e00e5

Please sign in to comment.