[libclc] [libclc] Add missing includes to CLC headers (PR #118654)
Fraser Cormack via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 4 07:27:46 PST 2024
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/118654
There's no automatic way of checking these headers are self-contained.
Instead of including these common files many times across the whole codebase, we can include them in the generic `gentype.inc` and `floatn.inc` files which are included by most CLC headers.
>From a517c852d6e1d49f65a1873bd0dfba27064c491b Mon Sep 17 00:00:00 2001
From: Fraser Cormack <fraser at codeplay.com>
Date: Wed, 4 Dec 2024 15:08:20 +0000
Subject: [PATCH] [libclc] Add missing includes to CLC headers
---
libclc/{generic => clc}/include/clc/geometric/floatn.inc | 3 +++
libclc/clc/include/clc/integer/gentype.inc | 3 +++
libclc/clc/include/clc/math/gentype.inc | 3 +++
libclc/clc/include/clc/math/unary_intrin.inc | 3 +++
libclc/clc/include/clc/relational/clc_all.h | 1 +
libclc/clc/include/clc/relational/clc_any.h | 1 +
libclc/clc/include/clc/relational/clc_isequal.h | 1 +
libclc/clc/include/clc/relational/clc_isinf.h | 1 +
libclc/clc/include/clc/relational/clc_isnan.h | 1 +
libclc/clc/include/clc/relational/floatn.inc | 2 ++
libclc/clc/include/clc/shared/clc_clamp.h | 3 ---
11 files changed, 19 insertions(+), 3 deletions(-)
rename libclc/{generic => clc}/include/clc/geometric/floatn.inc (96%)
diff --git a/libclc/generic/include/clc/geometric/floatn.inc b/libclc/clc/include/clc/geometric/floatn.inc
similarity index 96%
rename from libclc/generic/include/clc/geometric/floatn.inc
rename to libclc/clc/include/clc/geometric/floatn.inc
index 49c797f9f18458..919c2cadbff4f5 100644
--- a/libclc/generic/include/clc/geometric/floatn.inc
+++ b/libclc/clc/include/clc/geometric/floatn.inc
@@ -1,3 +1,6 @@
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
+
#define __CLC_FLOAT float
#define __CLC_FPSIZE 32
diff --git a/libclc/clc/include/clc/integer/gentype.inc b/libclc/clc/include/clc/integer/gentype.inc
index 2c8dd143db8798..98682a6d32c709 100644
--- a/libclc/clc/include/clc/integer/gentype.inc
+++ b/libclc/clc/include/clc/integer/gentype.inc
@@ -1,3 +1,6 @@
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
+
// These 2 defines only change when switching between data sizes or base types
// to keep this file manageable.
#define __CLC_GENSIZE 8
diff --git a/libclc/clc/include/clc/math/gentype.inc b/libclc/clc/include/clc/math/gentype.inc
index 966b4269f66c16..87719f2d9bc0e7 100644
--- a/libclc/clc/include/clc/math/gentype.inc
+++ b/libclc/clc/include/clc/math/gentype.inc
@@ -1,3 +1,6 @@
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
+
#define __CLC_SCALAR_GENTYPE float
#define __CLC_FPSIZE 32
diff --git a/libclc/clc/include/clc/math/unary_intrin.inc b/libclc/clc/include/clc/math/unary_intrin.inc
index c331d3ff08a61d..5ea2246244bef7 100644
--- a/libclc/clc/include/clc/math/unary_intrin.inc
+++ b/libclc/clc/include/clc/math/unary_intrin.inc
@@ -1,3 +1,6 @@
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
+
_CLC_OVERLOAD float __CLC_FUNCTION(float f) __asm(__CLC_INTRINSIC ".f32");
_CLC_OVERLOAD float2 __CLC_FUNCTION(float2 f) __asm(__CLC_INTRINSIC ".v2f32");
_CLC_OVERLOAD float3 __CLC_FUNCTION(float3 f) __asm(__CLC_INTRINSIC ".v3f32");
diff --git a/libclc/clc/include/clc/relational/clc_all.h b/libclc/clc/include/clc/relational/clc_all.h
index bf068105aa1be1..7be3d132dd53d0 100644
--- a/libclc/clc/include/clc/relational/clc_all.h
+++ b/libclc/clc/include/clc/relational/clc_all.h
@@ -7,6 +7,7 @@
#else
#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
#define _CLC_ALL_DECL(TYPE) _CLC_OVERLOAD _CLC_DECL int __clc_all(TYPE v);
diff --git a/libclc/clc/include/clc/relational/clc_any.h b/libclc/clc/include/clc/relational/clc_any.h
index f947b77e08341f..27dbffeb2eecd9 100644
--- a/libclc/clc/include/clc/relational/clc_any.h
+++ b/libclc/clc/include/clc/relational/clc_any.h
@@ -7,6 +7,7 @@
#else
#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
#define _CLC_ANY_DECL(TYPE) _CLC_OVERLOAD _CLC_DECL int __clc_any(TYPE v);
diff --git a/libclc/clc/include/clc/relational/clc_isequal.h b/libclc/clc/include/clc/relational/clc_isequal.h
index 3a36ea24fd2994..0f31fb9530a14e 100644
--- a/libclc/clc/include/clc/relational/clc_isequal.h
+++ b/libclc/clc/include/clc/relational/clc_isequal.h
@@ -7,6 +7,7 @@
#else
#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
#define _CLC_ISEQUAL_DECL(TYPE, RETTYPE) \
_CLC_OVERLOAD _CLC_DECL RETTYPE __clc_isequal(TYPE x, TYPE y);
diff --git a/libclc/clc/include/clc/relational/clc_isinf.h b/libclc/clc/include/clc/relational/clc_isinf.h
index c33ef9bb9527d3..3f60bec5654a2e 100644
--- a/libclc/clc/include/clc/relational/clc_isinf.h
+++ b/libclc/clc/include/clc/relational/clc_isinf.h
@@ -7,6 +7,7 @@
#else
#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
#define _CLC_ISINF_DECL(RET_TYPE, ARG_TYPE) \
_CLC_OVERLOAD _CLC_DECL RET_TYPE __clc_isinf(ARG_TYPE);
diff --git a/libclc/clc/include/clc/relational/clc_isnan.h b/libclc/clc/include/clc/relational/clc_isnan.h
index 08351eb5515f9c..3200e593c5cff4 100644
--- a/libclc/clc/include/clc/relational/clc_isnan.h
+++ b/libclc/clc/include/clc/relational/clc_isnan.h
@@ -7,6 +7,7 @@
#else
#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
#define _CLC_ISNAN_DECL(RET_TYPE, ARG_TYPE) \
_CLC_OVERLOAD _CLC_DECL RET_TYPE __clc_isnan(ARG_TYPE);
diff --git a/libclc/clc/include/clc/relational/floatn.inc b/libclc/clc/include/clc/relational/floatn.inc
index fc0d6878b4aa7d..18fb20bd9effee 100644
--- a/libclc/clc/include/clc/relational/floatn.inc
+++ b/libclc/clc/include/clc/relational/floatn.inc
@@ -1,3 +1,5 @@
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
#define __CLC_FLOATN float
#define __CLC_INTN int
diff --git a/libclc/clc/include/clc/shared/clc_clamp.h b/libclc/clc/include/clc/shared/clc_clamp.h
index a84184c1750a58..d9d39413c5618d 100644
--- a/libclc/clc/include/clc/shared/clc_clamp.h
+++ b/libclc/clc/include/clc/shared/clc_clamp.h
@@ -6,9 +6,6 @@
#define __clc_clamp clamp
#else
-#include <clc/clcfunc.h>
-#include <clc/clctypes.h>
-
#define __CLC_BODY <clc/shared/clc_clamp.inc>
#include <clc/integer/gentype.inc>
More information about the cfe-commits
mailing list