draft: Add support for Hexagon HVX#309
Conversation
Add the foundational infrastructure for the Hexagon HVX SIMD backend, including build system integration, architecture detection, memory alignment, and load/store primitives. No algorithm implementations yet.
Add HVX-optimized implementations for: AbsDifference, AbsDifferenceSum, AbsGradientSaturatedSum, AddFeatureDifference, BgrToGray, BgrToRgb, FillBgra, FillPixel, OperationBinary8u, and GetStatistic. Wire up dispatch blocks in SimdLib.cpp.
Replace __sighandler_t with sighandler_t for compatibility with musl libc, which does not define the double-underscore variant.
Implement HVX-optimized versions of: GetRowSums, GetColSums, GetAbsDyRowSums, GetAbsDxColSums, ValueSum, SquareSum, ValueSquareSum, ValueSquareSums, and CorrelationSum. Uses unaligned vector access (Load<false>/Store<false>) for Allocate'd buffers to avoid misalignment from SIMD_NO_MANS_LAND.
Implement HVX-optimized versions of: AbsSecondDerivativeHistogram, HistogramMasked, and HistogramConditional. Uses Q6_Vub_vavg_VubVub_rnd for rounding average (matching Base and NEON behavior), Q6_Vh_vmpyi_VhVh for integer halfword multiply, and HVX Compare8u templates for conditional histogram operations.
Document HVX as a supported SIMD extension, add Hexagon to the platform list, and include cross-compilation build instructions.
|
I'll share this as a draft - I'm not sure how well I have followed this project's idioms. And apologies in advance: I will be away for a few days so I'll be slow to respond over the next ~week. |
|
Hi! It is a good job!
|
Register HVX backend in the test framework so that `./Test -m=a` exercises all 22 HVX functions against the API dispatch: - TestConfig.h: include SimdHvx.h - TestOptions.h: add TestHvx() gate function - Test.cpp: update -de= help text to mention HVX - 9 test files: add #ifdef SIMD_HVX_ENABLE blocks mirroring the NEON pattern for AbsDifference, AbsDifferenceSum, AbsGradientSaturatedSum, AddFeatureDifference, BgrToGray, BgrToRgb, FillBgra, FillPixel, OperationBinary8u, GetStatistic, GetRowSums, GetColSums, GetAbsDyRowSums, GetAbsDxColSums, ValueSum, SquareSum, ValueSquareSum, ValueSquareSums, CorrelationSum, AbsSecondDerivativeHistogram, HistogramMasked, HistogramConditional
Add build_and_test_hexagon_cross job that downloads the CodeLinaro Hexagon toolchain (clang 22.1.0), cross-compiles the library and tests, then runs the test suite under qemu-hexagon.
|
After adding the test changes requested, I seem to have stumbled over a compiler defect at -O2/-O3. I will take some time to investigate that issue. Locally I seem to be able to workaround this bug with test case changes like so: Since these are undesirable architecture-independent changes, I will look closer at the compiler defect to find other possible workarounds or maybe just a fix for the codegen problem in LLVM itself. |
|
Hi. There are some errors in build_and_test_hexagon_cross action. It seems to incorrect toolchain installation. |
…d testing fixup! Add GitHub Actions CI job for Hexagon HVX cross-compilation and testing Install host libc++/libc++abi for hexagon-linux-musl-clang binary.
|
There is an error: https://github.com/ermig1979/Simd/actions/runs/23249023929/job/67590194524 |
Sorry, I'll fix it. I hadn't tried to run the CI workflow locally but I will try that before the next push. |
…d testing Add missing QEMU runtime dependencies (liburing2, libglib2.0-0t64).
Its OK. I'v never to create CI workflow with the first attempt. |
|
There is a progress. The build step is passed. There is an error during execution of AbsDifferenceAutoTest. |
No description provided.