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.

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-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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants