WIP - [artiq] Test
This commit is contained in:
parent
043f8869d5
commit
160f5a6c58
|
@ -587,6 +587,7 @@ fn format_rpc_ret<'ctx>(
|
||||||
ndarray.store_ndims(ctx, generator, llvm_usize.const_int(ndims, false));
|
ndarray.store_ndims(ctx, generator, llvm_usize.const_int(ndims, false));
|
||||||
ndarray.create_dim_sizes(ctx, llvm_usize, ndarray.load_ndims(ctx));
|
ndarray.create_dim_sizes(ctx, llvm_usize, ndarray.load_ndims(ctx));
|
||||||
|
|
||||||
|
// TODO: Add alignment
|
||||||
let llvm_usize_sizeof = ctx
|
let llvm_usize_sizeof = ctx
|
||||||
.builder
|
.builder
|
||||||
.build_int_truncate_or_bit_cast(llvm_ret_ty.size_type().size_of(), llvm_usize, "")
|
.build_int_truncate_or_bit_cast(llvm_ret_ty.size_type().size_of(), llvm_usize, "")
|
||||||
|
@ -609,7 +610,7 @@ fn format_rpc_ret<'ctx>(
|
||||||
let buffer =
|
let buffer =
|
||||||
ctx.builder.build_array_alloca(llvm_pi8, buffer_size, "rpc.buffer").unwrap();
|
ctx.builder.build_array_alloca(llvm_pi8, buffer_size, "rpc.buffer").unwrap();
|
||||||
let buffer = ctx.builder.build_bitcast(buffer, llvm_pi8, "").map(BasicValueEnum::into_pointer_value).unwrap();
|
let buffer = ctx.builder.build_bitcast(buffer, llvm_pi8, "").map(BasicValueEnum::into_pointer_value).unwrap();
|
||||||
let buffer = ArraySliceValue::from_ptr_val(buffer, buffer_size, Some("rpc.buffer.ptr"));
|
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 i_addr = ctx.builder.build_alloca(llvm_usize, "i.addr").unwrap();
|
let i_addr = ctx.builder.build_alloca(llvm_usize, "i.addr").unwrap();
|
||||||
ctx.builder.build_unconditional_branch(head_bb).unwrap();
|
ctx.builder.build_unconditional_branch(head_bb).unwrap();
|
||||||
|
@ -639,34 +640,34 @@ fn format_rpc_ret<'ctx>(
|
||||||
.unwrap())
|
.unwrap())
|
||||||
},
|
},
|
||||||
|generator, ctx| {
|
|generator, ctx| {
|
||||||
// call_memcpy_generic(
|
call_memcpy_generic(
|
||||||
// ctx,
|
ctx,
|
||||||
// ndarray.ptr_to_data(ctx),
|
ndarray.ptr_to_data(ctx),
|
||||||
// buffer.base_ptr(ctx, generator),
|
buffer.base_ptr(ctx, generator),
|
||||||
// llvm_pdata_sizeof,
|
llvm_pdata_sizeof,
|
||||||
// llvm_i1.const_zero(),
|
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)
|
||||||
// };
|
};
|
||||||
// call_memcpy_generic(
|
call_memcpy_generic(
|
||||||
// ctx,
|
ctx,
|
||||||
// ndarray.dim_sizes().base_ptr(ctx, generator),
|
ndarray.dim_sizes().base_ptr(ctx, generator),
|
||||||
// pbuffer_dims_begin,
|
pbuffer_dims_begin,
|
||||||
// dims_buf_sz,
|
dims_buf_sz,
|
||||||
// llvm_i1.const_zero(),
|
llvm_i1.const_zero(),
|
||||||
// );
|
);
|
||||||
|
|
||||||
// This works (with uninitialized data)
|
// // This works (with uninitialized data)
|
||||||
unsafe {
|
// unsafe {
|
||||||
ndarray.dim_sizes().set_typed_unchecked(
|
// ndarray.dim_sizes().set_typed_unchecked(
|
||||||
ctx,
|
// ctx,
|
||||||
generator,
|
// generator,
|
||||||
&llvm_usize.const_zero(),
|
// &llvm_usize.const_zero(),
|
||||||
llvm_usize.const_int(2, false),
|
// llvm_usize.const_int(2, false),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
// let pbuffer_dims_begin = unsafe {
|
// let pbuffer_dims_begin = unsafe {
|
||||||
// buffer.ptr_offset_unchecked(ctx, generator, &llvm_usize.const_int(4, false), None)
|
// buffer.ptr_offset_unchecked(ctx, generator, &llvm_usize.const_int(4, false), None)
|
||||||
|
@ -681,13 +682,13 @@ fn format_rpc_ret<'ctx>(
|
||||||
|
|
||||||
// dims=(10): bufsize = 32
|
// dims=(10): bufsize = 32
|
||||||
|
|
||||||
let sz = call_ndarray_calc_size(generator, ctx, &ndarray.dim_sizes(), (None, None));
|
// let sz = call_ndarray_calc_size(generator, ctx, &ndarray.dim_sizes(), (None, None));
|
||||||
|
//
|
||||||
ndarray.create_data(
|
// ndarray.create_data(
|
||||||
ctx,
|
// ctx,
|
||||||
llvm_elem_ty,
|
// llvm_elem_ty,
|
||||||
sz,
|
// sz,
|
||||||
);
|
// );
|
||||||
|
|
||||||
// let ndims_addr = ndarray.ptr_to_ndims(ctx);
|
// let ndims_addr = ndarray.ptr_to_ndims(ctx);
|
||||||
// let ndarray_pdata = ndarray.data().base_ptr(ctx, generator);
|
// let ndarray_pdata = ndarray.data().base_ptr(ctx, generator);
|
||||||
|
@ -737,16 +738,16 @@ fn format_rpc_ret<'ctx>(
|
||||||
// llvm_i1.const_zero(),
|
// llvm_i1.const_zero(),
|
||||||
// );
|
// );
|
||||||
|
|
||||||
let ndarray_pdata = unsafe {
|
// let ndarray_pdata = unsafe {
|
||||||
ndarray.data().ptr_offset_unchecked(ctx, generator, &llvm_usize.const_int(0, false), None)
|
// ndarray.data().ptr_offset_unchecked(ctx, generator, &llvm_usize.const_int(0, false), None)
|
||||||
};
|
// };
|
||||||
call_memcpy_generic(
|
// call_memcpy_generic(
|
||||||
ctx,
|
// ctx,
|
||||||
ndarray_pdata,
|
// ndarray_pdata,
|
||||||
buffer.base_ptr(ctx, generator),
|
// buffer.base_ptr(ctx, generator),
|
||||||
buffer_size,
|
// buffer_size,
|
||||||
llvm_i1.const_zero()
|
// llvm_i1.const_zero()
|
||||||
);
|
// );
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue