Skip to content

Commit 23c4c4b

Browse files
authored
[libspirv] Add include guards where appropriate (#18666)
These are technically required by OpenCL but not observed since downstream we unconditionally build libclc with all extensions enabled. Since this won't fly upstream, this commit prepares the ground for a more correct building of these libraries.
1 parent 809158f commit 23c4c4b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

libclc/libspirv/include/libspirv/image/image.h

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

9+
#if defined(__opencl_c_images)
10+
911
_CLC_OVERLOAD _CLC_DECL float __spirv_ImageRead__Rfloat(image2d_t image,
1012
int2 coord);
1113
_CLC_OVERLOAD _CLC_DECL float __spirv_ImageRead__Rfloat(image2d_t image,
@@ -113,3 +115,5 @@ _CLC_OVERLOAD _CLC_DECL void __spirv_ImageWrite(image2d_t image, int4 coord,
113115
_CLC_OVERLOAD _CLC_DECL void __spirv_ImageWrite(image3d_t image, int4 coord,
114116
half4 texel);
115117
#endif
118+
119+
#endif

libclc/libspirv/include/libspirv/spirv_types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,16 @@ typedef struct {
5050
float real, imag;
5151
} complex_float;
5252

53+
#ifdef cl_khr_fp64
5354
typedef struct {
5455
double real, imag;
5556
} complex_double;
57+
#endif
5658

59+
#ifdef cl_khr_fp16
5760
typedef struct {
5861
half real, imag;
5962
} complex_half;
63+
#endif
6064

6165
#endif // CLC_SPIRV_TYPES

0 commit comments

Comments
 (0)