target: default to the medium code model on LoongArch targets#130266
Merged
bors merged 1 commit intorust-lang:masterfrom Sep 13, 2024
Merged
target: default to the medium code model on LoongArch targets#130266bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
The Rust LoongArch targets have been using the default LLVM code model so far, which is "small" in LLVM-speak and "normal" in LoongArch-speak. As described in the "Code Model" section of LoongArch ELF psABI spec v20231219 [1], one can only make function calls as far as ±128MiB with the "normal" code model; this is insufficient for very large software containing Rust components that needs to be linked into the big text section, such as Chromium. Because: * we do not want to ask users to recompile std if they are to build such software, * objects compiled with larger code models can be linked with those with smaller code models without problems, and * the "medium" code model is comparable to the "small"/"normal" one performance-wise (same data access pattern; each function call becomes 2-insn long and indirect, but this may be relaxed back into the direct 1-insn form in a future LLVM version), but is able to perform function calls within ±128GiB, it is better to just switch the targets to the "medium" code model, which is also "medium" in LLVM-speak. [1]: https://github.com/loongson/la-abi-specs/blob/v2.30/laelf.adoc#code-models Co-authored-by: WANG Rui <wangrui@loongson.cn>
Collaborator
|
rustbot has assigned @petrochenkov. Use |
Collaborator
|
These commits modify compiler targets. |
Contributor
Author
Contributor
|
It's better to mention in the PR description the comment suggesting the reland for some more context. It really helps Git archaeology several years later according to my experience... |
Contributor
|
@bors r+ rollup |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 13, 2024
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#129320 (Fix crash when labeling arguments for call_once and friends) - rust-lang#130266 (target: default to the medium code model on LoongArch targets) - rust-lang#130297 (Dataflow cleanups) - rust-lang#130299 (Add set_dcx to ParseSess) - rust-lang#130301 (some fixes for clashing_extern_declarations lint) - rust-lang#130305 (Clippy: consider msrv for const context for const_float_bits_conv) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 13, 2024
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#129320 (Fix crash when labeling arguments for call_once and friends) - rust-lang#130266 (target: default to the medium code model on LoongArch targets) - rust-lang#130297 (Dataflow cleanups) - rust-lang#130299 (Add set_dcx to ParseSess) - rust-lang#130301 (some fixes for clashing_extern_declarations lint) - rust-lang#130305 (Clippy: consider msrv for const context for const_float_bits_conv) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 13, 2024
Rollup merge of rust-lang#130266 - heiher:loong-medium-cmodel, r=compiler-errors target: default to the medium code model on LoongArch targets The Rust LoongArch targets have been using the default LLVM code model so far, which is "small" in LLVM-speak and "normal" in LoongArch-speak. As described in the "Code Model" section of LoongArch ELF psABI spec v20231219 [1], one can only make function calls as far as ±128MiB with the "normal" code model; this is insufficient for very large software containing Rust components that needs to be linked into the big text section, such as Chromium. Because: * we do not want to ask users to recompile std if they are to build such software, * objects compiled with larger code models can be linked with those with smaller code models without problems, and * the "medium" code model is comparable to the "small"/"normal" one performance-wise (same data access pattern; each function call becomes 2-insn long and indirect, but this may be relaxed back into the direct 1-insn form in a future LLVM version), but is able to perform function calls within ±128GiB, it is better to just switch the targets to the "medium" code model, which is also "medium" in LLVM-speak. Relands [2]: rust-lang#120661 [1]: https://github.com/loongson/la-abi-specs/blob/v2.30/laelf.adoc#code-models [2]: rust-lang#121289 (comment)
heiher
added a commit
to heiher/rust
that referenced
this pull request
Oct 18, 2024
The context for this is rust-lang#130266: setting the medium code model for the 'loongarch64-linux-ohos' target.
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Oct 18, 2024
Default to the medium code model on OpenHarmony LoongArch target The context for this is rust-lang#130266: setting the medium code model for the `loongarch64-linux-ohos` target. r? `@jieyouxu`
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Oct 18, 2024
Default to the medium code model on OpenHarmony LoongArch target The context for this is rust-lang#130266: setting the medium code model for the `loongarch64-linux-ohos` target. r? ``@jieyouxu``
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this pull request
Oct 18, 2024
Default to the medium code model on OpenHarmony LoongArch target The context for this is rust-lang#130266: setting the medium code model for the `loongarch64-linux-ohos` target. r? ```@jieyouxu```
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Oct 18, 2024
Rollup merge of rust-lang#131874 - heiher:loong-ohos-medium, r=jieyouxu Default to the medium code model on OpenHarmony LoongArch target The context for this is rust-lang#130266: setting the medium code model for the `loongarch64-linux-ohos` target. r? ```@jieyouxu```
nikic
added a commit
to nikic/rust
that referenced
this pull request
Feb 17, 2025
Since rust-lang#130266 loongarch defaults to medium code model.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Feb 17, 2025
…ingjubilee Update default loongarch code model in docs Since rust-lang#130266 loongarch defaults to medium code model.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 18, 2025
Rollup merge of rust-lang#137166 - nikic:loongarch-code-model, r=workingjubilee Update default loongarch code model in docs Since rust-lang#130266 loongarch defaults to medium code model.
github-merge-queue bot
pushed a commit
to rust-lang/rust-analyzer
that referenced
this pull request
Feb 24, 2025
Update default loongarch code model in docs Since rust-lang/rust#130266 loongarch defaults to medium code model.
10 tasks
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.
The Rust LoongArch targets have been using the default LLVM code model so far, which is "small" in LLVM-speak and "normal" in LoongArch-speak. As described in the "Code Model" section of LoongArch ELF psABI spec v20231219 1, one can only make function calls as far as ±128MiB with the "normal" code model; this is insufficient for very large software containing Rust components that needs to be linked into the big text section, such as Chromium.
Because:
it is better to just switch the targets to the "medium" code model, which is also "medium" in LLVM-speak.
Relands 2: #120661