folly
folly copied to clipboard
feat(folly): Add macros for RISC-V Vector (RVV) version detection
This commit introduces a set of preprocessor macros to detect the version of the RISC-V Vector (RVV) extension. This provides a standardized way to write code that conditionally compiles based on the availability and version of RVV support.
The new macros are:
- FOLLY_RVV: Defines the major version number of the RVV extension.
- FOLLY_RVV_MINOR: Defines the minor version number of the RVV extension.
- FOLLY_RVV_PREREQ(major, minor): A utility macro to check if the current RVV version meets a minimum requirement.
These macros parse the __riscv_v predefined macro, if it exists. If the compiler does not support RVV or the extension is not enabled, FOLLY_RVV and FOLLY_RVV_MINOR default to 0, ensuring backward compatibility.
This change enables future development of RVV-specific optimizations within Folly, improving performance and compatibility on the RISC-V platform.