Skip to content

[Target][RISC-V] Use riscv_cpu device key for RISC-V target tags - #19915

Merged
tqchen merged 1 commit into
apache:mainfrom
Ga1axy0:dev/riscvcpu
Jun 30, 2026
Merged

[Target][RISC-V] Use riscv_cpu device key for RISC-V target tags#19915
tqchen merged 1 commit into
apache:mainfrom
Ga1axy0:dev/riscvcpu

Conversation

@Ga1axy0

@Ga1axy0 Ga1axy0 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

RISC-V target tags use the LLVM codegen backend, so their target kind should remain "llvm". However, the target metadata should still identify the target as a RISC-V CPU rather than an ARM CPU.

Previously, the RISC-V tag helper used the ARM CPU keys and device metadata, so Target("riscv/...") expanded with keys ["arm_cpu", "cpu"] and device "arm_cpu".

{"kind": "llvm", "keys": ["arm_cpu", "cpu"], "device": "arm_cpu"}

This is misleading for code that inspects target keys or device metadata to distinguish CPU families.

This change updates the RISC-V tag helper to use keys ["riscv_cpu", "cpu"] and device "riscv_cpu", while keeping kind="llvm". It also adds the SpacemiT K3 RISC-V target tag.

Previously, the RISC-V tag helper used the ARM CPU keys and device metadata,
so Target("riscv/...") expanded with keys ["arm_cpu", "cpu"] and device
"arm_cpu".  This is misleading for code that inspects target keys or device
metadata to distinguish CPU families.

This change updates the RISC-V tag helper to use keys ["riscv_cpu", "cpu"]
and device "riscv_cpu", while keeping kind="llvm".  It also adds the
SpacemiT K3 RISC-V target tag.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request corrects the base configuration keys and device type for RISC-V CPU tags from 'arm_cpu' to 'riscv_cpu' and registers a new tag for the 'riscv/spacemit-k3' target. Feedback was provided to correct the 'mcpu' value from 'spacemit-x100' to 'spacemit-x60' to prevent LLVM compilation failures, as 'spacemit-x100' is not a supported LLVM CPU target.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

{
"num-cores": 8,
"mtriple": "riscv64-unknown-linux-gnu",
"mcpu": "spacemit-x100",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The SpacemiT K3 SoC is based on the SpacemiT X60 CPU core. LLVM supports '-mcpu=spacemit-x60', but there is no 'spacemit-x100' CPU target in LLVM. Using 'spacemit-x100' will cause LLVM compilation to fail with an unknown CPU error. Please update 'mcpu' to 'spacemit-x60'.

Suggested change
"mcpu": "spacemit-x100",
"mcpu": "spacemit-x60",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, SpacemiT K1-based platforms appear to use the X60 core, while the K3 platform is based on the X100 core.

@tqchen
tqchen merged commit 9e8cfea into apache:main Jun 30, 2026
12 checks passed
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