[libc-commits] [libc] [libc] Order GPU targets after the generated stdint.h (PR #231229)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Tue Oct 13 08:06:38 PDT 2026
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/231229
>From 407db391b34d39f4c3e1072dbc11c05090f4b212 Mon Sep 17 00:00:00 2001
From: carodewig <crodewig at nvidia.com>
Date: Mon, 12 Oct 2026 16:43:19 +0000
Subject: [PATCH 1/4] [libc] Order GPU utils after the generated stdint.h
src/__support/GPU/utils.h includes <gpuintrin.h>, which includes
<stdint.h>. In full builds that resolves to the stdint.h generated by
libc.include.stdint, but the utils header library declares no
dependencies, so nothing orders its users after the header is generated.
In a fresh build directory ninja may compile them before or while
stdint.h is written, the same race as #149993.
Declare the dependency through libc.hdr.stdint_proxy, as other targets
using <stdint.h> do.
Assisted-by: Devin
---
libc/src/__support/GPU/CMakeLists.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libc/src/__support/GPU/CMakeLists.txt b/libc/src/__support/GPU/CMakeLists.txt
index c99c4716c0b479..9f950716a283de 100644
--- a/libc/src/__support/GPU/CMakeLists.txt
+++ b/libc/src/__support/GPU/CMakeLists.txt
@@ -7,6 +7,8 @@ add_header_library(
utils
HDRS
utils.h
+ DEPENDS
+ libc.hdr.stdint_proxy
)
add_header_library(
>From 5784d1ebae8c647486696b6a9a86f4031ca8b6ae Mon Sep 17 00:00:00 2001
From: carodewig <crodewig at nvidia.com>
Date: Mon, 12 Oct 2026 16:44:12 +0000
Subject: [PATCH 2/4] [libc] Use the stdint proxy in GPU fixedbuffer
fixedbuffer.h was added after <stdint.h> includes were converted to
hdr/stdint_proxy.h (#150303), and includes <stdint.h> directly. Its
header library also declares no dependencies, so it does not order its
users after the generated stdint.h, nor after CPP.atomic, which it
includes too.
Include the proxy header and declare both dependencies.
Assisted-by: Devin
---
libc/src/__support/GPU/CMakeLists.txt | 3 +++
libc/src/__support/GPU/fixedbuffer.h | 3 +--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libc/src/__support/GPU/CMakeLists.txt b/libc/src/__support/GPU/CMakeLists.txt
index 9f950716a283de..5ae4eac3d0f230 100644
--- a/libc/src/__support/GPU/CMakeLists.txt
+++ b/libc/src/__support/GPU/CMakeLists.txt
@@ -15,6 +15,9 @@ add_header_library(
fixedbuffer
HDRS
fixedbuffer.h
+ DEPENDS
+ libc.hdr.stdint_proxy
+ libc.src.__support.CPP.atomic
)
add_object_library(
diff --git a/libc/src/__support/GPU/fixedbuffer.h b/libc/src/__support/GPU/fixedbuffer.h
index 05a4a01be7ea75..069cf179fc28bc 100644
--- a/libc/src/__support/GPU/fixedbuffer.h
+++ b/libc/src/__support/GPU/fixedbuffer.h
@@ -9,10 +9,9 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_GPU_FIXEDBUFFER_H
#define LLVM_LIBC_SRC___SUPPORT_GPU_FIXEDBUFFER_H
+#include "hdr/stdint_proxy.h"
#include "src/__support/CPP/atomic.h"
-#include <stdint.h>
-
namespace LIBC_NAMESPACE_DECL {
// A lock-free fixed capacity buffer for caching pointer-like values. Uses a
>From be9bce669e794518203ebbc8ed14ee5c4bebc3dd Mon Sep 17 00:00:00 2001
From: carodewig <crodewig at nvidia.com>
Date: Mon, 12 Oct 2026 16:44:45 +0000
Subject: [PATCH 3/4] [libc] Order rpc_client after the generated stdint.h
rpc_client.h includes shared/rpc.h, whose rpc_util.h includes
<stdint.h> and <gpuintrin.h>. The shared/ headers are also used outside
libc, so they cannot include hdr/stdint_proxy.h, and the dependency on
the generated stdint.h has to be declared by the libc target instead.
Without it, a fresh build can compile rpc_client.cpp while stdint.h is
still being written and fail with "unknown type name 'uint32_t'".
Assisted-by: Devin
---
libc/src/__support/RPC/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/libc/src/__support/RPC/CMakeLists.txt b/libc/src/__support/RPC/CMakeLists.txt
index cac9c4e05e3698..cbf20fa0e920e8 100644
--- a/libc/src/__support/RPC/CMakeLists.txt
+++ b/libc/src/__support/RPC/CMakeLists.txt
@@ -9,5 +9,6 @@ add_object_library(
HDRS
rpc_client.h
DEPENDS
+ libc.hdr.stdint_proxy
libc.src.__support.GPU.utils
)
>From 3f3606bd6c20dad9c759268a496ad4891ea255ba Mon Sep 17 00:00:00 2001
From: carodewig <crodewig at nvidia.com>
Date: Mon, 12 Oct 2026 16:53:09 +0000
Subject: [PATCH 4/4] [libc] Declare GPU utils dependency of GPU time_utils
time_utils.h includes src/__support/GPU/utils.h, but the time_utils
target has never declared libc.src.__support.GPU.utils. That was
harmless while utils.h only pulled in headers from the source tree, but
it now includes <gpuintrin.h> and so <stdint.h>, which is generated in
full builds. Without the dependency, time_utils and its users are not
ordered after the generated header.
Assisted-by: Devin
---
libc/src/__support/time/gpu/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/libc/src/__support/time/gpu/CMakeLists.txt b/libc/src/__support/time/gpu/CMakeLists.txt
index fc465e0cea25ff..a15a9d26dc03a9 100644
--- a/libc/src/__support/time/gpu/CMakeLists.txt
+++ b/libc/src/__support/time/gpu/CMakeLists.txt
@@ -7,6 +7,7 @@ add_object_library(
DEPENDS
libc.hdr.types.clock_t
libc.hdr.time_macros
+ libc.src.__support.GPU.utils
)
add_object_library(
More information about the libc-commits
mailing list