Skip to content

Remove typed allocas and geps from gpu_offload.rs - #165154

Open
beetrees wants to merge 1 commit into
rust-lang:mainfrom
beetrees:gpu-offload-geps
Open

beetrees wants to merge 1 commit into
rust-lang:mainfrom
beetrees:gpu-offload-geps

Conversation

@beetrees

@beetrees beetrees commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Typed GEPs are being removed from the rest of the compiler in #165146, and typed allocas were already removed, so change gpu_offload.rs to match. This PR also removes the constant zero GEPs (#t-compiler > GEP constant 0 in `gpu_offload.rs`).

r? @ZuseZ4

@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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 29, 2026
@ZuseZ4

ZuseZ4 commented Oct 29, 2026

Copy link
Copy Markdown
Member

Thank you for the cleanups. I'm just returning from the llvm dev meeting, where I was promised by two vendors that they should provide us almost certainly with GPU CI. Until then, we'll still have to run tests by hand, unfortunately.

@sgasho since you should have an up-to-date build, can you test nvptx?

@ZuseZ4

ZuseZ4 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Can you please also update the now failing tests? Should be easy enough even without running them: control_flow.rs, scalar_host.rs, and slice_host.rs, test against the old typed alloca's. They're under ./tests/codegen-llvm/gpu_offload/

gpu_host.rs also tests for struct.__tgt_kernel_arguments (but fwiw, it failed on other things before).

@beetrees

Copy link
Copy Markdown
Contributor Author

I've replaced all the allocas in the tests with the appropriate sizes for a 64-bit system with 8-aligned pointers. In addition to the files you mentioned, there was also one in region_host.rs.

@sgasho

sgasho commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

@sgasho since you should have an up-to-date build, can you test nvptx?

I tested the sample offload code on nvidia gpunode (RTX A2000 (sm_86)) and it worked 👍

jhpratt added a commit to jhpratt/rust that referenced this pull request Oct 31, 2026
Stop using LLVM struct types for array/pointer offset GEPs (rebase)

This is a rebase and improvement upon rust-lang#122325 by @erikdesjardins. In addition to what was already in that PR, I've changed the signature of `gep`/`inbounds_gep`/`inbounds_nuw_gep` to take the `stride: Size` directly. The only GEPs not migrated are the ones in `gpu_offload.rs`: given their more intensive use of LLVM types, I've split them off into rust-lang#165154 to make this PR easier to review.

Closes rust-lang#122325

r? @nikic
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 31, 2026
Stop using LLVM struct types for array/pointer offset GEPs (rebase)

This is a rebase and improvement upon rust-lang#122325 by @erikdesjardins. In addition to what was already in that PR, I've changed the signature of `gep`/`inbounds_gep`/`inbounds_nuw_gep` to take the `stride: Size` directly. The only GEPs not migrated are the ones in `gpu_offload.rs`: given their more intensive use of LLVM types, I've split them off into rust-lang#165154 to make this PR easier to review.

Closes rust-lang#122325

r? @nikic
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 31, 2026
Stop using LLVM struct types for array/pointer offset GEPs (rebase)

This is a rebase and improvement upon rust-lang#122325 by @erikdesjardins. In addition to what was already in that PR, I've changed the signature of `gep`/`inbounds_gep`/`inbounds_nuw_gep` to take the `stride: Size` directly. The only GEPs not migrated are the ones in `gpu_offload.rs`: given their more intensive use of LLVM types, I've split them off into rust-lang#165154 to make this PR easier to review.

Closes rust-lang#122325

r? @nikic
rust-bors Bot pushed a commit that referenced this pull request Oct 31, 2026
Rollup merge of #165146 - beetrees:no-llvm-struct-gep, r=nikic

Stop using LLVM struct types for array/pointer offset GEPs (rebase)

This is a rebase and improvement upon #122325 by @erikdesjardins. In addition to what was already in that PR, I've changed the signature of `gep`/`inbounds_gep`/`inbounds_nuw_gep` to take the `stride: Size` directly. The only GEPs not migrated are the ones in `gpu_offload.rs`: given their more intensive use of LLVM types, I've split them off into #165154 to make this PR easier to review.

Closes #122325

r? @nikic
@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@ZuseZ4

ZuseZ4 commented Nov 5, 2026

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

📌 Commit cf4f14b has been approved by ZuseZ4

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 5, 2026
@ZuseZ4

ZuseZ4 commented Nov 5, 2026

Copy link
Copy Markdown
Member

@bors r-

Actually let me first try
@bors try jobs=test-various

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 5, 2026
@rust-bors

rust-bors Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

View changes since this unapproval

rust-bors Bot pushed a commit that referenced this pull request Nov 5, 2026
Remove typed allocas and geps from `gpu_offload.rs`


try-job: test-various
@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 31ff68f failed: CI. Failed job:

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-various failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] jiff test:false 8.834
error[E0609]: no field `abi` on type `rustc_abi::Align`
   --> compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:282:46
    |
282 |             let align = ty.default_align(cx).abi;
    |                                              ^^^ unknown field

For more information about this error, try `rustc --explain E0609`.
[RUSTC-TIMING] rustc_codegen_llvm test:false 4.477
error: could not compile `rustc_codegen_llvm` (lib) due to 1 previous error

This branch has not been deployed

No deployments
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-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

5 participants