Skip to content

Commit

Permalink
raise error on LLVM version mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermeleobas committed May 9, 2023
1 parent ba03878 commit fe65405
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions rbc/irtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ def post_lowering(self, mod, library):
# Code generation methods


class LLVMVersionMismatchError(Exception):
pass


@contextmanager
def replace_numba_internals_hack():
# Hackish solution to prevent numba from calling _ensure_finalize. See issue #87
Expand Down Expand Up @@ -440,6 +444,27 @@ def compile_to_LLVM(functions_and_signatures,
LLVM module instance. To get the IR string, use `str(module)`.
"""
# check LLVM version before compiling to LLVM
server_llvm_version = target_info.llvm_version
client_llvm_version = llvm.llvm_version_info

if (server_llvm_version[0], client_llvm_version[0]) == (11, 14):
c_llvm = '.'.join(map(str, client_llvm_version))
s_llvm = '.'.join(map(str, server_llvm_version))
flag = 'RBC_DISABLE_LLVM_MISMATCH_ERROR'
msg = (f'The client LLVM version ({c_llvm}) is greater than the server '
f'LLVM version ({s_llvm}). This is known to be unsupported. '
'Please, downgrade to a previous release of Numba that uses the '
'same LLVM version as the HeavyDB server. For more information, '
'see the table below:\n\n'
'https://github.com/numba/llvmlite#compatibility\n'
'https://github.com/heavyai/heavydb#dependencies\n\n'
f'To disable this error, run RBC with {flag}=1 flag enabled.')

DISABLE_LLVM_MISMATCH_ERROR = int(os.environ.get(flag, False))
if not DISABLE_LLVM_MISMATCH_ERROR:
raise LLVMVersionMismatchError(msg)

target_desc = registry.cpu_target

typing_context = JITRemoteTypingContext()
Expand Down

0 comments on commit fe65405

Please sign in to comment.