Skip to content

Commit b67504c

Browse files
authored
[libclc] Tighten OpenCL builtin include strategy (#147276)
This commit continues the work from #146840 and extends it to the maths, geomtrics, common, and relational directories. All headers have include guards and, where appropriate, include the minimal code required for their specific definitions. Implementation files no longer include the large catch-all header of all OpenCL builtin declarations.
1 parent fd997d8 commit b67504c

File tree

255 files changed

+791
-136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+791
-136
lines changed

libclc/opencl/include/clc/opencl/common/degrees.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#ifndef __CLC_OPENCL_COMMON_DEGREES_H__
10+
#define __CLC_OPENCL_COMMON_DEGREES_H__
11+
912
#define FUNCTION degrees
1013
#define __CLC_BODY <clc/math/unary_decl.inc>
1114

1215
#include <clc/math/gentype.inc>
1316

1417
#undef FUNCTION
18+
19+
#endif // __CLC_OPENCL_COMMON_DEGREES_H__

libclc/opencl/include/clc/opencl/common/mix.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#ifndef __CLC_OPENCL_COMMON_MIX_H__
10+
#define __CLC_OPENCL_COMMON_MIX_H__
11+
912
#define __CLC_BODY <clc/opencl/common/mix.inc>
1013
#include <clc/math/gentype.inc>
14+
15+
#endif // __CLC_OPENCL_COMMON_MIX_H__

libclc/opencl/include/clc/opencl/common/radians.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#ifndef __CLC_OPENCL_COMMON_RADIANS_H__
10+
#define __CLC_OPENCL_COMMON_RADIANS_H__
11+
912
#define FUNCTION radians
1013
#define __CLC_BODY <clc/math/unary_decl.inc>
1114

1215
#include <clc/math/gentype.inc>
1316

1417
#undef FUNCTION
18+
19+
#endif // __CLC_OPENCL_COMMON_RADIANS_H__

libclc/opencl/include/clc/opencl/common/sign.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#ifndef __CLC_OPENCL_COMMON_SIGN_H__
10+
#define __CLC_OPENCL_COMMON_SIGN_H__
11+
912
#define FUNCTION sign
1013
#define __CLC_BODY <clc/math/unary_decl.inc>
1114
#include <clc/math/gentype.inc>
1215
#undef FUNCTION
16+
17+
#endif // __CLC_OPENCL_COMMON_SIGN_H__

libclc/opencl/include/clc/opencl/common/smoothstep.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#ifndef __CLC_OPENCL_COMMON_SMOOTHSTEP_H__
10+
#define __CLC_OPENCL_COMMON_SMOOTHSTEP_H__
11+
912
#define __CLC_BODY <clc/opencl/common/smoothstep.inc>
1013
#include <clc/math/gentype.inc>
14+
15+
#endif // __CLC_OPENCL_COMMON_SMOOTHSTEP_H__

libclc/opencl/include/clc/opencl/common/step.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#ifndef __CLC_OPENCL_COMMON_STEP_H__
10+
#define __CLC_OPENCL_COMMON_STEP_H__
11+
912
#define __CLC_BODY <clc/opencl/common/step.inc>
1013
#include <clc/math/gentype.inc>
14+
15+
#endif // __CLC_OPENCL_COMMON_STEP_H__

libclc/opencl/include/clc/opencl/geometric/cross.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#ifndef __CLC_OPENCL_GEOMETRIC_CROSS_H__
10+
#define __CLC_OPENCL_GEOMETRIC_CROSS_H__
11+
912
_CLC_OVERLOAD _CLC_DECL float3 cross(float3 p0, float3 p1);
1013
_CLC_OVERLOAD _CLC_DECL float4 cross(float4 p0, float4 p1);
1114

1215
#ifdef cl_khr_fp64
1316
_CLC_OVERLOAD _CLC_DECL double3 cross(double3 p0, double3 p1);
1417
_CLC_OVERLOAD _CLC_DECL double4 cross(double4 p0, double4 p1);
1518
#endif
19+
20+
#endif // __CLC_OPENCL_GEOMETRIC_CROSS_H__

libclc/opencl/include/clc/opencl/geometric/distance.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#ifndef __CLC_OPENCL_GEOMETRIC_DISTANCE_H__
10+
#define __CLC_OPENCL_GEOMETRIC_DISTANCE_H__
11+
912
#define FUNCTION distance
1013
#define __CLC_BODY <clc/geometric/binary_decl.inc>
1114

1215
#include <clc/math/gentype.inc>
1316

1417
#undef FUNCTION
18+
19+
#endif // __CLC_OPENCL_GEOMETRIC_DISTANCE_H__

libclc/opencl/include/clc/opencl/geometric/dot.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#ifndef __CLC_OPENCL_GEOMETRIC_DOT_H__
10+
#define __CLC_OPENCL_GEOMETRIC_DOT_H__
11+
912
#define FUNCTION dot
1013
#define __CLC_BODY <clc/geometric/binary_decl.inc>
1114

1215
#include <clc/math/gentype.inc>
1316

1417
#undef FUNCTION
18+
19+
#endif // __CLC_OPENCL_GEOMETRIC_DOT_H__

libclc/opencl/include/clc/opencl/geometric/fast_distance.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#ifndef __CLC_OPENCL_GEOMETRIC_FAST_DISTANCE_H__
10+
#define __CLC_OPENCL_GEOMETRIC_FAST_DISTANCE_H__
11+
912
#define __FLOAT_ONLY
1013
#define FUNCTION fast_distance
1114
#define __CLC_BODY <clc/geometric/binary_decl.inc>
1215

1316
#include <clc/math/gentype.inc>
1417

1518
#undef FUNCTION
19+
20+
#endif // __CLC_OPENCL_GEOMETRIC_FAST_DISTANCE_H__

0 commit comments

Comments
 (0)