WIP - [artiq] Test

This commit is contained in:
David Mak 2024-08-15 04:51:25 +08:00
parent 4afe1d6edb
commit 9dec97f228
1 changed files with 17 additions and 3 deletions

View File

@ -603,8 +603,9 @@ fn format_rpc_ret<'ctx>(
let dims_buf_sz = let dims_buf_sz =
ctx.builder.build_int_mul(ndarray.load_ndims(ctx), llvm_usize_sizeof, "").unwrap(); ctx.builder.build_int_mul(ndarray.load_ndims(ctx), llvm_usize_sizeof, "").unwrap();
let buffer_size = // let buffer_size =
ctx.builder.build_int_add(dims_buf_sz, llvm_pdata_sizeof, "").unwrap(); // ctx.builder.build_int_add(dims_buf_sz, llvm_pdata_sizeof, "").unwrap();
let buffer_size = llvm_usize.const_int(16, false);
let buffer_size = ctx.builder.build_left_shift( let buffer_size = ctx.builder.build_left_shift(
ctx.builder.build_int_add( ctx.builder.build_int_add(
ctx.builder.build_right_shift( ctx.builder.build_right_shift(
@ -677,7 +678,7 @@ fn format_rpc_ret<'ctx>(
ctx, ctx,
generator, generator,
&llvm_usize.const_zero(), &llvm_usize.const_zero(),
llvm_usize.const_int(2, false), llvm_usize.const_int(5, false),
); );
} }
@ -698,9 +699,22 @@ fn format_rpc_ret<'ctx>(
call_ndarray_calc_size(generator, ctx, &ndarray.dim_sizes(), (None, None)), call_ndarray_calc_size(generator, ctx, &ndarray.dim_sizes(), (None, None)),
); );
let alloc_size_addr = ctx.builder.build_alloca(llvm_usize, "").unwrap();
ctx.builder.build_store(alloc_size_addr, alloc_size).unwrap();
call_memcpy_generic( call_memcpy_generic(
ctx, ctx,
ndarray.data().base_ptr(ctx, generator), ndarray.data().base_ptr(ctx, generator),
alloc_size_addr,
llvm_usize_sizeof,
llvm_i1.const_zero(),
);
let ndarray_pdata = unsafe {
ndarray.data().ptr_offset_unchecked(ctx, generator, &llvm_usize.const_int(1, false), None)
};
call_memcpy_generic(
ctx,
ndarray_pdata,
buffer.base_ptr(ctx, generator), buffer.base_ptr(ctx, generator),
buffer_size, buffer_size,
llvm_i1.const_zero() llvm_i1.const_zero()