Based on 052b67c8: core/ndstrides: implement np_transpose() (no axes
argument)
The IRRT implementation knows how to handle axes. But the argument is
not in NAC3 yet.
Based on 40c24486: core/ndstrides: implement np_shape() and np_strides()
These functions are not important, but they are handy for debugging.
`np.strides()` is not an actual NumPy function, but `ndarray.strides` is
used.
Based on 8f0084ac: core/ndstrides: implement np_array()
It also checks for inconsistent dimensions if the input is a list.
e.g., rejecting `[[1.0, 2.0], [3.0]]`.
However, currently only `np_array(<input>, copy=False)` and `np_array
(<input>, copy=True)` are supported. In NumPy, copy could be false,
true, or None. Right now, NAC3's `np_array(<input>, copy=False)` behaves
like NumPy's `np.array(<input>, copy=None)`.
- Add alloca_type() function to obtain the type that should be passed
into a `build_alloca` call
- Provide default implementations for raw_alloca and array_alloca
- Add raw_alloca_var and array_alloca_var to distinguish alloca
instructions placed at the front of the function vs at the current
builder location
- Use ProxyValue.name where necessary
- Remove NDArrayValue::ptr_to_{shape,strides}
- Remove functions made obsolete by ndstrides
- Remove use statement for ndarray::views as it only contain an impl
block.
- Remove class_names field in Resolvers of test sources
Based on 8f9d2d82: core/ndstrides: implement ndarray indexing
The functionality for `...` and `np.newaxis` is there in IRRT, but there
is no implementation of them for @kernel Python expressions because of
#486.
Unfortunately the name `NDIndex` is used in later commits. Renaming this
typedef to `NDIndexInt` to avoid amending. `NDIndexInt` will be removed
anyway when ndarray strides is completed.
Based on 01c96396: core/irrt: add Slice and Range and part of
8f9d2d82: core/ndstrides: implement ndarray indexing.
Needed for implementing general ndarray indexing.
Currently IRRT slice and range have nothing to do with NAC3's slice
and range. The IRRT slice and range are currently there to implement
ndarray specific features. However, in the future their definitions may
be used to replace that of NAC3's. (NAC3's range is a [i32 x 3], IRRT's
range is a proper struct. NAC3 does not have a slice struct).
Based on 50f960ab: core/ndstrides: implement ndarray iterator NDIter
A necessary utility to iterate through all elements in a possibly
strided ndarray.
build_int_cast performs signed extension or truncation depending on the
source and target int lengths. This is usually not what we want - We
want zero-extension instead.
Replace all instances of build_int_cast with
build_int_z_extend_or_bit_cast to fix this issue.