Skip to content

Conversation

ZuseZ4
Copy link
Member

@ZuseZ4 ZuseZ4 commented Jun 18, 2025

r? @oli-obk

A follow-up to my previous gpu host PR. With this, I can (in theory) run a sufficiently simple Rust function on GPUs. I tested it on AMD, where the amdgcn tartget of rustc causes issues due to Addressspace castings, which might not be valid. If I (manually) fix them, I can run the generated IR on an AMD GPU. This should conceptually also work on NVIDIA or Intel. I updated the dev-guide acordingly: https://rustc-dev-guide.rust-lang.org/offload/usage.html

I am unhappy with the amount of standalone functions in my offload code, so in my second commit I bundled some of the code around two structs which are Rust versions of the LLVM/Offload structs which they represent. The structs themselves only have doc comments. Since I directly lower everything to llvm-ir I didn't saw a big value in modelling the struct member variables.

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-autodiff `#![feature(autodiff)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 18, 2025
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jun 26, 2025

☔ The latest upstream changes (presumably #143026) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 26, 2025
@ZuseZ4 ZuseZ4 force-pushed the offload-device1 branch from 100f9f3 to 7cf6e76 Compare July 2, 2025 23:56
@ZuseZ4 ZuseZ4 force-pushed the offload-device1 branch from 7cf6e76 to 65bd406 Compare July 10, 2025 00:45
@ZuseZ4
Copy link
Member Author

ZuseZ4 commented Jul 22, 2025

We'll still need #143684 to properly recognize our GPU hardware and run the binary on end-user hardware, but here I'll only add codegen tests, so it should work fine for CI.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Jul 24, 2025
@rust-log-analyzer

This comment has been minimized.

@ZuseZ4 ZuseZ4 mentioned this pull request Jul 24, 2025
5 tasks
@ZuseZ4 ZuseZ4 force-pushed the offload-device1 branch from 28b9090 to c7a65a1 Compare July 29, 2025 20:45
@rust-log-analyzer

This comment has been minimized.

@ZuseZ4
Copy link
Member Author

ZuseZ4 commented Jul 29, 2025

related (also wip) rustc-dev-guide update: rust-lang/rustc-dev-guide#2524

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@ZuseZ4 ZuseZ4 force-pushed the offload-device1 branch 2 times, most recently from 0feda32 to 2ba8703 Compare August 21, 2025 00:31
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@ZuseZ4 ZuseZ4 requested a review from oli-obk August 21, 2025 19:02
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 21, 2025
@ZuseZ4 ZuseZ4 marked this pull request as ready for review August 21, 2025 19:02
@ZuseZ4
Copy link
Member Author

ZuseZ4 commented Aug 21, 2025

It turns out with enough bugfixes on the host code, this is already enough to launch and run some code.
I moved more code into a follow-up pr.
r? @oli-obk

@rustbot
Copy link
Collaborator

rustbot commented Aug 21, 2025

Requested reviewer is already assigned to this pull request.

Please choose another assignee.

@ZuseZ4 ZuseZ4 changed the title Offload device1 Offload host2 Aug 21, 2025
@ZuseZ4
Copy link
Member Author

ZuseZ4 commented Aug 21, 2025

cc @Kobzol CI failure (failed to clean up disk space), seems unrelated to my work.

@Kobzol
Copy link
Member

Kobzol commented Aug 22, 2025

Yeah that's spurious.

@rust-log-analyzer

This comment has been minimized.

@ZuseZ4 ZuseZ4 force-pushed the offload-device1 branch 2 times, most recently from cdbbe9c to 0f05703 Compare September 1, 2025 02:55
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. A-run-make Area: port run-make Makefiles to rmake.rs F-autodiff `#![feature(autodiff)]` 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.

6 participants