Hard to debug new errors under 0.59rc1

I maintain a project called PyNNDescent for approximate nearest neighbor search which makes heavy use of Numba. I am testing against the new 0.59rc1 pre-release and the project currently gives errors. The error message is quite long, so I won’t reproduce it here until asked, but the issue seems to revolve around a single function:

@numba.njit(
    parallel=True,
    locals={
        "p": numba.int32,
        "q": numba.int32,
        "d": numba.float32,
        "added": numba.uint8,
        "n": numba.uint32,
        "i": numba.uint32,
        "j": numba.uint32,
    },
    cache=False,
)
def apply_graph_updates_low_memory(current_graph, updates, n_threads):

    n_changes = 0
    priorities = current_graph[1]
    indices = current_graph[0]
    flags = current_graph[2]

    for n in numba.prange(n_threads):
        for i in range(len(updates)):
            for j in range(len(updates[i])):
                p, q, d = updates[i][j]

                if p == -1 or q == -1:
                    continue

                if p % n_threads == n:
                    added = checked_flagged_heap_push(
                        priorities[p], indices[p], flags[p], d, q, 1
                    )
                    n_changes += added

                if q % n_threads == n:
                    added = checked_flagged_heap_push(
                        priorities[q], indices[q], flags[q], d, p, 1
                    )
                    n_changes += added

    return n_changes

With parallel set to True this function fails to compile; with parallel set to False it works. Under previous releases of Numba this code worked with parallel True. Since the code is relatively short, and the error sufficiently opaque, I was hoping that someone could suggest something about this code that contravenes what numba requires for parallelism under 0.59 (but not under previosu versions).

Thanks in advance for any suggestions.

Funny, I was just taking a crack at getting PyNNDescent to work for the sake of porting pyliger over to 3.12. I’m not entirely sure if this is the same error that I’m running into, but it very well may be.

the gist of the error output that I’m getting appears to be

errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Internal error at <numba.core.typeinfer.CallConstraint object at 0x00000262BA70AAB0>.
Failed in nopython mode pipeline (step: parfor prelowering)
'NoneType' object has no attribute 'name'
During: resolving callee type: type(CPUDispatcher(<function apply_graph_updates_low_memory at 0x0000028077C3B420>))
During: typing of call at e:\pynndescent\pynndescent\pynndescent_.py (228)
c += apply_graph_updates_low_memory(current_graph, updates, n_threads)

It seems like its having trouble inferring a signature for apply_graph_updates_low_memory, but I’m not sure why that would be the case when it worked fine on 0.58.0.

Best,
-Andrew

Yes, that’s the error (plus lots of other associated verbiage).

1 Like

@lmcinnes @theAeon thanks for trying out the 0.59.0rc1 build and reporting this error.

From the description in the OP I made some guesses and managed to create an isolated reproducer (which triggered the error reported in the second post). From there git bisect pointed at Numba pull request #9244 causing the problem. On closer inspection of that change set @sklam spotted a bug that would cause the problem you were seeing, this has been fixed in Numba pull request #9407 and the fix is being applied to the release0.59 branch so will make it into Numba 0.59.0. Thanks again for testing the RC and reporting, it’s much appreciated.

2 Likes

Thanks so much for the very speedy resolution on this!

1 Like

No problem, I’m glad it was reported and fixed before the final tag was made. Thanks again for your help with it!

1 Like