[artiq] WIP

This commit is contained in:
David Mak 2024-08-15 13:44:31 +08:00
parent c00f6939e9
commit 1cd5439f87
1 changed files with 10 additions and 31 deletions

View File

@ -610,13 +610,7 @@ fn format_rpc_ret<'ctx>(
.build_bitcast(buffer, llvm_pi8, "")
.map(BasicValueEnum::into_pointer_value)
.unwrap();
let buffer = ArraySliceValue::from_ptr_val(
buffer,
ctx.builder
.build_left_shift(buffer_size, llvm_usize.const_int(2, false), "")
.unwrap(),
Some("rpc.buffer.ptr"),
);
let buffer = ArraySliceValue::from_ptr_val(buffer, buffer_size, Some("rpc.buffer.ptr"));
let i_addr = ctx.builder.build_alloca(llvm_usize, "i.addr").unwrap();
ctx.builder.build_store(i_addr, llvm_usize.const_zero()).unwrap();
@ -647,36 +641,22 @@ fn format_rpc_ret<'ctx>(
.unwrap())
},
|generator, ctx| {
// let data_addr = ctx
// .builder
// .build_load(
// ctx.builder
// .build_bitcast(data_addr, llvm_ppi8, "")
// .map(BasicValueEnum::into_pointer_value)
// .unwrap(),
// "",
// )
// .map(BasicValueEnum::into_pointer_value)
// .unwrap();
//
// call_memcpy_generic(
// ctx,
// ndarray.ptr_to_data(ctx),
// data_addr,
// llvm_pdata_sizeof,
// llvm_i1.const_zero(),
// );
let phi = phi.as_basic_value().into_pointer_value();
let pbuffer_data_begin = unsafe {
ctx.builder.build_in_bounds_gep(phi, &[llvm_usize.const_int(8, false)], "")
}
.unwrap();
call_memcpy_generic(
ctx,
ndarray.ptr_to_data(ctx),
buffer.base_ptr(ctx, generator),
pbuffer_data_begin,
llvm_pdata_sizeof,
llvm_i1.const_zero(),
);
let pbuffer_dims_begin = unsafe {
buffer.ptr_offset_unchecked(ctx, generator, &llvm_pdata_sizeof, None)
};
let pbuffer_dims_begin =
unsafe { ctx.builder.build_in_bounds_gep(phi, &[llvm_pdata_sizeof], "") }
.unwrap();
call_memcpy_generic(
ctx,
ndarray.dim_sizes().base_ptr(ctx, generator),
@ -760,7 +740,6 @@ fn format_rpc_ret<'ctx>(
ctx.builder.build_unconditional_branch(head_bb).unwrap();
ctx.builder.position_at_end(tail_bb);
ctx.builder.build_load(slot, "rpc.result").unwrap()
}
};