Summary
Building the OpenVX Conformance Test Suite (CTS) harness with amdclang at -O3 miscompiles test_conformance/test_array.c, causing 5 baseline conformance tests to fail:
[ FAILED ] Array.vxCreateArray/0/array/VX_TYPE_CHAR
[ FAILED ] Array.vxCreateArray/1/array/VX_TYPE_INT8
[ FAILED ] Array.vxCreateArray/2/array/VX_TYPE_UINT8
[ FAILED ] Array.vxCreateArray/3/array/VX_TYPE_INT16
[ FAILED ] Array.vxCreateArray/4/array/VX_TYPE_UINT16
Each fails at test_array.c:459 with:
FAILED at .../OpenVX-cts/test_conformance/test_array.c:459
Expected: 0 == res
Actual: 0 != 1
Line 459 is the post-round-trip data check: own_verify_data_items() returns 1 (data mismatch) after vxAddArrayItems + vxMapArrayRange. Only the 1- and 2-byte item types (CHAR, INT8, UINT8, INT16, UINT16) fail; all >= 4-byte types pass.
This is a distinct issue from #1707 (that was HafCpu_ChannelCopy_U8_U8 in libopenvx, fixed by -fno-vectorize). This failure is in the CTS harness translation unit itself, and the -fno-vectorize workaround on libopenvx does not address it.
Root cause — isolated to a single variable
Holding libopenvx.so byte-identical and changing only the optimization level of the CTS harness:
| CTS harness build |
Array.vxCreateArray result |
-O3 |
5 FAILED (CHAR/INT8/UINT8/INT16/UINT16) |
-O2 |
20 passed |
-O1 |
20 passed |
-O0 |
20 passed |
Further isolation: with the whole harness at -O2 and only test_array.c recompiled at -O3, the 5 tests fail again → the miscompiled translation unit is test_array.c, trigger is -O3.
The optimization level and flags of libopenvx (tried -O3/-O2/-O1, with and without -fno-vectorize / -fno-slp-vectorize) make no difference — the failure tracks the CTS harness opt level only. Fails on both AGO_DEFAULT_TARGET=CPU and GPU.
Reproduction
# 1. Build MIVisionX (HIP backend), defaults:
mkdir build && cd build
cmake .. -DBACKEND=HIP
make -j$(nproc)
cd ..
# 2. Build the CTS with plain defaults (Release => -O3; amdclang does NOT hit the
# GNUCC-only -O3->-O2 downgrade in OpenVX-cts/cmake/openvx.cmake), then run:
git clone --depth 1 -b openvx_1.3.2 https://github.com/KhronosGroup/OpenVX-cts.git
cd OpenVX-cts && git lfs pull && mkdir build && cd build
cmake .. \
-DOPENVX_INCLUDES="$PWD/../../amd_openvx/openvx/include" \
-DOPENVX_LIBRARIES="$PWD/../../build/lib/libopenvx.so;$PWD/../../build/lib/libvxu.so;pthread;dl;m;rt" \
-DOPENVX_CONFORMANCE_VISION=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5
make -j$(nproc)
VX_TEST_DATA_PATH=../test_data/ ./bin/vx_test_conformance --filter='Array.vxCreateArray*'
Workaround (confirmed): build the CTS at -O2 — either via the -O3 -> -O2 string replace in OpenVX-cts/cmake/openvx.cmake, or by forcing -DCMAKE_C_FLAGS_RELEASE="-O2 -DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-O2 -DNDEBUG". This is what .github/workflows/conformance-hip.yml already does; the failure surfaces when the CTS is built at its default -O3 (e.g. PR #1746).
Results (local repro)
- Toolchain:
AMD clang version 23.0.0git (ROCm/llvm-project 43215c73...), ROCm 7.13
- GPU: gfx1151 (also reproduced in CI on gfx950 / ROCm 10.1-nightly, PR-1746)
- MIVisionX:
develop @ b880c796, CTS branch openvx_1.3.2
Same libopenvx.so, only the harness opt level changed:
### CTS built at -O2 (whole harness) [libopenvx unchanged]
[ PASSED ] 20 test(s)
[ FAILED ] 0 test(s)
### CTS built at -O3 (whole harness) [same libopenvx]
FAILED at .../OpenVX-cts/test_conformance/test_array.c:459
Actual: 0 != 1 (x5)
[ PASSED ] 15 test(s)
[ FAILED ] 5 test(s), listed below:
[ FAILED ] Array.vxCreateArray/0/array/VX_TYPE_CHAR
[ FAILED ] Array.vxCreateArray/1/array/VX_TYPE_INT8
[ FAILED ] Array.vxCreateArray/2/array/VX_TYPE_UINT8
[ FAILED ] Array.vxCreateArray/3/array/VX_TYPE_INT16
[ FAILED ] Array.vxCreateArray/4/array/VX_TYPE_UINT16
Notes for a compiler bug report
The miscompile is whole-translation-unit / IR-shape sensitive: extracting own_alloc_init_data_items() and own_verify_data_items() verbatim into a standalone .c and compiling at -O3 does not reproduce it — the full test_array.c TU is required. A minimal standalone for the LLVM team therefore needs llvm-reduce driven by an interestingness test (recompile test_array.c at -O3, check for the mismatch), which shrinks the real file while preserving the trigger. (In progress.)
Summary
Building the OpenVX Conformance Test Suite (CTS) harness with amdclang at
-O3miscompilestest_conformance/test_array.c, causing 5 baseline conformance tests to fail:Each fails at
test_array.c:459with:Line 459 is the post-round-trip data check:
own_verify_data_items()returns1(data mismatch) aftervxAddArrayItems+vxMapArrayRange. Only the 1- and 2-byte item types (CHAR,INT8,UINT8,INT16,UINT16) fail; all >= 4-byte types pass.This is a distinct issue from #1707 (that was
HafCpu_ChannelCopy_U8_U8inlibopenvx, fixed by-fno-vectorize). This failure is in the CTS harness translation unit itself, and the-fno-vectorizeworkaround onlibopenvxdoes not address it.Root cause — isolated to a single variable
Holding
libopenvx.sobyte-identical and changing only the optimization level of the CTS harness:Array.vxCreateArrayresult-O3-O2-O1-O0Further isolation: with the whole harness at
-O2and onlytest_array.crecompiled at-O3, the 5 tests fail again → the miscompiled translation unit istest_array.c, trigger is-O3.The optimization level and flags of
libopenvx(tried-O3/-O2/-O1, with and without-fno-vectorize/-fno-slp-vectorize) make no difference — the failure tracks the CTS harness opt level only. Fails on bothAGO_DEFAULT_TARGET=CPUandGPU.Reproduction
Workaround (confirmed): build the CTS at
-O2— either via the-O3 -> -O2string replace inOpenVX-cts/cmake/openvx.cmake, or by forcing-DCMAKE_C_FLAGS_RELEASE="-O2 -DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-O2 -DNDEBUG". This is what.github/workflows/conformance-hip.ymlalready does; the failure surfaces when the CTS is built at its default-O3(e.g. PR #1746).Results (local repro)
AMD clang version 23.0.0git (ROCm/llvm-project 43215c73...), ROCm 7.13develop@b880c796, CTS branchopenvx_1.3.2Same
libopenvx.so, only the harness opt level changed:Notes for a compiler bug report
The miscompile is whole-translation-unit / IR-shape sensitive: extracting
own_alloc_init_data_items()andown_verify_data_items()verbatim into a standalone.cand compiling at-O3does not reproduce it — the fulltest_array.cTU is required. A minimal standalone for the LLVM team therefore needsllvm-reducedriven by an interestingness test (recompiletest_array.cat-O3, check for the mismatch), which shrinks the real file while preserving the trigger. (In progress.)