[libc-commits] [libc] [libc] Only include GPU utils when targeting GPU (PR #84999)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Tue Mar 12 17:13:27 PDT 2024


https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/84999

This code shouldn't be needed on non-GPU platforms.

>From 063eb5f55e95f5d0e4308b103075fb0fffc9da2e Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Tue, 12 Mar 2024 17:06:40 -0700
Subject: [PATCH] [libc] Only include GPU utils when targeting GPU

This code shouldn't be needed on non-GPU platforms.
---
 libc/src/stdlib/rand_util.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libc/src/stdlib/rand_util.h b/libc/src/stdlib/rand_util.h
index cadd6b5cdcbb8c..036d6331b47f43 100644
--- a/libc/src/stdlib/rand_util.h
+++ b/libc/src/stdlib/rand_util.h
@@ -9,7 +9,9 @@
 #ifndef LLVM_LIBC_SRC_STDLIB_RAND_UTIL_H
 #define LLVM_LIBC_SRC_STDLIB_RAND_UTIL_H
 
+#ifdef LIBC_TARGET_ARCH_IS_GPU
 #include "src/__support/GPU/utils.h"
+#endif
 #include "src/__support/macros/attributes.h"
 
 namespace LIBC_NAMESPACE {



More information about the libc-commits mailing list