1
0
forked from M-Labs/nac3

fixup! artiq: reimplement get_obj_value to use ndarray with strides

update symbol_resolver for general array
This commit is contained in:
lyken 2024-08-22 20:57:56 +08:00
parent 8b0305ab6b
commit ac6c7c5985
No known key found for this signature in database
GPG Key ID: 3BD5FC6AC8325DD8

View File

@ -1149,7 +1149,7 @@ impl InnerResolver {
// create a global for ndarray.shape and initialize it using the shape
let shape_global = ctx.module.add_global(
Array { len: ndims as u32, item: Int(SizeT) }.get_type(generator, ctx.ctx),
Array { len: AnyLen(ndims as u32), item: Int(SizeT) }.get_type(generator, ctx.ctx),
Some(AddressSpace::default()),
&(id_str.clone() + ".shape"),
);
@ -1181,7 +1181,7 @@ impl InnerResolver {
// NOTE: NDArray's `data` is `u8*`. Here, `data_global` is an array of `dtype`.
// We will have to cast it to an `u8*` later.
let data_global = ctx.module.add_global(
Array { len: sz as u32, item: dtype }.get_type(generator, ctx.ctx),
Array { len: AnyLen(sz as u32), item: dtype }.get_type(generator, ctx.ctx),
Some(AddressSpace::default()),
&(id_str.clone() + ".data"),
);
@ -1201,7 +1201,7 @@ impl InnerResolver {
// create a global for ndarray.strides and initialize it
let strides_global = ctx.module.add_global(
Array { len: ndims as u32, item: Int(Byte) }.get_type(generator, ctx.ctx),
Array { len: AnyLen(ndims as u32), item: Int(Byte) }.get_type(generator, ctx.ctx),
Some(AddressSpace::default()),
&(id_str.clone() + ".strides"),
);