Skip to content

Commit 81da368

Browse files
committed
Pass frontend info to gen_call_handling
1 parent 4a82800 commit 81da368

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ pub(crate) fn gen_call_handling<'ll>(
371371
memtransfer_types: &[&'ll llvm::Value],
372372
region_ids: &[&'ll llvm::Value],
373373
llfn: &'ll Value,
374+
metadata: Vec<OffloadMetadata>,
374375
) {
375376
let (tgt_decl, tgt_target_kernel_ty) = generate_launcher(&cx);
376377
// %struct.__tgt_bin_desc = type { i32, ptr, ptr, ptr }
@@ -441,7 +442,7 @@ pub(crate) fn gen_call_handling<'ll>(
441442
// As mentioned above, we don't use Rust type information yet. So for now we will just
442443
// assume that we have 1024 bytes, 256 f32 values.
443444
// FIXME(offload): write an offload frontend and handle arbitrary types.
444-
builder.store(cx.get_const_i64(1024), gep3, Align::EIGHT);
445+
builder.store(cx.get_const_i64(metadata[i].payload_size), gep3, Align::EIGHT);
445446
}
446447

447448
// For now we have a very simplistic indexing scheme into our

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,7 @@ fn codegen_offload<'ll, 'tcx>(
12991299
&[memtransfer_type],
13001300
&[region_id],
13011301
llfn,
1302+
metadata,
13021303
);
13031304
}
13041305

0 commit comments

Comments
 (0)