From 13a4186c96b1be341f1d070dfdcb33f632b9453a Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 4 Dec 2024 08:58:51 -0500 Subject: [PATCH] util/bitpack_helpers: make partially CL safe add enough preprocessor guards that we can include this from CL and get basic implementations of things. FIXED packs are missing due to llroundf (probably fixable). Signed-off-by: Alyssa Rosenzweig Reviewed-by: Mary Guillemard Reviewed-by: Karol Herbst Part-of: --- src/util/bitpack_helpers.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util/bitpack_helpers.h b/src/util/bitpack_helpers.h index d490ccac5f9..2e3122f97cc 100644 --- a/src/util/bitpack_helpers.h +++ b/src/util/bitpack_helpers.h @@ -24,6 +24,7 @@ #ifndef UTIL_BITPACK_HELPERS_H #define UTIL_BITPACK_HELPERS_H +#ifndef __OPENCL_VERSION__ #include #include @@ -38,6 +39,9 @@ VALGRIND_CHECK_MEM_IS_DEFINED(&(x), sizeof(x)) #endif #endif +#else +#include "compiler/libcl/libcl.h" +#endif #ifndef util_bitpack_validate_value #define util_bitpack_validate_value(x) @@ -115,6 +119,7 @@ util_bitpack_float_nonzero(float v) return util_bitpack_float(v); } +#ifndef __OPENCL_VERSION__ ALWAYS_INLINE static uint64_t util_bitpack_sfixed(float v, uint32_t start, uint32_t end, uint32_t fract_bits) @@ -206,5 +211,6 @@ util_bitpack_ufixed_nonzero(float v, uint32_t start, uint32_t end, assert(v != 0.0f); return util_bitpack_ufixed(v, start, end, fract_bits); } +#endif #endif /* UTIL_BITPACK_HELPERS_H */