Closed rebcabin closed 7 months ago
Also fails with double colon:
def spot_print_lpython_array(a: i16[:, :], rows: i32, cols: i32) -> None:
pass
def spot_print_lpython_array(a: i16[::], rows: i32, cols: i32) -> None:
pass
Also fails with one-dimensional array:
foo: i16[n] = empty((15,), dtype=i16)
spot_print_lpython_array(foo, n, m)
Marking this Issue severe
because without advice or a fix, I cannot pass arrays as parameters to functions, I must manually inline all code, and that's very nasty.
Here is another example of where it's needed to stand in for missing broadcast of constant:
def clear_row(a: i16[:], row: i32, cols: i32) -> None:
j: i32
for j in range(cols):
a[row, j] = i16(0)
VR_SIZE: i32 = 32_768
k: i32
A_ik: i16
jj: i32
ii: i32
i: i32
for jj in range(0, l, VR_SIZE): # each VR-col chunk in B and C
for ii in range(0, n, M2): # each M2 block in A cols and B rows
for i in range(0, M2): # zero-out rows of C
# Due to Issue 2496, I cannot pass an array to a function
clear_row(Cnl, i + ii, l) # ~~~~~~~~~~~~~~~~~~ ATTENTION ~~~~~~
# Cnl[i + ii, :] = 0
pass
There are several issues:
spot_print_lpython_array
. The first argument must be a: i16[:,:]
. Yes, LPython should catch it, we are weak in checking incorrect code, this can be improved after we reach beta. I created an issue for this: https://github.com/lcompilers/lpython/issues/2515code generation error: Type integer const not implemented yet.
. That means the integer kind (likely i16
) is not implemented in some ways. Fixed in https://github.com/lcompilers/lpython/pull/2514.Now it works.
I imitated some code in
integration_tests/array_expr02.py
. Here is a snippet:In my context, this pattern generated an unhandled exception.