This commit is contained in:
David Mak 2024-08-13 17:07:00 +08:00
parent 5b1995dc0b
commit 646393731c
1 changed files with 7 additions and 1 deletions

View File

@ -430,6 +430,8 @@ fn gen_rpc_tag(
buffer.push(b'a'); buffer.push(b'a');
buffer.push((ndarray_ndims & 0xFF) as u8); buffer.push((ndarray_ndims & 0xFF) as u8);
gen_rpc_tag(ctx, ndarray_dtype, buffer)?; gen_rpc_tag(ctx, ndarray_dtype, buffer)?;
println!("[{buffer:#04X?}]");
} }
_ => return Err(format!("Unsupported type: {:?}", ctx.unifier.stringify(ty))), _ => return Err(format!("Unsupported type: {:?}", ctx.unifier.stringify(ty))),
} }
@ -548,11 +550,15 @@ fn rpc_codegen_callback_fn<'ctx>(
.unwrap(); .unwrap();
let arg_slot = if matches!(&*ctx.unifier.get_ty_immutable(*arg_ty), TypeEnum::TObj { obj_id, .. } if *obj_id == PrimDef::NDArray.id()) let arg_slot = if matches!(&*ctx.unifier.get_ty_immutable(*arg_ty), TypeEnum::TObj { obj_id, .. } if *obj_id == PrimDef::NDArray.id())
{ {
println!("Codegen for ndarray RPC");
debug_assert_eq!(u64::from(size_type.get_bit_width() / 8), 4);
unsafe { unsafe {
ctx.builder ctx.builder
.build_in_bounds_gep( .build_in_bounds_gep(
arg_slot, arg_slot,
&[size_type.const_int(u64::from(size_type.get_bit_width() / 8), false)], // should be 4 &[size_type.const_int(4, false)], // should be 4
"", "",
) )
.unwrap() .unwrap()