[artiq] WIP

This commit is contained in:
David Mak 2024-08-15 13:18:35 +08:00
parent c3b7aa6386
commit 405d0d0de3
1 changed files with 41 additions and 20 deletions

View File

@ -647,26 +647,32 @@ fn format_rpc_ret<'ctx>(
.unwrap()) .unwrap())
}, },
|generator, ctx| { |generator, ctx| {
let data_addr = phi.as_basic_value().into_pointer_value(); // let data_addr = ctx
let data_addr = ctx // .builder
.builder // .build_load(
.build_load( // ctx.builder
ctx.builder // .build_bitcast(data_addr, llvm_ppi8, "")
.build_bitcast(data_addr, llvm_ppi8, "") // .map(BasicValueEnum::into_pointer_value)
.map(BasicValueEnum::into_pointer_value) // .unwrap(),
.unwrap(), // "",
"", // )
) // .map(BasicValueEnum::into_pointer_value)
.map(BasicValueEnum::into_pointer_value) // .unwrap();
.unwrap(); //
// call_memcpy_generic(
call_memcpy_generic( // ctx,
ctx, // ndarray.ptr_to_data(ctx),
ndarray.ptr_to_data(ctx), // data_addr,
data_addr, // llvm_pdata_sizeof,
llvm_pdata_sizeof, // llvm_i1.const_zero(),
llvm_i1.const_zero(), // );
); // call_memcpy_generic(
// ctx,
// ndarray.ptr_to_data(ctx),
// buffer.base_ptr(ctx, generator),
// llvm_pdata_sizeof,
// llvm_i1.const_zero(),
// );
let pbuffer_dims_begin = unsafe { let pbuffer_dims_begin = unsafe {
buffer.ptr_offset_unchecked(ctx, generator, &llvm_pdata_sizeof, None) buffer.ptr_offset_unchecked(ctx, generator, &llvm_pdata_sizeof, None)
@ -679,6 +685,21 @@ fn format_rpc_ret<'ctx>(
llvm_i1.const_zero(), llvm_i1.const_zero(),
); );
// TODO: Testing for buffer
ndarray.create_data(
ctx,
llvm_elem_ty,
call_ndarray_calc_size(generator, ctx, &ndarray.dim_sizes(), (None, None)),
);
call_memcpy_generic(
ctx,
ndarray.data().base_ptr(ctx, generator),
buffer.base_ptr(ctx, generator),
llvm_usize.const_int(8, false),
llvm_i1.const_zero(),
);
Ok(()) Ok(())
}, },
|_, _| Ok(()), |_, _| Ok(()),