Skip to content

Commit fba7eb2

Browse files
committed
wip
1 parent e88e01e commit fba7eb2

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'ll> OffloadGlobals<'ll> {
5858
}
5959
}
6060

61-
pub fn generate_mapper_call<'ll, 'tcx>(
61+
pub(crate) fn generate_mapper_call<'ll, 'tcx>(
6262
builder: &mut Builder<'_, 'll, 'tcx>,
6363
geps: [&'ll Value; 3],
6464
o_type: &'ll Value,
@@ -586,7 +586,7 @@ fn get_runtime_size<'ll, 'tcx>(
586586

587587
// For now we have a very simplistic indexing scheme into our
588588
// offload_{baseptrs,ptrs,sizes}. We will probably improve this along with our gpu frontend pr.
589-
pub fn get_geps<'ll, 'tcx>(
589+
pub(crate) fn get_geps<'ll, 'tcx>(
590590
builder: &mut Builder<'_, 'll, 'tcx>,
591591
ty: &'ll Type,
592592
ty2: &'ll Type,
@@ -604,7 +604,7 @@ pub fn get_geps<'ll, 'tcx>(
604604
[gep1, gep2, gep3]
605605
}
606606

607-
pub fn preper_datatransfers<'ll, 'tcx>(
607+
pub(crate) fn preper_datatransfers<'ll, 'tcx>(
608608
cx: &SimpleCx<'ll>,
609609
builder: &mut Builder<'_, 'll, 'tcx>,
610610
args: &[&'ll Value],
@@ -792,6 +792,7 @@ pub(crate) fn gen_call_handling<'ll, 'tcx>(
792792

793793
// Step 3)
794794
// Here we fill the KernelArgsTy, see the documentation above
795+
let i32_0 = cx.get_const_i32(0);
795796
for (i, value) in values.iter().enumerate() {
796797
let ptr = builder.inbounds_gep(tgt_kernel_decl, a5, &[i32_0, cx.get_const_i32(i as u64)]);
797798
let name = std::ffi::CString::new(value.1).unwrap();

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,12 @@ fn codegen_offload_preload<'ll, 'tcx>(
19431943

19441944
//let a = OffloadMetadata::from_ty(tcx, arg_ty);
19451945

1946-
let arg = &args[0];
1946+
let arg: &OperandRef<'_, &'ll Value> = &args[0];
1947+
let args = match arg.val {
1948+
OperandValue::Immediate(val) => vec![val],
1949+
_ => bug!("asdf"),
1950+
};
1951+
//let args = get_args_from_tuple(bx, args[4], fn_target);
19471952

19481953
let arg_ty = arg.layout.ty;
19491954

@@ -1969,7 +1974,7 @@ fn codegen_offload_preload<'ll, 'tcx>(
19691974
let (ty, ty2, a1, a2, a4) = preper_datatransfers(
19701975
cx,
19711976
bx,
1972-
&[arg],
1977+
&args,
19731978
&[types],
19741979
offload_data.offload_sizes,
19751980
metadata,
@@ -1981,8 +1986,8 @@ fn codegen_offload_preload<'ll, 'tcx>(
19811986
bx,
19821987
geps,
19831988
offload_data.memtransfer_begin,
1984-
offload_globals.mapper_fn_ty,
19851989
offload_globals.begin_mapper,
1990+
offload_globals.mapper_fn_ty,
19861991
1,
19871992
offload_globals.ident_t_global,
19881993
);

0 commit comments

Comments
 (0)