Add -mcpu Extension Control Syntax for RISC-V Toolchain#139
Add -mcpu Extension Control Syntax for RISC-V Toolchain#139majin2020 wants to merge 1 commit intoriscv-non-isa:mainfrom
Conversation
|
I'm fairly against this proposal (but I know I'm one voice). We have a way of doing this already: provide the In particular I had problems with how arm and aarch64 both implement and use their -mcpu extension syntax:
I like that our I don't think this "solves" a fragmentation issue, I think it just makes our toolchains harder to use. I do see our march strings are getting longer and longer, which isn't great long term. |
|
Thank you very much for your insightful and professional feedback! I strongly agree with your point: while aiming for flexibility—supporting both enabling and disabling features—we inevitably introduce usability complexity, particularly due to the lack of conflict tracking between extensions, as you highlighted. Although implementing such conflict detection may not be technically difficult, it can still cause confusion in practice. In reality, what we typically need is additive configuration, not subtraction. The -mcpu usually represents a common baseline core, and features like vlen256, vlen512, or matrix are optional extensions layered on top of that baseline. Therefore, I fully support an -mcpu syntax that does not allow disabling extensions (i.e., no +no-ext). My earlier mention of “subtraction” was only intended to facilitate discussion—it was not a proposal to actually support disabling features. So I’d like to ask: do you still have concerns about a purely additive -mcpu extension mechanism? BR |
|
I personally don't have any problems with a purely additive extension mechanism. I have found that vendors prefer to have |
Hi,thanks for your feedback and suggestions! I have completely removed the Key changes made:
Regarding your concern about vendor preferences, based on my understanding, what we typically need is a "minimal" baseline configuration for This approach maintains backward compatibility while providing flexibility for scenarios requiring precise extension control, without the complexity of disabling extensions. Do you have any other comments or suggestions on this purely additive design? Looking forward to your feedback! |
Implementation Overview
This patch adds comprehensive
-mcpuextension control syntax support to the RISC-V toolchain specification, following ARM GCC's mature design pattern.Design References
Background and Motivation
In real-world RISC-V ecosystems, the same CPU IP core often exists in multiple hardware configuration variants:
If we were to define separate CPU model names for every configuration combination, it would lead to exponential growth in CPU model names, creating a significant maintenance burden for toolchains and usability challenges for developers.
Key Features
1. Extension Control Syntax
+extension/+noextensionsyntax to enable/disable specific RISC-V extensions2. Dependency Handling
Problems Solved
Usage Examples
This implementation ensures full compatibility with existing GCC RISC-V backends while providing clear and accurate documentation guidance, effectively addressing the CPU model fragmentation issue in the RISC-V ecosystem.