-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compiler-rt linkage needed for certain builtins (e.g. truncate double to half type) #834
Labels
feature_request
Feature Request
Comments
jvesely
added a commit
to jvesely/PsyNeuLink
that referenced
this issue
Apr 15, 2022
Add tests. Conversion from double -> half is not accurate, because of an issue with a call to runtime library [0]. [0] numba/llvmlite#834 Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
jvesely
added a commit
to jvesely/PsyNeuLink
that referenced
this issue
Apr 15, 2022
Add tests. Conversion from double -> half is not accurate, because of an issue with a call to runtime library [0]. [0] numba/llvmlite#834 Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Thanks for the report. I think this will require making MWR for the above: import llvmlite.binding as llvm
from llvmlite import ir
int16 = ir.IntType(16)
double = ir.DoubleType()
half = ir.HalfType()
fnty = ir.FunctionType(int16, (double,))
module = ir.Module(name=__file__)
func = ir.Function(module, fnty, name="fptest")
block = func.append_basic_block(name="entry")
builder = ir.IRBuilder(block)
a, = func.args
result = builder.fptrunc(a, half, name="res")
result = builder.bitcast(result, int16)
builder.ret(result)
print(module)
llvm.initialize()
llvm.initialize_native_target()
llvm.initialize_native_asmprinter()
target = llvm.Target.from_default_triple()
target_machine = target.create_target_machine()
llmod = llvm.parse_assembly(str(module))
llmod.verify()
engine = llvm.create_mcjit_compiler(llmod, target_machine)
engine.finalize_object()
engine.run_static_constructors()
print(target_machine.emit_assembly(llmod)) |
Note: Issue title updated to reflect required changes/help with searching/reference. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
a simple example is fp conversion from fp64 to fp16:
the generated assembly looks ok:
however, when inspecting the function in gdb after receiving sigsegv:
This looks like a linking failure. the necessary
__truncdfhf2
function should be in LLVM's compiler-rt library.The text was updated successfully, but these errors were encountered: