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 162540e commit 78278b3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions rbc/irtools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Author: Pearu Peterson
# Created: February 2019

import os
import re
import warnings
from contextlib import contextmanager
Expand Down Expand Up @@ -183,6 +184,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 @@ -378,6 +383,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 78278b3

Please sign in to comment.