target: default to the medium code model on LoongArch targets by heiher · Pull Request #130266 · rust-lang/rust
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>
rustbot
added
S-waiting-on-review
labels
Sep 12, 2024
bors
added
the
S-waiting-on-bors
label
Sep 13, 2024bors 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, 2024Rollup 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
deleted the
loong-medium-cmodel
branch
xen0n
mentioned this pull request
heiher added a commit to heiher/rust that referenced this pull request
Oct 18, 2024The 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, 2024Default 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, 2024Default 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, 2024Default 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, 2024Rollup 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
mentioned this pull request
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, 2025Rollup 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, 2025Update default loongarch code model in docs Since rust-lang/rust#130266 loongarch defaults to medium code model.
xen0n
mentioned this pull request
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