mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-07-16 16:27:27 +00:00
opencl-cts: enforce -Werror flags and fix upstream build warnings
The recipe was suppressing errors by including '--compile-no-warning-as-error' and removing '-Werror=format-security' from SECURITY_STRINGFORMAT. Remove both workarounds and carry upstream patches that fix the underlying warnings instead. Signed-off-by: Antonios Christidis <a-christidis@ti.com> Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
committed by
Khem Raj
parent
ff14b970f6
commit
a9d4a92025
+209
@@ -0,0 +1,209 @@
|
||||
From ab834418e4250715868ba2b7d551c3c0e341a449 Mon Sep 17 00:00:00 2001
|
||||
From: Antonios Christidis <a-christidis@ti.com>
|
||||
Date: Wed, 24 Jun 2026 15:10:17 -0500
|
||||
Subject: [PATCH 1/2] commonfns: fix type mismatches across function templates
|
||||
|
||||
Across multiple function templates within commonfns, format compilation
|
||||
errors are showing up. These errors are originating from print statements,
|
||||
where there is a type mismatch between the format specifier and variable
|
||||
provided. The variable provided inherits its type from the function
|
||||
template, and when the type does not match the expected format specifier
|
||||
the error shows.
|
||||
|
||||
As an example:
|
||||
|
||||
test_step_fn<T> template calls verify_step<T> template with T being int.
|
||||
Within verify_step<T>, local variable r is also of type T. Later on in the
|
||||
function when going down either of the two log_error paths r gets printed
|
||||
using %a which expects a double. But r is of type int, so use conv_to_dbl()
|
||||
to convert.
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/KhronosGroup/OpenCL-CTS/pull/2728]
|
||||
|
||||
Signed-off-by: Antonios Christidis <a-christidis@ti.com>
|
||||
---
|
||||
test_conformance/commonfns/test_binary_fn.cpp | 14 ++++++++++----
|
||||
test_conformance/commonfns/test_clamp.cpp | 4 +++-
|
||||
test_conformance/commonfns/test_mix.cpp | 9 ++++++---
|
||||
test_conformance/commonfns/test_smoothstep.cpp | 8 +++++---
|
||||
test_conformance/commonfns/test_step.cpp | 7 +++++--
|
||||
test_conformance/commonfns/test_unary_fn.cpp | 12 ++++++++----
|
||||
6 files changed, 37 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/test_conformance/commonfns/test_binary_fn.cpp b/test_conformance/commonfns/test_binary_fn.cpp
|
||||
index 8ad347aa..4a86310a 100644
|
||||
--- a/test_conformance/commonfns/test_binary_fn.cpp
|
||||
+++ b/test_conformance/commonfns/test_binary_fn.cpp
|
||||
@@ -220,12 +220,15 @@ int max_verify(const T* const x, const T* const y, const T* const out,
|
||||
"(index %d is "
|
||||
"vector %d, element %d, for vector size %d)\n",
|
||||
k, conv_to_flt(x[k]), l, conv_to_flt(y[l]), k,
|
||||
- conv_to_flt(out[k]), v, k, i, j, vecSize);
|
||||
+ conv_to_flt(out[k]), conv_to_flt(v), k, i, j,
|
||||
+ vecSize);
|
||||
else
|
||||
log_error("x[%d]=%g y[%d]=%g out[%d]=%g, expected %g. "
|
||||
"(index %d is "
|
||||
"vector %d, element %d, for vector size %d)\n",
|
||||
- k, x[k], l, y[l], k, out[k], v, k, i, j, vecSize);
|
||||
+ k, conv_to_flt(x[k]), l, conv_to_flt(y[l]), k,
|
||||
+ conv_to_flt(out[k]), conv_to_flt(v), k, i, j,
|
||||
+ vecSize);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -251,12 +254,15 @@ int min_verify(const T* const x, const T* const y, const T* const out,
|
||||
"(index %d is "
|
||||
"vector %d, element %d, for vector size %d)\n",
|
||||
k, conv_to_flt(x[k]), l, conv_to_flt(y[l]), k,
|
||||
- conv_to_flt(out[k]), v, k, i, j, vecSize);
|
||||
+ conv_to_flt(out[k]), conv_to_flt(v), k, i, j,
|
||||
+ vecSize);
|
||||
else
|
||||
log_error("x[%d]=%g y[%d]=%g out[%d]=%g, expected %g. "
|
||||
"(index %d is "
|
||||
"vector %d, element %d, for vector size %d)\n",
|
||||
- k, x[k], l, y[l], k, out[k], v, k, i, j, vecSize);
|
||||
+ k, conv_to_flt(x[k]), l, conv_to_flt(y[l]), k,
|
||||
+ conv_to_flt(out[k]), conv_to_flt(v), k, i, j,
|
||||
+ vecSize);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
diff --git a/test_conformance/commonfns/test_clamp.cpp b/test_conformance/commonfns/test_clamp.cpp
|
||||
index 298811e2..0c272829 100644
|
||||
--- a/test_conformance/commonfns/test_clamp.cpp
|
||||
+++ b/test_conformance/commonfns/test_clamp.cpp
|
||||
@@ -138,7 +138,9 @@ int verify_clamp(const T *const x, const T *const minval, const T *const maxval,
|
||||
{
|
||||
log_error(
|
||||
"%d) verification error: clamp( %a, %a, %a) = *%a vs. %a\n",
|
||||
- i, x[i], minval[i], maxval[i], t, outptr[i]);
|
||||
+ i, conv_to_flt(x[i]), conv_to_flt(minval[i]),
|
||||
+ conv_to_flt(maxval[i]), conv_to_flt(t),
|
||||
+ conv_to_flt(outptr[i]));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
diff --git a/test_conformance/commonfns/test_mix.cpp b/test_conformance/commonfns/test_mix.cpp
|
||||
index ae543d0d..239a3380 100644
|
||||
--- a/test_conformance/commonfns/test_mix.cpp
|
||||
+++ b/test_conformance/commonfns/test_mix.cpp
|
||||
@@ -82,7 +82,9 @@ int verify_mix(const T *const inptrX, const T *const inptrY,
|
||||
{
|
||||
log_error("%d) verification error: mix(%a, %a, %a) = *%a "
|
||||
"vs. %a\n",
|
||||
- i, inptrX[i], inptrY[i], inptrA[i], r, outptr[i]);
|
||||
+ i, conv_to_flt(inptrX[i]), conv_to_flt(inptrY[i]),
|
||||
+ conv_to_flt(inptrA[i]), r,
|
||||
+ conv_to_flt(outptr[i]));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -111,8 +113,9 @@ int verify_mix(const T *const inptrX, const T *const inptrY,
|
||||
log_error(
|
||||
"{%d, element %d}) verification error: mix(%a, "
|
||||
"%a, %a) = *%a vs. %a\n",
|
||||
- ii, j, inptrX[vi], inptrY[vi], inptrA[i], r,
|
||||
- outptr[vi]);
|
||||
+ ii, j, conv_to_flt(inptrX[vi]),
|
||||
+ conv_to_flt(inptrY[vi]), conv_to_flt(inptrA[i]), r,
|
||||
+ conv_to_flt(outptr[vi]));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
diff --git a/test_conformance/commonfns/test_smoothstep.cpp b/test_conformance/commonfns/test_smoothstep.cpp
|
||||
index 6aaa800d..4a42513a 100644
|
||||
--- a/test_conformance/commonfns/test_smoothstep.cpp
|
||||
+++ b/test_conformance/commonfns/test_smoothstep.cpp
|
||||
@@ -84,7 +84,8 @@ int verify_smoothstep(const T *const edge0, const T *const edge1,
|
||||
log_error(
|
||||
"%d) verification error: smoothstep(%a, %a, %a) = "
|
||||
"*%a vs. %a\n",
|
||||
- i, x[i], edge0[i], edge1[i], r, outptr[i]);
|
||||
+ i, conv_to_flt(x[i]), conv_to_flt(edge0[i]),
|
||||
+ conv_to_flt(edge1[i]), r, conv_to_flt(outptr[i]));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -115,8 +116,9 @@ int verify_smoothstep(const T *const edge0, const T *const edge1,
|
||||
{
|
||||
log_error("{%d, element %d}) verification error: "
|
||||
"smoothstep(%a, %a, %a) = *%a vs. %a\n",
|
||||
- ii, j, x[vi], edge0[i], edge1[i], r,
|
||||
- outptr[vi]);
|
||||
+ ii, j, conv_to_flt(x[vi]),
|
||||
+ conv_to_flt(edge0[i]), conv_to_flt(edge1[i]),
|
||||
+ r, conv_to_flt(outptr[vi]));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
diff --git a/test_conformance/commonfns/test_step.cpp b/test_conformance/commonfns/test_step.cpp
|
||||
index e3a6fdf6..a98086bf 100644
|
||||
--- a/test_conformance/commonfns/test_step.cpp
|
||||
+++ b/test_conformance/commonfns/test_step.cpp
|
||||
@@ -81,12 +81,15 @@ int verify_step(const T *const inptrA, const T *const inptrB,
|
||||
"Failure @ {%d, element %d}: step(%a,%a) -> *%a "
|
||||
"vs %a\n",
|
||||
ii, j, conv_to_flt(inptrA[ii]),
|
||||
- conv_to_flt(inptrB[i]), r, conv_to_flt(outptr[i]));
|
||||
+ conv_to_flt(inptrB[i]), conv_to_dbl(r),
|
||||
+ conv_to_flt(outptr[i]));
|
||||
else
|
||||
log_error(
|
||||
"Failure @ {%d, element %d}: step(%a,%a) -> *%a "
|
||||
"vs %a\n",
|
||||
- ii, j, inptrA[ii], inptrB[i], r, outptr[i]);
|
||||
+ ii, j, conv_to_flt(inptrA[ii]),
|
||||
+ conv_to_flt(inptrB[i]), conv_to_dbl(r),
|
||||
+ conv_to_flt(outptr[i]));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
diff --git a/test_conformance/commonfns/test_unary_fn.cpp b/test_conformance/commonfns/test_unary_fn.cpp
|
||||
index 599067d2..ecd24822 100644
|
||||
--- a/test_conformance/commonfns/test_unary_fn.cpp
|
||||
+++ b/test_conformance/commonfns/test_unary_fn.cpp
|
||||
@@ -82,7 +82,8 @@ int verify_degrees(const T *const inptr, const T *const outptr, int n)
|
||||
else
|
||||
log_error(
|
||||
"%d) Error @ %a: *%a vs %a (*%g vs %g) ulps: %f\n", i,
|
||||
- inptr[i], r, outptr[i], r, outptr[i], error);
|
||||
+ conv_to_flt(inptr[i]), r, conv_to_flt(outptr[i]), r,
|
||||
+ conv_to_flt(outptr[i]), error);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -98,7 +99,8 @@ int verify_degrees(const T *const inptr, const T *const outptr, int n)
|
||||
log_info("degrees: Max error %f ulps at %d, input %a: *%a vs %a (*%g "
|
||||
"vs %g)\n",
|
||||
max_error, max_index, conv_to_flt(inptr[max_index]), max_val,
|
||||
- outptr[max_index], max_val, outptr[max_index]);
|
||||
+ conv_to_flt(outptr[max_index]), max_val,
|
||||
+ conv_to_flt(outptr[max_index]));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -131,7 +133,8 @@ int verify_radians(const T *const inptr, const T *const outptr, int n)
|
||||
else
|
||||
log_error(
|
||||
"%d) Error @ %a: *%a vs %a (*%g vs %g) ulps: %f\n", i,
|
||||
- inptr[i], r, outptr[i], r, outptr[i], error);
|
||||
+ conv_to_flt(inptr[i]), r, conv_to_flt(outptr[i]), r,
|
||||
+ conv_to_flt(outptr[i]), error);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -147,7 +150,8 @@ int verify_radians(const T *const inptr, const T *const outptr, int n)
|
||||
log_info("radians: Max error %f ulps at %d, input %a: *%a vs %a (*%g "
|
||||
"vs %g)\n",
|
||||
max_error, max_index, conv_to_flt(inptr[max_index]), max_val,
|
||||
- outptr[max_index], max_val, outptr[max_index]);
|
||||
+ conv_to_flt(outptr[max_index]), max_val,
|
||||
+ conv_to_flt(outptr[max_index]));
|
||||
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
From 51cab19be5be5f011705e75dcef3c360163f41a1 Mon Sep 17 00:00:00 2001
|
||||
From: Antonios Christidis <a-christidis@ti.com>
|
||||
Date: Wed, 24 Jun 2026 13:59:09 -0500
|
||||
Subject: [PATCH 1/3] test_unary_fn: Remove unused variable j
|
||||
|
||||
Remove unused variable j within verify_degrees and verify_radians function
|
||||
templates.
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/KhronosGroup/OpenCL-CTS/pull/2727]
|
||||
|
||||
Signed-off-by: Antonios Christidis <a-christidis@ti.com>
|
||||
---
|
||||
test_conformance/commonfns/test_unary_fn.cpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/test_conformance/commonfns/test_unary_fn.cpp b/test_conformance/commonfns/test_unary_fn.cpp
|
||||
index 599067d2..5bdc0270 100644
|
||||
--- a/test_conformance/commonfns/test_unary_fn.cpp
|
||||
+++ b/test_conformance/commonfns/test_unary_fn.cpp
|
||||
@@ -61,7 +61,7 @@ int verify_degrees(const T *const inptr, const T *const outptr, int n)
|
||||
double r, max_val = NAN;
|
||||
int max_index = 0;
|
||||
|
||||
- for (int i = 0, j = 0; i < n; i++, j++)
|
||||
+ for (int i = 0; i < n; i++)
|
||||
{
|
||||
r = (180.0 / M_PI) * conv_to_dbl(inptr[i]);
|
||||
|
||||
@@ -110,7 +110,7 @@ int verify_radians(const T *const inptr, const T *const outptr, int n)
|
||||
double r, max_val = NAN;
|
||||
int max_index = 0;
|
||||
|
||||
- for (int i = 0, j = 0; i < n; i++, j++)
|
||||
+ for (int i = 0; i < n; i++)
|
||||
{
|
||||
r = (M_PI / 180.0) * conv_to_dbl(inptr[i]);
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
From d06f56310e07e99d2450dbe728c37f3b34f966a3 Mon Sep 17 00:00:00 2001
|
||||
From: Antonios Christidis <a-christidis@ti.com>
|
||||
Date: Wed, 24 Jun 2026 14:26:32 -0500
|
||||
Subject: [PATCH 2/3] command_buffer_printf: Fix out of bounds pattern array
|
||||
|
||||
The way .back method works, is container.size() - 1, which can evaluated to
|
||||
-1 if size is 0. Since pattern_length >=1, (std::max(min_pattern_length,
|
||||
rand() % max_pattern_length), use that to post pend the null terminator.
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/KhronosGroup/OpenCL-CTS/pull/2727]
|
||||
|
||||
Signed-off-by: Antonios Christidis <a-christidis@ti.com>
|
||||
---
|
||||
.../extensions/cl_khr_command_buffer/command_buffer_printf.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_printf.cpp b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_printf.cpp
|
||||
index fee14571..ab0078aa 100644
|
||||
--- a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_printf.cpp
|
||||
+++ b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_printf.cpp
|
||||
@@ -283,7 +283,7 @@ struct CommandBufferPrintfTest : public BasicCommandBufferTest
|
||||
std::max(min_pattern_length, rand() % max_pattern_length);
|
||||
|
||||
std::vector<cl_char> pattern(pattern_length + 1, pattern_character);
|
||||
- pattern.back() = '\0';
|
||||
+ pattern[pattern_length] = '\0';
|
||||
enqueue_passes[i] = {
|
||||
pattern,
|
||||
{ cl_int(i * offset), cl_int(pattern_length) },
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From 8c9d444083b6ca4f7e9bebf6ab3b8a252cdbfec6 Mon Sep 17 00:00:00 2001
|
||||
From: Antonios Christidis <a-christidis@ti.com>
|
||||
Date: Wed, 24 Jun 2026 14:49:23 -0500
|
||||
Subject: [PATCH 2/2] commonfns: Remove -Wno-format flag
|
||||
|
||||
There are no longer issue with format.
|
||||
|
||||
Remove -Wno-format compiler flag for files within commonfns.
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/KhronosGroup/OpenCL-CTS/pull/2728]
|
||||
|
||||
Signed-off-by: Antonios Christidis <a-christidis@ti.com>
|
||||
---
|
||||
test_conformance/commonfns/CMakeLists.txt | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/test_conformance/commonfns/CMakeLists.txt b/test_conformance/commonfns/CMakeLists.txt
|
||||
index e7752474..bea20cf5 100644
|
||||
--- a/test_conformance/commonfns/CMakeLists.txt
|
||||
+++ b/test_conformance/commonfns/CMakeLists.txt
|
||||
@@ -10,6 +10,4 @@ set(${MODULE_NAME}_SOURCES
|
||||
test_binary_fn.cpp
|
||||
)
|
||||
|
||||
-set_gnulike_module_compile_flags("-Wno-format")
|
||||
-
|
||||
include(../CMakeCommon.txt)
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From e0439fd5cc889d64864c66b62ccf2d4e5accade0 Mon Sep 17 00:00:00 2001
|
||||
From: Antonios Christidis <a-christidis@ti.com>
|
||||
Date: Wed, 24 Jun 2026 16:02:02 -0500
|
||||
Subject: [PATCH 3/3] c11_atomics: Remove -Wno-format flag
|
||||
|
||||
Remove -Wno-format compiler flag for files within c11_atomics.
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/KhronosGroup/OpenCL-CTS/pull/2727]
|
||||
|
||||
Signed-off-by: Antonios Christidis <a-christidis@ti.com>
|
||||
---
|
||||
test_conformance/c11_atomics/CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test_conformance/c11_atomics/CMakeLists.txt b/test_conformance/c11_atomics/CMakeLists.txt
|
||||
index 25f0ba39..da39f5c2 100644
|
||||
--- a/test_conformance/c11_atomics/CMakeLists.txt
|
||||
+++ b/test_conformance/c11_atomics/CMakeLists.txt
|
||||
@@ -8,6 +8,6 @@ set(${MODULE_NAME}_SOURCES
|
||||
inclusive_scopes.cpp
|
||||
)
|
||||
|
||||
-set_gnulike_module_compile_flags("-Wno-sign-compare -Wno-format")
|
||||
+set_gnulike_module_compile_flags("-Wno-sign-compare")
|
||||
|
||||
include(../CMakeCommon.txt)
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -11,11 +11,16 @@ DEPENDS += "opencl-headers virtual/libopencl1 spirv-headers spirv-tools-native"
|
||||
RDEPENDS:${PN} += "python3-core python3-io"
|
||||
|
||||
|
||||
SRC_URI = "git://github.com/KhronosGroup/OpenCL-CTS.git;protocol=https;branch=main;lfs=0"
|
||||
SRC_URI = "git://github.com/KhronosGroup/OpenCL-CTS.git;protocol=https;branch=main;lfs=0 \
|
||||
file://0001-test_unary_fn-Remove-unused-variable-j.patch \
|
||||
file://0002-command_buffer_printf-Fix-out-of-bounds-pattern-arra.patch \
|
||||
file://0003-c11_atomics-Remove-Wno-format-flag.patch \
|
||||
file://0001-commonfns-fix-type-mismatches-across-function-templa.patch \
|
||||
file://0002-commonfns-Remove-Wno-format-flag.patch "
|
||||
|
||||
SRCREV = "8d8f3d272dbd3f0a84156be7890835c4b6deff8e"
|
||||
|
||||
EXTRA_OECMAKE:append = " --compile-no-warning-as-error -DSPIRV_INCLUDE_DIR=${STAGING_EXECPREFIXDIR} -DCL_INCLUDE_DIR=${STAGING_INCDIR} -DCL_LIB_DIR=${STAGING_LIBDIR} -DOPENCL_LIBRARIES=OpenCL"
|
||||
EXTRA_OECMAKE:append = " -DSPIRV_INCLUDE_DIR=${STAGING_EXECPREFIXDIR} -DCL_INCLUDE_DIR=${STAGING_INCDIR} -DCL_LIB_DIR=${STAGING_LIBDIR} -DOPENCL_LIBRARIES=OpenCL"
|
||||
|
||||
PACKAGECONFIG = " \
|
||||
${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl gles', '', d)} \
|
||||
@@ -25,8 +30,6 @@ PACKAGECONFIG[opengl] = "-DGL_IS_SUPPORTED=ON,-DGL_IS_SUPPORTED=OFF,virtual/libg
|
||||
PACKAGECONFIG[gles] = "-DGLES_IS_SUPPORTED=ON,-DGLES_IS_SUPPORTED=OFF,virtual/egl virtual/libgles2"
|
||||
PACKAGECONFIG[vulkan] = "-DVULKAN_IS_SUPPORTED=ON,-DVULKAN_IS_SUPPORTED=OFF,vulkan-headers glslang-native"
|
||||
|
||||
SECURITY_STRINGFORMAT:remove = "-Werror=format-security"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${bindir}/opencl_test_conformance
|
||||
cp -r ${B}/test_conformance/* ${D}${bindir}/opencl_test_conformance
|
||||
|
||||
Reference in New Issue
Block a user