Add riscv sequential mode detection
## Summary
- recognize riscv64 explicitly in mipp.h;
- make riscv64 resolve to the existing sequential no-intrinsics mode instead of leaking host SIMD backends.#67
Open
carlosqwqqwq wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
MIPP already has a sequential fallback mode for unsupported architectures, which is the right conservative baseline for
riscv64until a dedicated backend exists. However, the current architecture detection still derives backend selection directly from host SIMD builtins such as__SSE__,__AVX__,__AVX512F__,__ARM_NEON, and__ARM_FEATURE_SVE. During forced-target or cross-target validation, those host macros can leak into preprocessing and make ariscv64portability check incorrectly select x86 or ARM SIMD paths.What changed
MIPP_RISCVandMIPP_RISCV64target markers ininclude/mipp.h.__riscv, soriscv64portability checks do not inherit host SIMD state.__riscvfall through to MIPP's existing sequential implementation path instead of matching x86 or ARM backends.InstructionType/InstructionFullTypeasRISC-V_NO_INTRINSICSorRISC-V64_NO_INTRINSICSwhen the library is compiled for RISC-V sequential mode.README.mdto document that the currentRISC-Vpath uses MIPP's existing sequential mode until a dedicated backend is added.Verification
cmake -S . -B build-native -G Ninja -DMIPP_EXAMPLES_EXE=OFF -DMIPP_STATIC_LIB=OFF -DMIPP_ENABLE_BACKTRACE=OFFcmake --build build-native --parallel 4ctest --test-dir build-native --output-on-failuremipp.hwith-D__riscv=1 -D__riscv_xlen=64and confirmed it reportsMIPP_RISCV,MIPP_RISCV64,MIPP_NO_INTRINSICS,MIPP_NO,MIPP_REGISTER_SIZE=0, andMIPP_REQUIRED_ALIGNMENT=1, without enablingMIPP_SSE,MIPP_AVX,MIPP_AVX512, orMIPP_NEON.riscv64smoke translation unit that includesmipp.h, verifies no x86 or ARM backend macros leak into the target, and checks thatRegisterSizeBit == 0andRequiredAlignment == 1.riscv64mode successfully:cmake -S . -B build-riscv-seq -G Ninja -DMIPP_EXAMPLES_EXE=OFF -DMIPP_STATIC_LIB=OFF -DMIPP_ENABLE_BACKTRACE=OFF -DMIPP_NO_INTRINSICS=ON -DCMAKE_CXX_FLAGS='-D__riscv=1 -D__riscv_xlen=64'cmake --build build-riscv-seq --parallel 4ctest --test-dir build-riscv-seq --output-on-failureriscv64cross-compilation and execution in Docker (ubuntu:24.04):examples/operator.cppnatively and withriscv64-linux-gnu-g++;riscv64binary isELF64/Machine: RISC-Vviafileandreadelf -h;riscv64example successfully withqemu-riscv64-static -L /usr/riscv64-linux-gnu;Instr. type: RISC-V,Reg. size: 0 bits, andReg. lanes: 1, matching the intended sequential fallback.Notes
This is a conservative portability patch. It does not add RVV or any other dedicated RISC-V SIMD backend. The goal is to make
riscv64resolve to MIPP's existing sequential mode correctly and to stop host SIMD assumptions from leaking into cross-target validation.