Skip to content

Add support for generics in offloadand remove no_mangle attribute#159566

Open
Sa4dUs wants to merge 5 commits into
rust-lang:mainfrom
Sa4dUs:offload-generics
Open

Add support for generics in offloadand remove no_mangle attribute#159566
Sa4dUs wants to merge 5 commits into
rust-lang:mainfrom
Sa4dUs:offload-generics

Conversation

@Sa4dUs

@Sa4dUs Sa4dUs commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

implements a 3rd pass where we collect kernel instantiations required by offload to work
also enforces consistent mangling for offload functions between host and device

closes: #150985

r? @ZuseZ4

@rustbot rustbot added 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. labels Jul 19, 2026
@Sa4dUs
Sa4dUs force-pushed the offload-generics branch from 7fefbf7 to a019aea Compare July 19, 2026 14:10
@rust-log-analyzer

This comment has been minimized.

// core/std/allocators/etc. For example symbols used to hook up allocation
// are not considered for export
let codegen_fn_attrs = tcx.codegen_fn_attrs(sym_def_id);
let is_extern = codegen_fn_attrs.contains_extern_indicator();

@bjorn3 bjorn3 Jul 19, 2026

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.

Perhaps contains_extern_indicator should return true for offload functions?

View changes since the review

Comment thread compiler/rustc_monomorphize/src/collector.rs Outdated
Comment thread compiler/rustc_codegen_ssa/src/base.rs Outdated
@ZuseZ4

ZuseZ4 commented Jul 20, 2026

Copy link
Copy Markdown
Member

Great improvement ( I'll review later).
@Flakebi fyi, I think now we only have the abi checks left to implement for more complex types and offload should cover all the bigger things we talked about?

@rust-bors

This comment has been minimized.

Comment thread compiler/rustc_codegen_ssa/src/back/write.rs Outdated
@Sa4dUs
Sa4dUs force-pushed the offload-generics branch from b40ecd1 to cb87656 Compare July 23, 2026 16:44
@rust-log-analyzer

This comment has been minimized.

@Sa4dUs
Sa4dUs force-pushed the offload-generics branch from cb87656 to f684946 Compare July 24, 2026 13:07
@rust-log-analyzer

This comment has been minimized.

@Sa4dUs
Sa4dUs marked this pull request as ready for review July 24, 2026 15:07
@rustbot

rustbot commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@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 Jul 24, 2026
Comment thread compiler/rustc_monomorphize/src/collector.rs
Comment thread compiler/rustc_monomorphize/src/offload_manifest.rs
Comment thread compiler/rustc_monomorphize/src/offload_manifest.rs Outdated
Comment thread compiler/rustc_monomorphize/src/offload_manifest.rs Outdated
@bjorn3
bjorn3 self-requested a review July 24, 2026 20:49
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.

std::offload requires mangled names

5 participants