Uh oh!
There was an error while loading. Please reload this page.
Add scalar support for offload - #150288
Conversation
d99cf66 to
0330a0eCompare@Sa4dUs, what's the current state of this? Given the omp/ol expectation of scalars being 64 bit integers I guess this code only works for i64 and usize and everything else will need the casts (or only works by chance)? |
Sa4dUs
commented
Dec 30, 2025
it works for all 64-bit scalars. for f64 it's not what omp expects but somehow it just works, not sure it it will break in some weird edge case |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
☔ The latest upstream changes made this pull request unmergeable. Please resolve the merge conflicts. |
bors
commented
Jan 3, 2026
☔ The latest upstream changes (presumably #150606) made this pull request unmergeable. Please resolve the merge conflicts. |
5189bbb to
45ccec5Compare45ccec5 to
38f7fc7Comparerustbot
commented
Jan 14, 2026
rustbot has assigned @jdonszelmann. Use |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
38f7fc7 to
5e980e1Compare
This comment has been minimized.
This comment has been minimized.
5e980e1 to
272a1a6Compare| let mut old_args_rebuilt = Vec::with_capacity(old_param_types.len()); | ||
| for (i, &old_ty) in old_param_types.iter().enumerate() { | ||
| let new_arg = unsafe { llvm::LLVMGetParam(new_fn, (i + 1) as u32) }; |
There was a problem hiding this comment.
I had missed this one. Otherwise lgtm.
Use compiler/rustc_codegen_llvm/src/llvm/mod.rs
287 /// Safe wrapper around `LLVMGetParam`, because segfaults are no fun.
1 pub(crate) fn get_param(llfn: &Value, index: c_uint) -> &Value {
| // CHECK: store double 4.200000e+01, ptr %0, align 8 | ||
| // CHECK: %_0.i = load double, ptr %0, align 8 | ||
| // CHECK: store double %_0.i, ptr %addr, align 8 | ||
| // CHECK-NEXT: call void @__tgt_register_lib(ptr nonnull %EmptyDesc) |
There was a problem hiding this comment.
While at it, can you please remove the check for : call void @__tgt_register_lib(ptr nonnull %EmptyDesc)? My other open PR moves it into globals, so that would break this test.
| let ty_kind = cx.type_kind(ty); | ||
| let (base_val, gep_base) = match ty_kind { | ||
| TypeKind::Pointer => (v, v), | ||
| TypeKind::Half | TypeKind::Float | TypeKind::Double | TypeKind::Integer => { |
There was a problem hiding this comment.
Add a FIXME that we should later check for f128 support. At least newer NVIDIA cards should support it.
| // CHECK: define{{( dso_local)?}} void @main() | ||
| // CHECK-NOT: define | ||
| // CHECK: %EmptyDesc = alloca %struct.__tgt_bin_desc, align 8 |
272a1a6 to
307a4fcCompareZuseZ4
commented
Jan 19, 2026
@bors delegate |
Sa4dUs
commented
Jan 19, 2026
@bors r=ZuseZ4 |
Add scalar support for offload This PR adds scalar support to the offload feature. The scalar management has two main parts: On the host side, each scalar arg is casted to `ix` type, zero extended to `i64` and passed to the kernel like that. On the device, the each scalar arg (`i64` at that point), is truncated to `ix` and then casted to the original type. r? @ZuseZ4
Rollup of 8 pull requests Successful merges: - #149587 (coverage: Sort the expansion tree to help choose a single BCB for child expansions) - #150071 (Add dist step for Enzyme) - #150288 (Add scalar support for offload) - #151091 (Add new "hide deprecated items" setting in rustdoc) - #151255 (rustdoc: Fix ICE when deprecated note is not resolved on the correct `DefId`) - #151375 (Fix terminal width dependent tests) - #151384 (add basic `TokenStream` api tests) - #151391 (rustc-dev-guide subtree update) r? @ghost
Uh oh!
There was an error while loading. Please reload this page.
Rollup merge of #150288 - offload-bench-fix, r=ZuseZ4 Add scalar support for offload This PR adds scalar support to the offload feature. The scalar management has two main parts: On the host side, each scalar arg is casted to `ix` type, zero extended to `i64` and passed to the kernel like that. On the device, the each scalar arg (`i64` at that point), is truncated to `ix` and then casted to the original type. r? @ZuseZ4
Rollup of 8 pull requests Successful merges: - rust-lang/rust#149587 (coverage: Sort the expansion tree to help choose a single BCB for child expansions) - rust-lang/rust#150071 (Add dist step for Enzyme) - rust-lang/rust#150288 (Add scalar support for offload) - rust-lang/rust#151091 (Add new "hide deprecated items" setting in rustdoc) - rust-lang/rust#151255 (rustdoc: Fix ICE when deprecated note is not resolved on the correct `DefId`) - rust-lang/rust#151375 (Fix terminal width dependent tests) - rust-lang/rust#151384 (add basic `TokenStream` api tests) - rust-lang/rust#151391 (rustc-dev-guide subtree update) r? @ghost
View all comments
This PR adds scalar support to the offload feature. The scalar management has two main parts:
On the host side, each scalar arg is casted to
ixtype, zero extended toi64and passed to the kernel like that.On the device, the each scalar arg (
i64at that point), is truncated toixand then casted to the original type.r? @ZuseZ4