summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/0004-refactor-use-std-numeric_limits-to-get-max-value.patch
blob: 2d857c6ba6f83b135e4dd810e4523ffdce6bb273 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
From 3e7b32bf2d6042314772249532e80517e9126bc5 Mon Sep 17 00:00:00 2001
From: Bartosz Dunajski <bartosz.dunajski@intel.com>
Date: Wed, 7 Jan 2026 08:11:57 +0000
Subject: [PATCH] refactor: use std::numeric_limits to get max value

Newer GCC (16.x) no longer pulls in <climits> transitively, so the use
of ULONG_MAX failed to build. Upstream replaced ULONG_MAX with
std::numeric_limits<uint64_t>::max(), which removes the dependency on
the macro entirely. Backported verbatim to fix the build on the pinned
releases/25.48 branch.

Upstream-Status: Backport [https://github.com/intel/compute-runtime/commit/3e7b32bf2d6042314772249532e80517e9126bc5]

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
---
 shared/source/os_interface/linux/pmt_util.cpp            | 9 ++++-----
 .../linux/product_helper_uuid_xehp_and_later.inl         | 4 ++--
 shared/source/xe_hpc_core/linux/product_helper_pvc.cpp   | 4 +++-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/shared/source/os_interface/linux/pmt_util.cpp b/shared/source/os_interface/linux/pmt_util.cpp
index 1f8546afb8e17..6ac63aa99a400 100644
--- a/shared/source/os_interface/linux/pmt_util.cpp
+++ b/shared/source/os_interface/linux/pmt_util.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021-2023 Intel Corporation
+ * Copyright (C) 2021-2026 Intel Corporation
  *
  * SPDX-License-Identifier: MIT
  *
@@ -11,12 +11,11 @@
 #include "shared/source/os_interface/linux/sys_calls.h"
 #include "shared/source/utilities/directory.h"
 
-#include <climits>
-
 #include <algorithm>
 #include <array>
 #include <cstdint>
 #include <fcntl.h>
+#include <limits>
 #include <map>
 #include <sstream>
 #include <string_view>
@@ -75,7 +74,7 @@ bool PmtUtil::readOffset(std::string_view telemDir, uint64_t &offset) {
     ssize_t bytesRead = 0;
     std::array<char, 16> offsetString = {'\0'};
     if (fd > 0) {
-        offset = ULONG_MAX;
+        offset = std::numeric_limits<uint64_t>::max();
         bytesRead = SysCalls::pread(fd, offsetString.data(), offsetString.size() - 1, 0);
     }
     if (bytesRead <= 0) {
@@ -85,7 +84,7 @@ bool PmtUtil::readOffset(std::string_view telemDir, uint64_t &offset) {
     std::replace(offsetString.begin(), offsetString.end(), '\n', '\0');
     offset = std::strtoul(offsetString.data(), nullptr, 10);
 
-    if (offset == ULONG_MAX) {
+    if (offset == std::numeric_limits<uint64_t>::max()) {
         return false;
     }
     return true;
diff --git a/shared/source/os_interface/linux/product_helper_uuid_xehp_and_later.inl b/shared/source/os_interface/linux/product_helper_uuid_xehp_and_later.inl
index d2187052db709..cd940cd149b41 100644
--- a/shared/source/os_interface/linux/product_helper_uuid_xehp_and_later.inl
+++ b/shared/source/os_interface/linux/product_helper_uuid_xehp_and_later.inl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021-2025 Intel Corporation
+ * Copyright (C) 2021-2026 Intel Corporation
  *
  * SPDX-License-Identifier: MIT
  *
@@ -37,7 +37,7 @@ bool ProductHelperHw<gfxProduct>::getUuid(DriverModel *driverModel, const uint32
         return false;
     }
 
-    uint64_t offset = ULONG_MAX;
+    uint64_t offset = std::numeric_limits<uint64_t>::max();
     if (!PmtUtil::readOffset(telemDir, offset)) {
         return false;
     }
diff --git a/shared/source/xe_hpc_core/linux/product_helper_pvc.cpp b/shared/source/xe_hpc_core/linux/product_helper_pvc.cpp
index 6451de9b4f6a6..8ea0239c7ef90 100644
--- a/shared/source/xe_hpc_core/linux/product_helper_pvc.cpp
+++ b/shared/source/xe_hpc_core/linux/product_helper_pvc.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021-2025 Intel Corporation
+ * Copyright (C) 2021-2026 Intel Corporation
  *
  * SPDX-License-Identifier: MIT
  *
@@ -18,6 +18,8 @@
 #include "shared/source/utilities/directory.h"
 #include "shared/source/xe_hpc_core/hw_cmds_pvc.h"
 
+#include <limits>
+
 constexpr static auto gfxProduct = IGFX_PVC;
 
 namespace NEO {
-- 
2.34.1