https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/146840
>From eea3f1a2f5af14ac83c11bfb8da1d4be620d3078 Mon Sep 17 00:00:00 2001 From: Fraser Cormack <fra...@codeplay.com> Date: Thu, 3 Jul 2025 10:45:05 +0100 Subject: [PATCH 1/3] [libclc] Reduce include usage in OpenCL builtins This commit starts the process of reducing the amount of code included by OpenCL builtins, hopefully reducing build times in the process. It introduces a minimal OpenCL header - opencl-base.h - which includes only the OpenCL type definitions and the macros necessary for declaring/defining functions. Where the OpenCL builtin implementations would currently include the whole of <clc/opencl/clc.h>, which defines *all* OpenCL builtins, now they include only the specific declaration they need. This mirrors how the CLC builtins are defined. --- libclc/opencl/include/clc/opencl/clc.h | 14 +--------- .../opencl/include/clc/opencl/integer/abs.h | 7 +++++ .../include/clc/opencl/integer/abs_diff.h | 7 +++++ .../include/clc/opencl/integer/add_sat.h | 7 +++++ .../opencl/include/clc/opencl/integer/clz.h | 7 +++++ .../opencl/include/clc/opencl/integer/ctz.h | 7 +++++ .../opencl/include/clc/opencl/integer/hadd.h | 7 +++++ .../opencl/include/clc/opencl/integer/mad24.h | 7 +++++ .../include/clc/opencl/integer/mad_hi.h | 7 +++++ .../include/clc/opencl/integer/mad_sat.h | 7 +++++ .../opencl/include/clc/opencl/integer/mul24.h | 7 +++++ .../include/clc/opencl/integer/mul_hi.h | 7 +++++ .../include/clc/opencl/integer/popcount.h | 7 +++++ .../include/clc/opencl/integer/rotate.h | 7 +++++ .../include/clc/opencl/integer/upsample.h | 7 +++++ .../opencl/include/clc/opencl/opencl-base.h | 26 +++++++++++++++++++ libclc/opencl/lib/generic/integer/abs.cl | 2 +- libclc/opencl/lib/generic/integer/abs_diff.cl | 2 +- libclc/opencl/lib/generic/integer/add_sat.cl | 2 +- libclc/opencl/lib/generic/integer/clz.cl | 2 +- libclc/opencl/lib/generic/integer/ctz.cl | 2 +- libclc/opencl/lib/generic/integer/hadd.cl | 2 +- libclc/opencl/lib/generic/integer/mad24.cl | 2 +- libclc/opencl/lib/generic/integer/mad_hi.cl | 2 +- libclc/opencl/lib/generic/integer/mad_sat.cl | 2 +- libclc/opencl/lib/generic/integer/mul24.cl | 2 +- libclc/opencl/lib/generic/integer/mul_hi.cl | 2 +- libclc/opencl/lib/generic/integer/popcount.cl | 2 +- libclc/opencl/lib/generic/integer/rotate.cl | 2 +- libclc/opencl/lib/generic/integer/upsample.cl | 2 +- 30 files changed, 139 insertions(+), 27 deletions(-) create mode 100644 libclc/opencl/include/clc/opencl/opencl-base.h diff --git a/libclc/opencl/include/clc/opencl/clc.h b/libclc/opencl/include/clc/opencl/clc.h index 5859a00c3158b..7d34f00113517 100644 --- a/libclc/opencl/include/clc/opencl/clc.h +++ b/libclc/opencl/include/clc/opencl/clc.h @@ -15,19 +15,7 @@ #pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable -#ifdef cl_khr_fp64 -#pragma OPENCL EXTENSION cl_khr_fp64 : enable -#endif - -#ifdef cl_khr_fp16 -#pragma OPENCL EXTENSION cl_khr_fp16 : enable -#endif - -/* Function Attributes */ -#include <clc/clcfunc.h> - -/* 6.1 Supported Data Types */ -#include <clc/clctypes.h> +#include <clc/opencl/opencl-base.h> /* 6.2.3 Explicit Conversions */ #include <clc/opencl/convert.h> diff --git a/libclc/opencl/include/clc/opencl/integer/abs.h b/libclc/opencl/include/clc/opencl/integer/abs.h index 22ba40fb40d42..be064fa33afbc 100644 --- a/libclc/opencl/include/clc/opencl/integer/abs.h +++ b/libclc/opencl/include/clc/opencl/integer/abs.h @@ -6,5 +6,12 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_ABS_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_ABS_H__ + +#include <clc/opencl/opencl-base.h> + #define __CLC_BODY <clc/opencl/integer/abs.inc> #include <clc/integer/gentype.inc> + +#endif // __CLC_OPENCL_OPENCL_INTEGER_ABS_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/abs_diff.h b/libclc/opencl/include/clc/opencl/integer/abs_diff.h index f22cc4d88afcf..1716eb24df614 100644 --- a/libclc/opencl/include/clc/opencl/integer/abs_diff.h +++ b/libclc/opencl/include/clc/opencl/integer/abs_diff.h @@ -6,5 +6,12 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_ABS_DIFF_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_ABS_DIFF_H__ + +#include <clc/opencl/opencl-base.h> + #define __CLC_BODY <clc/opencl/integer/abs_diff.inc> #include <clc/integer/gentype.inc> + +#endif // __CLC_OPENCL_OPENCL_INTEGER_ABS_DIFF_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/add_sat.h b/libclc/opencl/include/clc/opencl/integer/add_sat.h index c0acb63e945d5..ff373b57ff3cc 100644 --- a/libclc/opencl/include/clc/opencl/integer/add_sat.h +++ b/libclc/opencl/include/clc/opencl/integer/add_sat.h @@ -6,9 +6,16 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_ADD_SAT_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_ADD_SAT_H__ + +#include <clc/opencl/opencl-base.h> + #define FUNCTION add_sat #define __CLC_BODY <clc/shared/binary_decl.inc> #include <clc/integer/gentype.inc> #undef FUNCTION + +#endif // __CLC_OPENCL_OPENCL_INTEGER_ADD_SAT_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/clz.h b/libclc/opencl/include/clc/opencl/integer/clz.h index b05f8b27b0541..cbd1776896fca 100644 --- a/libclc/opencl/include/clc/opencl/integer/clz.h +++ b/libclc/opencl/include/clc/opencl/integer/clz.h @@ -6,9 +6,16 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_CLZ_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_CLZ_H__ + +#include <clc/opencl/opencl-base.h> + #define FUNCTION clz #define __CLC_BODY <clc/shared/unary_decl.inc> #include <clc/integer/gentype.inc> #undef FUNCTION + +#endif // __CLC_OPENCL_OPENCL_INTEGER_CLZ_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/ctz.h b/libclc/opencl/include/clc/opencl/integer/ctz.h index 44ca8fe541ef9..f84c2a080552a 100644 --- a/libclc/opencl/include/clc/opencl/integer/ctz.h +++ b/libclc/opencl/include/clc/opencl/integer/ctz.h @@ -6,8 +6,13 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_CTZ_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_CTZ_H__ + #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0 +#include <clc/opencl/opencl-base.h> + #define FUNCTION ctz #define __CLC_BODY <clc/shared/unary_decl.inc> @@ -16,3 +21,5 @@ #undef FUNCTION #endif // __OPENCL_C_VERSION__ >= CL_VERSION_2_0 + +#endif // __CLC_OPENCL_OPENCL_INTEGER_CTZ_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/hadd.h b/libclc/opencl/include/clc/opencl/integer/hadd.h index fc66fab1bbfba..d3347c37c230e 100644 --- a/libclc/opencl/include/clc/opencl/integer/hadd.h +++ b/libclc/opencl/include/clc/opencl/integer/hadd.h @@ -6,9 +6,16 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_HADD_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_HADD_H__ + +#include <clc/opencl/opencl-base.h> + #define FUNCTION hadd #define __CLC_BODY <clc/shared/binary_decl.inc> #include <clc/integer/gentype.inc> #undef FUNCTION + +#endif // __CLC_OPENCL_OPENCL_INTEGER_HADD_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/mad24.h b/libclc/opencl/include/clc/opencl/integer/mad24.h index 7c5f4d478cd95..5432afd676493 100644 --- a/libclc/opencl/include/clc/opencl/integer/mad24.h +++ b/libclc/opencl/include/clc/opencl/integer/mad24.h @@ -6,9 +6,16 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_MAD24_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_MAD24_H__ + +#include <clc/opencl/opencl-base.h> + #define FUNCTION mad24 #define __CLC_BODY <clc/shared/ternary_decl.inc> #include <clc/integer/gentype24.inc> #undef FUNCTION + +#endif // __CLC_OPENCL_OPENCL_INTEGER_MAD24_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/mad_hi.h b/libclc/opencl/include/clc/opencl/integer/mad_hi.h index c68d1b65dcf24..fff3282fe46a0 100644 --- a/libclc/opencl/include/clc/opencl/integer/mad_hi.h +++ b/libclc/opencl/include/clc/opencl/integer/mad_hi.h @@ -6,9 +6,16 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_MAD_HI_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_MAD_HI_H__ + +#include <clc/opencl/opencl-base.h> + #define FUNCTION mad_hi #define __CLC_BODY <clc/shared/ternary_decl.inc> #include <clc/integer/gentype.inc> #undef FUNCTION + +#endif // __CLC_OPENCL_OPENCL_INTEGER_MAD_HI_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/mad_sat.h b/libclc/opencl/include/clc/opencl/integer/mad_sat.h index 02ced7a74b2b1..b6aa9b3cdebd2 100644 --- a/libclc/opencl/include/clc/opencl/integer/mad_sat.h +++ b/libclc/opencl/include/clc/opencl/integer/mad_sat.h @@ -6,9 +6,16 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_MAD_SAT_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_MAD_SAT_H__ + +#include <clc/opencl/opencl-base.h> + #define FUNCTION mad_sat #define __CLC_BODY <clc/shared/ternary_decl.inc> #include <clc/integer/gentype.inc> #undef FUNCTION + +#endif // __CLC_OPENCL_OPENCL_INTEGER_MAD_SAT_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/mul24.h b/libclc/opencl/include/clc/opencl/integer/mul24.h index 67aebcaf2a308..a8f66671f1523 100644 --- a/libclc/opencl/include/clc/opencl/integer/mul24.h +++ b/libclc/opencl/include/clc/opencl/integer/mul24.h @@ -6,9 +6,16 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_MUL24_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_MUL24_H__ + +#include <clc/opencl/opencl-base.h> + #define FUNCTION mul24 #define __CLC_BODY <clc/shared/binary_decl.inc> #include <clc/integer/gentype24.inc> #undef FUNCTION + +#endif // __CLC_OPENCL_OPENCL_INTEGER_MUL24_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/mul_hi.h b/libclc/opencl/include/clc/opencl/integer/mul_hi.h index 24a9d1b8f8035..3d9d98b63ad8a 100644 --- a/libclc/opencl/include/clc/opencl/integer/mul_hi.h +++ b/libclc/opencl/include/clc/opencl/integer/mul_hi.h @@ -6,9 +6,16 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_MUL_HI_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_MUL_HI_H__ + +#include <clc/opencl/opencl-base.h> + #define FUNCTION mul_hi #define __CLC_BODY <clc/shared/binary_decl.inc> #include <clc/integer/gentype.inc> #undef FUNCTION + +#endif // __CLC_OPENCL_OPENCL_INTEGER_MUL_HI_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/popcount.h b/libclc/opencl/include/clc/opencl/integer/popcount.h index 301f30cb7a6bf..67edb9e46b5cb 100644 --- a/libclc/opencl/include/clc/opencl/integer/popcount.h +++ b/libclc/opencl/include/clc/opencl/integer/popcount.h @@ -6,9 +6,16 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_POPCOUNT_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_POPCOUNT_H__ + +#include <clc/opencl/opencl-base.h> + #define FUNCTION popcount #define __CLC_BODY <clc/shared/unary_decl.inc> #include <clc/integer/gentype.inc> #undef FUNCTION + +#endif // __CLC_OPENCL_OPENCL_INTEGER_POPCOUNT_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/rotate.h b/libclc/opencl/include/clc/opencl/integer/rotate.h index be4fe2680d34a..661b53e65cb45 100644 --- a/libclc/opencl/include/clc/opencl/integer/rotate.h +++ b/libclc/opencl/include/clc/opencl/integer/rotate.h @@ -6,9 +6,16 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_ROTATE_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_ROTATE_H__ + +#include <clc/opencl/opencl-base.h> + #define FUNCTION rotate #define __CLC_BODY <clc/shared/binary_decl.inc> #include <clc/integer/gentype.inc> #undef FUNCTION + +#endif // __CLC_OPENCL_OPENCL_INTEGER_ROTATE_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/upsample.h b/libclc/opencl/include/clc/opencl/integer/upsample.h index 0db67dfe4e973..c277d3dbc9c4c 100644 --- a/libclc/opencl/include/clc/opencl/integer/upsample.h +++ b/libclc/opencl/include/clc/opencl/integer/upsample.h @@ -6,6 +6,11 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_OPENCL_INTEGER_UPSAMPLE_H__ +#define __CLC_OPENCL_OPENCL_INTEGER_UPSAMPLE_H__ + +#include <clc/opencl/opencl-base.h> + #define __CLC_UPSAMPLE_DECL(BGENTYPE, GENTYPE, UGENTYPE) \ _CLC_OVERLOAD _CLC_DECL BGENTYPE upsample(GENTYPE hi, UGENTYPE lo); @@ -30,3 +35,5 @@ __CLC_UPSAMPLE_TYPES() #undef __CLC_UPSAMPLE_TYPES #undef __CLC_UPSAMPLE_DECL #undef __CLC_UPSAMPLE_VEC + +#endif // __CLC_OPENCL_OPENCL_INTEGER_UPSAMPLE_H__ diff --git a/libclc/opencl/include/clc/opencl/opencl-base.h b/libclc/opencl/include/clc/opencl/opencl-base.h new file mode 100644 index 0000000000000..ac0dd0f129707 --- /dev/null +++ b/libclc/opencl/include/clc/opencl/opencl-base.h @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef __CLC_OPENCL_OPENCL_BASE_H__ +#define __CLC_OPENCL_OPENCL_BASE_H__ + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +#endif + +/* Function Attributes */ +#include <clc/clcfunc.h> + +/* 6.1 Supported Data Types */ +#include <clc/clctypes.h> + +#endif // __CLC_OPENCL_OPENCL_BASE_H__ diff --git a/libclc/opencl/lib/generic/integer/abs.cl b/libclc/opencl/lib/generic/integer/abs.cl index 5d354d97e71c5..0771ec7934330 100644 --- a/libclc/opencl/lib/generic/integer/abs.cl +++ b/libclc/opencl/lib/generic/integer/abs.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_abs.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/abs.h> #define __CLC_BODY <abs.inc> #include <clc/integer/gentype.inc> diff --git a/libclc/opencl/lib/generic/integer/abs_diff.cl b/libclc/opencl/lib/generic/integer/abs_diff.cl index 73d6631b3a4a3..d65b0468a7f21 100644 --- a/libclc/opencl/lib/generic/integer/abs_diff.cl +++ b/libclc/opencl/lib/generic/integer/abs_diff.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_abs_diff.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/abs_diff.h> #define __CLC_BODY <abs_diff.inc> #include <clc/integer/gentype.inc> diff --git a/libclc/opencl/lib/generic/integer/add_sat.cl b/libclc/opencl/lib/generic/integer/add_sat.cl index 8fe1d32a82216..50d989a47211b 100644 --- a/libclc/opencl/lib/generic/integer/add_sat.cl +++ b/libclc/opencl/lib/generic/integer/add_sat.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_add_sat.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/add_sat.h> #define FUNCTION add_sat #define __CLC_BODY <clc/shared/binary_def.inc> diff --git a/libclc/opencl/lib/generic/integer/clz.cl b/libclc/opencl/lib/generic/integer/clz.cl index cf12a9838c6d7..58110df1eec24 100644 --- a/libclc/opencl/lib/generic/integer/clz.cl +++ b/libclc/opencl/lib/generic/integer/clz.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_clz.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/clz.h> #define FUNCTION clz #define __CLC_BODY <clc/shared/unary_def.inc> diff --git a/libclc/opencl/lib/generic/integer/ctz.cl b/libclc/opencl/lib/generic/integer/ctz.cl index 1b0470e08fd36..cbb167275a4a6 100644 --- a/libclc/opencl/lib/generic/integer/ctz.cl +++ b/libclc/opencl/lib/generic/integer/ctz.cl @@ -9,7 +9,7 @@ #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0 #include <clc/integer/clc_ctz.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/ctz.h> #define FUNCTION ctz #define __CLC_BODY <clc/shared/unary_def.inc> diff --git a/libclc/opencl/lib/generic/integer/hadd.cl b/libclc/opencl/lib/generic/integer/hadd.cl index 100cb7bf207a5..e9edc88bce02c 100644 --- a/libclc/opencl/lib/generic/integer/hadd.cl +++ b/libclc/opencl/lib/generic/integer/hadd.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_hadd.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/hadd.h> #define FUNCTION hadd #define __CLC_BODY <clc/shared/binary_def.inc> diff --git a/libclc/opencl/lib/generic/integer/mad24.cl b/libclc/opencl/lib/generic/integer/mad24.cl index d42873f1dd15e..5e9dfb3b3031a 100644 --- a/libclc/opencl/lib/generic/integer/mad24.cl +++ b/libclc/opencl/lib/generic/integer/mad24.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_mad24.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/mad24.h> #define FUNCTION mad24 #define __CLC_BODY <clc/shared/ternary_def.inc> diff --git a/libclc/opencl/lib/generic/integer/mad_hi.cl b/libclc/opencl/lib/generic/integer/mad_hi.cl index 68e610d400cc1..786614e42bc8b 100644 --- a/libclc/opencl/lib/generic/integer/mad_hi.cl +++ b/libclc/opencl/lib/generic/integer/mad_hi.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_mad_hi.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/mad_hi.h> #define FUNCTION mad_hi #define __CLC_BODY <clc/shared/ternary_def.inc> diff --git a/libclc/opencl/lib/generic/integer/mad_sat.cl b/libclc/opencl/lib/generic/integer/mad_sat.cl index d9daf56632b07..54ddc0eed2d17 100644 --- a/libclc/opencl/lib/generic/integer/mad_sat.cl +++ b/libclc/opencl/lib/generic/integer/mad_sat.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_mad_sat.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/mad_sat.h> #define FUNCTION mad_sat #define __CLC_BODY <clc/shared/ternary_def.inc> diff --git a/libclc/opencl/lib/generic/integer/mul24.cl b/libclc/opencl/lib/generic/integer/mul24.cl index b0a9ff80f3528..e6db6b89c5d98 100644 --- a/libclc/opencl/lib/generic/integer/mul24.cl +++ b/libclc/opencl/lib/generic/integer/mul24.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_mul24.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/mul24.h> #define FUNCTION mul24 #define __CLC_BODY <clc/shared/binary_def.inc> diff --git a/libclc/opencl/lib/generic/integer/mul_hi.cl b/libclc/opencl/lib/generic/integer/mul_hi.cl index 40cb359f5b296..4c7b8c2caa994 100644 --- a/libclc/opencl/lib/generic/integer/mul_hi.cl +++ b/libclc/opencl/lib/generic/integer/mul_hi.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_mul_hi.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/mul_hi.h> #define FUNCTION mul_hi #define __CLC_BODY <clc/shared/binary_def.inc> diff --git a/libclc/opencl/lib/generic/integer/popcount.cl b/libclc/opencl/lib/generic/integer/popcount.cl index a349f454813ef..3c33c82302c39 100644 --- a/libclc/opencl/lib/generic/integer/popcount.cl +++ b/libclc/opencl/lib/generic/integer/popcount.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_popcount.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/popcount.h> #define FUNCTION popcount #define __CLC_BODY <clc/shared/unary_def.inc> diff --git a/libclc/opencl/lib/generic/integer/rotate.cl b/libclc/opencl/lib/generic/integer/rotate.cl index a340ccf77b2ea..282270f3b3ff2 100644 --- a/libclc/opencl/lib/generic/integer/rotate.cl +++ b/libclc/opencl/lib/generic/integer/rotate.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_rotate.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/rotate.h> #define FUNCTION rotate #define __CLC_BODY <clc/shared/binary_def.inc> diff --git a/libclc/opencl/lib/generic/integer/upsample.cl b/libclc/opencl/lib/generic/integer/upsample.cl index 32cb3cffc9ebd..5f95c811e058d 100644 --- a/libclc/opencl/lib/generic/integer/upsample.cl +++ b/libclc/opencl/lib/generic/integer/upsample.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_upsample.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/upsample.h> #define __CLC_UPSAMPLE_IMPL(BGENTYPE, GENTYPE, UGENTYPE) \ _CLC_OVERLOAD _CLC_DEF BGENTYPE upsample(GENTYPE hi, UGENTYPE lo) { \ >From 51f5a1cd6ece28feb1177648ee5cc4668917252e Mon Sep 17 00:00:00 2001 From: Fraser Cormack <fra...@codeplay.com> Date: Fri, 4 Jul 2025 11:11:29 +0100 Subject: [PATCH 2/3] fix includes --- libclc/opencl/include/clc/opencl/integer/abs.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/abs_diff.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/add_sat.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/clz.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/ctz.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/hadd.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/mad24.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/mad_hi.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/mad_sat.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/mul24.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/mul_hi.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/popcount.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/rotate.h | 6 +++--- libclc/opencl/include/clc/opencl/integer/upsample.h | 6 +++--- 14 files changed, 42 insertions(+), 42 deletions(-) diff --git a/libclc/opencl/include/clc/opencl/integer/abs.h b/libclc/opencl/include/clc/opencl/integer/abs.h index be064fa33afbc..3059bef9a7e4f 100644 --- a/libclc/opencl/include/clc/opencl/integer/abs.h +++ b/libclc/opencl/include/clc/opencl/integer/abs.h @@ -6,12 +6,12 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_ABS_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_ABS_H__ +#ifndef __CLC_OPENCL_INTEGER_ABS_H__ +#define __CLC_OPENCL_INTEGER_ABS_H__ #include <clc/opencl/opencl-base.h> #define __CLC_BODY <clc/opencl/integer/abs.inc> #include <clc/integer/gentype.inc> -#endif // __CLC_OPENCL_OPENCL_INTEGER_ABS_H__ +#endif // __CLC_OPENCL_INTEGER_ABS_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/abs_diff.h b/libclc/opencl/include/clc/opencl/integer/abs_diff.h index 1716eb24df614..9e8fe2b31fed7 100644 --- a/libclc/opencl/include/clc/opencl/integer/abs_diff.h +++ b/libclc/opencl/include/clc/opencl/integer/abs_diff.h @@ -6,12 +6,12 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_ABS_DIFF_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_ABS_DIFF_H__ +#ifndef __CLC_OPENCL_INTEGER_ABS_DIFF_H__ +#define __CLC_OPENCL_INTEGER_ABS_DIFF_H__ #include <clc/opencl/opencl-base.h> #define __CLC_BODY <clc/opencl/integer/abs_diff.inc> #include <clc/integer/gentype.inc> -#endif // __CLC_OPENCL_OPENCL_INTEGER_ABS_DIFF_H__ +#endif // __CLC_OPENCL_INTEGER_ABS_DIFF_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/add_sat.h b/libclc/opencl/include/clc/opencl/integer/add_sat.h index ff373b57ff3cc..cd2c17a096299 100644 --- a/libclc/opencl/include/clc/opencl/integer/add_sat.h +++ b/libclc/opencl/include/clc/opencl/integer/add_sat.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_ADD_SAT_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_ADD_SAT_H__ +#ifndef __CLC_OPENCL_INTEGER_ADD_SAT_H__ +#define __CLC_OPENCL_INTEGER_ADD_SAT_H__ #include <clc/opencl/opencl-base.h> @@ -18,4 +18,4 @@ #undef FUNCTION -#endif // __CLC_OPENCL_OPENCL_INTEGER_ADD_SAT_H__ +#endif // __CLC_OPENCL_INTEGER_ADD_SAT_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/clz.h b/libclc/opencl/include/clc/opencl/integer/clz.h index cbd1776896fca..77032ceeaf0f4 100644 --- a/libclc/opencl/include/clc/opencl/integer/clz.h +++ b/libclc/opencl/include/clc/opencl/integer/clz.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_CLZ_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_CLZ_H__ +#ifndef __CLC_OPENCL_INTEGER_CLZ_H__ +#define __CLC_OPENCL_INTEGER_CLZ_H__ #include <clc/opencl/opencl-base.h> @@ -18,4 +18,4 @@ #undef FUNCTION -#endif // __CLC_OPENCL_OPENCL_INTEGER_CLZ_H__ +#endif // __CLC_OPENCL_INTEGER_CLZ_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/ctz.h b/libclc/opencl/include/clc/opencl/integer/ctz.h index f84c2a080552a..b861225846ee4 100644 --- a/libclc/opencl/include/clc/opencl/integer/ctz.h +++ b/libclc/opencl/include/clc/opencl/integer/ctz.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_CTZ_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_CTZ_H__ +#ifndef __CLC_OPENCL_INTEGER_CTZ_H__ +#define __CLC_OPENCL_INTEGER_CTZ_H__ #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0 @@ -22,4 +22,4 @@ #endif // __OPENCL_C_VERSION__ >= CL_VERSION_2_0 -#endif // __CLC_OPENCL_OPENCL_INTEGER_CTZ_H__ +#endif // __CLC_OPENCL_INTEGER_CTZ_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/hadd.h b/libclc/opencl/include/clc/opencl/integer/hadd.h index d3347c37c230e..c4c8f7daf4014 100644 --- a/libclc/opencl/include/clc/opencl/integer/hadd.h +++ b/libclc/opencl/include/clc/opencl/integer/hadd.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_HADD_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_HADD_H__ +#ifndef __CLC_OPENCL_INTEGER_HADD_H__ +#define __CLC_OPENCL_INTEGER_HADD_H__ #include <clc/opencl/opencl-base.h> @@ -18,4 +18,4 @@ #undef FUNCTION -#endif // __CLC_OPENCL_OPENCL_INTEGER_HADD_H__ +#endif // __CLC_OPENCL_INTEGER_HADD_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/mad24.h b/libclc/opencl/include/clc/opencl/integer/mad24.h index 5432afd676493..daee9a0383477 100644 --- a/libclc/opencl/include/clc/opencl/integer/mad24.h +++ b/libclc/opencl/include/clc/opencl/integer/mad24.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_MAD24_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_MAD24_H__ +#ifndef __CLC_OPENCL_INTEGER_MAD24_H__ +#define __CLC_OPENCL_INTEGER_MAD24_H__ #include <clc/opencl/opencl-base.h> @@ -18,4 +18,4 @@ #undef FUNCTION -#endif // __CLC_OPENCL_OPENCL_INTEGER_MAD24_H__ +#endif // __CLC_OPENCL_INTEGER_MAD24_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/mad_hi.h b/libclc/opencl/include/clc/opencl/integer/mad_hi.h index fff3282fe46a0..bbcdcd9c82ebd 100644 --- a/libclc/opencl/include/clc/opencl/integer/mad_hi.h +++ b/libclc/opencl/include/clc/opencl/integer/mad_hi.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_MAD_HI_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_MAD_HI_H__ +#ifndef __CLC_OPENCL_INTEGER_MAD_HI_H__ +#define __CLC_OPENCL_INTEGER_MAD_HI_H__ #include <clc/opencl/opencl-base.h> @@ -18,4 +18,4 @@ #undef FUNCTION -#endif // __CLC_OPENCL_OPENCL_INTEGER_MAD_HI_H__ +#endif // __CLC_OPENCL_INTEGER_MAD_HI_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/mad_sat.h b/libclc/opencl/include/clc/opencl/integer/mad_sat.h index b6aa9b3cdebd2..28045477975ed 100644 --- a/libclc/opencl/include/clc/opencl/integer/mad_sat.h +++ b/libclc/opencl/include/clc/opencl/integer/mad_sat.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_MAD_SAT_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_MAD_SAT_H__ +#ifndef __CLC_OPENCL_INTEGER_MAD_SAT_H__ +#define __CLC_OPENCL_INTEGER_MAD_SAT_H__ #include <clc/opencl/opencl-base.h> @@ -18,4 +18,4 @@ #undef FUNCTION -#endif // __CLC_OPENCL_OPENCL_INTEGER_MAD_SAT_H__ +#endif // __CLC_OPENCL_INTEGER_MAD_SAT_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/mul24.h b/libclc/opencl/include/clc/opencl/integer/mul24.h index a8f66671f1523..6aa799a28b7ec 100644 --- a/libclc/opencl/include/clc/opencl/integer/mul24.h +++ b/libclc/opencl/include/clc/opencl/integer/mul24.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_MUL24_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_MUL24_H__ +#ifndef __CLC_OPENCL_INTEGER_MUL24_H__ +#define __CLC_OPENCL_INTEGER_MUL24_H__ #include <clc/opencl/opencl-base.h> @@ -18,4 +18,4 @@ #undef FUNCTION -#endif // __CLC_OPENCL_OPENCL_INTEGER_MUL24_H__ +#endif // __CLC_OPENCL_INTEGER_MUL24_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/mul_hi.h b/libclc/opencl/include/clc/opencl/integer/mul_hi.h index 3d9d98b63ad8a..ed7ac7319cab8 100644 --- a/libclc/opencl/include/clc/opencl/integer/mul_hi.h +++ b/libclc/opencl/include/clc/opencl/integer/mul_hi.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_MUL_HI_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_MUL_HI_H__ +#ifndef __CLC_OPENCL_INTEGER_MUL_HI_H__ +#define __CLC_OPENCL_INTEGER_MUL_HI_H__ #include <clc/opencl/opencl-base.h> @@ -18,4 +18,4 @@ #undef FUNCTION -#endif // __CLC_OPENCL_OPENCL_INTEGER_MUL_HI_H__ +#endif // __CLC_OPENCL_INTEGER_MUL_HI_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/popcount.h b/libclc/opencl/include/clc/opencl/integer/popcount.h index 67edb9e46b5cb..43d5bc0f0b335 100644 --- a/libclc/opencl/include/clc/opencl/integer/popcount.h +++ b/libclc/opencl/include/clc/opencl/integer/popcount.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_POPCOUNT_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_POPCOUNT_H__ +#ifndef __CLC_OPENCL_INTEGER_POPCOUNT_H__ +#define __CLC_OPENCL_INTEGER_POPCOUNT_H__ #include <clc/opencl/opencl-base.h> @@ -18,4 +18,4 @@ #undef FUNCTION -#endif // __CLC_OPENCL_OPENCL_INTEGER_POPCOUNT_H__ +#endif // __CLC_OPENCL_INTEGER_POPCOUNT_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/rotate.h b/libclc/opencl/include/clc/opencl/integer/rotate.h index 661b53e65cb45..156155ae0638a 100644 --- a/libclc/opencl/include/clc/opencl/integer/rotate.h +++ b/libclc/opencl/include/clc/opencl/integer/rotate.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_ROTATE_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_ROTATE_H__ +#ifndef __CLC_OPENCL_INTEGER_ROTATE_H__ +#define __CLC_OPENCL_INTEGER_ROTATE_H__ #include <clc/opencl/opencl-base.h> @@ -18,4 +18,4 @@ #undef FUNCTION -#endif // __CLC_OPENCL_OPENCL_INTEGER_ROTATE_H__ +#endif // __CLC_OPENCL_INTEGER_ROTATE_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/upsample.h b/libclc/opencl/include/clc/opencl/integer/upsample.h index c277d3dbc9c4c..a713f2b392f27 100644 --- a/libclc/opencl/include/clc/opencl/integer/upsample.h +++ b/libclc/opencl/include/clc/opencl/integer/upsample.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef __CLC_OPENCL_OPENCL_INTEGER_UPSAMPLE_H__ -#define __CLC_OPENCL_OPENCL_INTEGER_UPSAMPLE_H__ +#ifndef __CLC_OPENCL_INTEGER_UPSAMPLE_H__ +#define __CLC_OPENCL_INTEGER_UPSAMPLE_H__ #include <clc/opencl/opencl-base.h> @@ -36,4 +36,4 @@ __CLC_UPSAMPLE_TYPES() #undef __CLC_UPSAMPLE_DECL #undef __CLC_UPSAMPLE_VEC -#endif // __CLC_OPENCL_OPENCL_INTEGER_UPSAMPLE_H__ +#endif // __CLC_OPENCL_INTEGER_UPSAMPLE_H__ >From 23d28cef32e91b1679a810200809e0cad5a35082 Mon Sep 17 00:00:00 2001 From: Fraser Cormack <fra...@codeplay.com> Date: Mon, 7 Jul 2025 09:54:55 +0100 Subject: [PATCH 3/3] add sub_sat/rhadd --- libclc/opencl/include/clc/opencl/integer/rhadd.h | 5 +++++ libclc/opencl/include/clc/opencl/integer/sub_sat.h | 5 +++++ libclc/opencl/lib/generic/integer/rhadd.cl | 2 +- libclc/opencl/lib/generic/integer/sub_sat.cl | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libclc/opencl/include/clc/opencl/integer/rhadd.h b/libclc/opencl/include/clc/opencl/integer/rhadd.h index b1a46e998493f..2c93c100cf02f 100644 --- a/libclc/opencl/include/clc/opencl/integer/rhadd.h +++ b/libclc/opencl/include/clc/opencl/integer/rhadd.h @@ -6,9 +6,14 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_INTEGER_RHADD_H__ +#define __CLC_OPENCL_INTEGER_RHADD_H__ + #define FUNCTION rhadd #define __CLC_BODY <clc/shared/binary_decl.inc> #include <clc/integer/gentype.inc> #undef FUNCTION + +#endif // __CLC_OPENCL_INTEGER_RHADD_H__ diff --git a/libclc/opencl/include/clc/opencl/integer/sub_sat.h b/libclc/opencl/include/clc/opencl/integer/sub_sat.h index 65f57a17b0fee..a7861ee1ac4a1 100644 --- a/libclc/opencl/include/clc/opencl/integer/sub_sat.h +++ b/libclc/opencl/include/clc/opencl/integer/sub_sat.h @@ -6,9 +6,14 @@ // //===----------------------------------------------------------------------===// +#ifndef __CLC_OPENCL_INTEGER_SUB_SAT_H__ +#define __CLC_OPENCL_INTEGER_SUB_SAT_H__ + #define FUNCTION sub_sat #define __CLC_BODY <clc/shared/binary_decl.inc> #include <clc/integer/gentype.inc> #undef FUNCTION + +#endif // __CLC_OPENCL_INTEGER_SUB_SAT_H__ diff --git a/libclc/opencl/lib/generic/integer/rhadd.cl b/libclc/opencl/lib/generic/integer/rhadd.cl index 539def845488d..f835511899429 100644 --- a/libclc/opencl/lib/generic/integer/rhadd.cl +++ b/libclc/opencl/lib/generic/integer/rhadd.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_rhadd.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/rhadd.h> #define FUNCTION rhadd #define __CLC_BODY <clc/shared/binary_def.inc> diff --git a/libclc/opencl/lib/generic/integer/sub_sat.cl b/libclc/opencl/lib/generic/integer/sub_sat.cl index 46596724358ab..0b45df1118f14 100644 --- a/libclc/opencl/lib/generic/integer/sub_sat.cl +++ b/libclc/opencl/lib/generic/integer/sub_sat.cl @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/integer/clc_sub_sat.h> -#include <clc/opencl/clc.h> +#include <clc/opencl/integer/sub_sat.h> #define FUNCTION sub_sat #define __CLC_BODY <clc/shared/binary_def.inc> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits