forked from M-Labs/nac3
1
0
Fork 0

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
1 changed files with 3 additions and 3 deletions

View File

@ -1149,7 +1149,7 @@ impl InnerResolver {
// create a global for ndarray.shape and initialize it using the shape // create a global for ndarray.shape and initialize it using the shape
let shape_global = ctx.module.add_global( 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()), Some(AddressSpace::default()),
&(id_str.clone() + ".shape"), &(id_str.clone() + ".shape"),
); );
@ -1181,7 +1181,7 @@ impl InnerResolver {
// NOTE: NDArray's `data` is `u8*`. Here, `data_global` is an array of `dtype`. // NOTE: NDArray's `data` is `u8*`. Here, `data_global` is an array of `dtype`.
// We will have to cast it to an `u8*` later. // We will have to cast it to an `u8*` later.
let data_global = ctx.module.add_global( 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()), Some(AddressSpace::default()),
&(id_str.clone() + ".data"), &(id_str.clone() + ".data"),
); );
@ -1201,7 +1201,7 @@ impl InnerResolver {
// create a global for ndarray.strides and initialize it // create a global for ndarray.strides and initialize it
let strides_global = ctx.module.add_global( 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()), Some(AddressSpace::default()),
&(id_str.clone() + ".strides"), &(id_str.clone() + ".strides"),
); );