numba-mlir icon indicating copy to clipboard operation
numba-mlir copied to clipboard

Reduction to scalar (not array) fails

Open AlexanderKalistratov opened this issue 1 year ago • 0 comments

from dpctl import tensor as np
from numba_mlir import njit
import numba
from numba import prange

size = 10*1000

@njit(parallel=True)
def foo(a):
    acc = 0
    for i in prange(size):
        acc += a[i]

    return acc

a = np.ones(size)
print(foo(a))

Output:

RuntimeError: Failed in nopython mode pipeline (step: <class 'numba_mlir.mlir.passes.MlirBackend'>)
MLIR pipeline failed
failed to legalize operation 'gpu.func'
see current operation:
"gpu.func"() <{function_type = (memref<?xf32>, memref<?xf64>) -> ()}> ({
^bb0(%arg0: memref<?xf32>, %arg1: memref<?xf64>):
....

AlexanderKalistratov avatar Nov 13 '23 19:11 AlexanderKalistratov