Skip to content

dlopen offload - #160335

Open
sgasho wants to merge 2 commits into
rust-lang:mainfrom
sgasho:dlopen_offload
Open

dlopen offload#160335
sgasho wants to merge 2 commits into
rust-lang:mainfrom
sgasho:dlopen_offload

Conversation

@sgasho

@sgasho sgasho commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

dlopen offload to dist it in dist-x86_64-linux without enabling llvm.offload=true in CI (#159064 (comment))

I tested that this works by following steps at https://rustc-dev-guide.rust-lang.org/offload/usage.html for both LLVM22 and 23(by switch base branch to #158734 temporarily), though It might be better to land this after LLVM 23.

r? @ZuseZ4

@rustbot

rustbot commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp.

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 1, 2026
@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 1, 2026
@rust-log-analyzer

This comment has been minimized.

impl KernelArgsTy {
const OFFLOAD_VERSION: u64 = 3;
const FLAGS: u64 = 0;
const FLAGS: u64 = 1 << 6; // Enable StrictBlocksAndThreads

@sgasho sgasho Aug 1, 2026

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.

I got this error while testing on LLVM23

Image

Related to this I guess.
llvm/llvm-project#199483

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cc @kevinsala
@Sa4dUs I vaguely remember you ran into this when trying LLVM 23 patches, right? Was this the right solution?

@rust-cloud-vms
rust-cloud-vms Bot force-pushed the dlopen_offload branch 2 times, most recently from 94f5d55 to 48ede5a Compare August 1, 2026 14:24
@rust-log-analyzer

This comment has been minimized.

@ZuseZ4

ZuseZ4 commented Aug 2, 2026

Copy link
Copy Markdown
Member

The LLVM 23 update unfortunately takes a little longer than expected, but glad to hear you got it to work with both 22 and 23. In that case I'd just merge it once it's ready and not wait, since it seems unlikely that we'll break the LLVM 23 update PR with this work here. Worst case, std::offload is broken on main for a couple of days if we missed something, but that shouldn't affect too many users yet.

It's a bit unfortunate that we need a new cmake file for the offload wrapper. Hopefully I'll find time to upstream our wrappers into LLVM, so we won't need that in the future. But it would probably be part of llvm 24, so we shouldn't wait for that.

Comment thread compiler/rustc_codegen_llvm/src/back/write.rs Outdated
@rust-bors

This comment has been minimized.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

    LLVMConfig.cmake
    llvm-config.cmake

  Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
  "LLVM_DIR" to a directory containing one of the above files.  If "LLVM"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!
See also "/checkout/obj/build/x86_64-unknown-linux-gnu/rust-offload/build/CMakeFiles/CMakeOutput.log".
---
   0: __rustc::rust_begin_unwind
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/panicking.rs:679:5
   1: core::panicking::panic_fmt
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/core/src/panicking.rs:80:14
   2: cmake::fail
   3: cmake::run
   4: <cmake::Config>::build
   5: <bootstrap::core::build_steps::llvm::RustOffload as bootstrap::core::builder::CommandLineStep>::run
             at /checkout/src/bootstrap/src/core/build_steps/llvm.rs:1019:13
   6: <bootstrap::core::build_steps::llvm::RustOffload as bootstrap::core::builder::Step>::run
             at /checkout/src/bootstrap/src/core/builder/mod.rs:131:9
   7: <bootstrap::core::builder::Builder>::ensure::<bootstrap::core::build_steps::llvm::RustOffload>
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1673:36
   8: <bootstrap::core::build_steps::llvm::RustOffload as bootstrap::core::builder::CommandLineStep>::make_run
             at /checkout/src/bootstrap/src/core/build_steps/llvm.rs:973:21
   9: <bootstrap::core::builder::CommandLineStepDescription>::maybe_run
             at /checkout/src/bootstrap/src/core/builder/mod.rs:495:13
  10: bootstrap::core::builder::cli_paths::match_paths_to_steps_and_run
             at /checkout/src/bootstrap/src/core/builder/cli_paths.rs:233:18
  11: <bootstrap::core::builder::Builder>::run_step_descriptions
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1199:9
  12: <bootstrap::core::builder::Builder>::execute_cli
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1157:14
  13: <bootstrap::Build>::build
             at /checkout/src/bootstrap/src/lib.rs:802:25
  14: bootstrap::main
             at /checkout/src/bootstrap/src/bin/main.rs:157:11
  15: <fn() as core::ops::function::FnOnce<()>>::call_once
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/core/src/ops/function.rs:250:5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants