Cacheing specific Numba function causes SIGABRT

When I run a specific function without njit cacheing, it runs perfectly fine. However when I do cache it, the program immediately aborts and crashes with this error:

LLVM ERROR: Symbol not found: _.numba.unresolved$_ZN6search7negamaxB3v29B38c8tJTIcFHzwl2ILiXkcBV0KBSgP9CGZpAgA_3dEN5numba1051SearchStructType_28_28_27max_depth_27_2c_20uint16_29_2c_20_28_27max_qdepth_27_2c_20uint16_29_2c_20_28_27min_depth_27_2c_20uint16_29_2c_20_28_27current_search_depth_27_2c_20int16_29_2c_20_28_27ply_27_2c_20int16_29_2c_20_28_27max_time_27_2c_20uint64_29_2c_20_28_27start_time_27_2c_20float64_29_2c_20_28_27node_count_27_2c_20uint64_29_2c_20_28_27pv_table_27_2c_20array_28uint32_2c_202d_2c_20C_29_29_2c_20_28_27pv_length_27_2c_20array_28uint16_2c_201d_2c_20C_29_29_2c_20_28_27killer_moves_27_2c_20array_28uint32_2c_202d_2c_20C_29_29_2c_20_28_27history_moves_27_2c_20array_28uint32_2c_202d_2c_20C_29_29_2c_20_28_27transposition_table_27_2c_20unaligned_20array_28Record_28key_5btype_3duint64_3boffset_3d0_5d_2cscore_5btype_3dint32_3boffset_3d8_5d_2cflag_5btype_3duint8_3boffset_3d12_5d_2cmove_5btype_3duint32_3boffset_3d13_5d_2cdepth_5btype_3dint8_3boffset_3d17_5d_3b18_3bFalse_29_2c_201d_2c_20C_29_29_2c_20_28_27repetition_table_27_2c_20array_28uint64_2c_201d_2c_20C_29_29_2c_20_28_27repetition_index_27_2c_20uint16_29_2c_20_28_27stopped_27_2c_20bool_29_29EN5numba435PositionStructType_28_28_27board_27_2c_20array_28uint8_2c_201d_2c_20C_29_29_2c_20_28_27white_pieces_27_2c_20list_28int64_29_3civ_3dNone_3e_29_2c_20_28_27black_pieces_27_2c_20list_28int64_29_3civ_3dNone_3e_29_2c_20_28_27king_positions_27_2c_20array_28uint8_2c_201d_2c_20C_29_29_2c_20_28_27castle_ability_bits_27_2c_20uint8_29_2c_20_28_27ep_square_27_2c_20int8_29_2c_20_28_27side_27_2c_20uint8_29_2c_20_28_27hash_key_27_2c_20uint64_29_29Exxx

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

I am using two structrefs, and in this function:

def qsearch(engine, position, alpha, beta, depth):

they are the arguments engine, and position. The classes are called SearchStruct and PositionStruct.

In the error I can see them, and for two other functions that also use these structrefs, the program crashes. However, my functions that only use one of the structrefs as an argument cache perfectly fine.

Can you provide an executable piece of code that reproduces the issue please?

Are you making any recursive calls?

2 Likes

I don’t really have a piece of code that can reproduce the issue, but yes I’m making recursive calls.

I think this issue doesn’t have to do with the structrefs, but recursion. I just found this Setting cache=True with a recursive function results in Segmentation fault · Issue #6061 · numba/numba · GitHub

Not sure if I should mark this as the solution, but I don’t think there is much else I can do.

I think you’re correct that there’s not too much you can do right now, apart from attempt to convert your recursive function into an iterative one.

I’ve added an extra note to the issue, because I think the info you’ve provided helps with pinpointing at least one of the issues with caching and recursion: Setting cache=True with a recursive function results in Segmentation fault · Issue #6061 · numba/numba · GitHub - perhaps there is a fix that involves adding the temporarily-unresolved functions generated during the compilation of recursive functions to the cache somehow.

I ran into the same issue using njit cache on recursive functions. I am able to reproduce the error with the following simplified code:

from numba import njit, int32

@njit((int32,), cache=True)
def count(h):
	h += 1
	if h < 10:
		h = count(h)
	return h

@njit(())
def invoke_count():
	h = count(0)
	return h
LLVM ERROR: Symbol not found: .numba.unresolved$_ZN8__main__5countB2v2B38c8tJTIcFHzwl2ILiXkcBV0KBSgP9CGZpAgA_3dEx