Fixed OpenCL printf by not mangling the symbol:
diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
index b6bcf32c09c0..14fa7654849a 100644
--- a/clang/lib/Headers/opencl-c-base.h
+++ b/clang/lib/Headers/opencl-c-base.h
@@ -688,7 +688,15 @@ template <typename _Tp> struct __remove_address_space<__constant _Tp> {
#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
// OpenCL v1.2 s6.12.13, v2.0 s6.13.13 - printf
-int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)));
+#ifdef __OPENCL_CPP_VERSION__
+#define CLINKAGE extern "C"
+#else
+#define CLINKAGE
+#endif
+
+CLINKAGE int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)));
+
+#undef CLINKAGE
#endif
#ifdef cl_intel_device_side_avc_motion_estimation
-> Allows printf usage in OpenCL again
TODO: open upstream PR
With printf, found a third issue in ZS decoder:
Sometimes statements like if (iThread == 0) printf("..."); are printed by all threads. Can be fixed with a barrier after the print.
-> Can be reproduced in both O2 and standalone decoder. Unsure how this is connected to the other issues.