Skip to content

Force riscv builds onto the scalar path - #371

Open
carlosqwqqwq wants to merge 1 commit into
VcDevel:1.4from
carlosqwqqwq:riscv-vc
Open

Force riscv builds onto the scalar path#371
carlosqwqqwq wants to merge 1 commit into
VcDevel:1.4from
carlosqwqqwq:riscv-vc

Conversation

@carlosqwqqwq

Copy link
Copy Markdown

Why

Vc already has a portable Scalar implementation, but simulated or cross-target riscv64 validation from an x86_64 host compiler can still inherit host SSE/AVX preprocessor state. That leads the headers to select x86 implementations even when the build system has already chosen the generic support_dummy.cpp path. This patch makes the Scalar fallback explicit for RISC-V and prevents the host x86 ABI from leaking into simulated riscv64 builds.

What changed

  • Update CMakeLists.txt so riscv* is treated as an explicit Scalar-only target instead of a generic unknown warning path.
  • Update Vc/global.h so __riscv forces Vc_IMPL_Scalar before any host SSE/AVX auto-detection can run.
  • Update Vc/common/vectorabi.h so simulated or cross-target RISC-V builds do not inherit the host __x86_64__ ABI deduction.

Verification

  • Ran native CMake configuration with Ninja using Vc_ENABLE_INSTALL=OFF.
  • Built the native static library successfully with cmake --build build-codex-native-061 --parallel 4.
  • Ran simulated riscv64 CMake configuration with CMAKE_SYSTEM_NAME=Linux, CMAKE_SYSTEM_PROCESSOR=riscv64, CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY, forced __riscv=1 / __riscv_xlen=64, and Vc_ENABLE_INSTALL=OFF.
  • Built the simulated riscv64 static library successfully with cmake --build build-codex-riscv-061 --parallel 4.
  • Confirmed from the simulated build.ninja that the build only compiles src/support_dummy.cpp and src/const.cpp, with no support_x86.cpp, cpuid.cpp, trigonometric_SSE2.cpp, sse_sorthelper, or avx_sorthelper sources and no -msse* / -mavx* / -mfma / -mbmi flags.
  • Preprocessed Vc/global.h under forced __riscv=1 / __riscv_xlen=64 and confirmed only Vc_IMPL_Scalar=1 is defined.
  • Compiled a smoke-test translation unit under forced __riscv=1 / __riscv_xlen=64 and confirmed Vc::float_v::Size == 1 and Vc::VectorAbi::DeduceCompatible<float>::type resolves to Scalar.

Notes

This is a conservative portability patch. It does not implement a RISC-V SIMD or RVV backend. The goal is to ensure that RISC-V targets reliably select the existing Scalar implementation instead of inheriting host x86 vector assumptions during simulated or cross-target builds.

@Axel-Naumann

Copy link
Copy Markdown
Member

We are planning to archive this repo. Please reach out to axel@cern.ch if you want to fork and maintain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants