You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am tinkering with LLVMSharp 5 to compile numerical computations described via formulas. The first goal is running them via MCJIT on x86-64. I have code at delreluca/AutoExpr@d6ebef7
I am a beginner and want to describe my problem to understand whether it's more on the .NET side or on the LLVM side. If this is not the correct place I'm very grateful for pointers on where to ask. I'm also grateful if you have any pointers on how to debug something like this in depth (I can use Visual Studio but not sure on how to step through the JITted code?).
I decided to use Intel's IPP library instead of doing arithmetic in IR directly (because of calculating 10,000 scenarios).
The code I referenced works fine on macOS with .NET Core 3. But on Windows I get an AccessViolationException; to run it on Windows I changed
LLVM.SetTarget(Generator.Module, Marshal.PtrToStringAnsi(LLVM.GetDefaultTargetTriple()) + "-elf"); because the LLVM version does not support PE
LLVM.SetFunctionCallConv(fn, 64); to set stdcall, although I guess it is not even needed
Change paths to DLL (from: libipp{}.dylib to ipp{}.dll) but still load via NativeLibrary.Load/GetExport)
Interestingly, if I reduce the computation length (and thus the IR listing length) it works on Windows as well.
If I dump the module I get the following. The shorter code that runs would only use variable up to%843.
The fixed addresses 2615317749824, 2615317829824, etc. are where the result, its gradient and initial inputs are kept, it is allocated on the .NET side (via Marshal.AllocHGlobal) before executing (and read out after execution).
I also checked the pointers of the JIT entry point and the loaded DLL exports. Then I looked at the disassembly of the entry point and while it seems reasonable (not an expert though) I was wondering why the call addresses have changed?
I solved it by updating libLLVM to 6.0.1. (As a side effect the ELF target is also not needed anymore.) Even libLLVM 11.0.0 seems to work together with LLVMSharp 5.0.0.
Is this officially supported or might these combinations lead to unexpected errors?
Hi there,
I am tinkering with LLVMSharp 5 to compile numerical computations described via formulas. The first goal is running them via MCJIT on x86-64. I have code at delreluca/AutoExpr@d6ebef7
I am a beginner and want to describe my problem to understand whether it's more on the .NET side or on the LLVM side. If this is not the correct place I'm very grateful for pointers on where to ask. I'm also grateful if you have any pointers on how to debug something like this in depth (I can use Visual Studio but not sure on how to step through the JITted code?).
I decided to use Intel's IPP library instead of doing arithmetic in IR directly (because of calculating 10,000 scenarios).
The listing in the end is just a long sequence of
call
s with some intermediate calculations (see IPP reference for the definitions), which I set up here and hereThe code I referenced works fine on macOS with .NET Core 3. But on Windows I get an AccessViolationException; to run it on Windows I changed
LLVM.SetTarget(Generator.Module, Marshal.PtrToStringAnsi(LLVM.GetDefaultTargetTriple()) + "-elf");
because the LLVM version does not support PELLVM.SetFunctionCallConv(fn, 64);
to set stdcall, although I guess it is not even neededlibipp{}.dylib
toipp{}.dll
) but still load viaNativeLibrary.Load
/GetExport
)Interestingly, if I reduce the computation length (and thus the IR listing length) it works on Windows as well.
If I dump the module I get the following. The shorter code that runs would only use variable up to
%843
.The fixed addresses
2615317749824
,2615317829824
, etc. are where the result, its gradient and initial inputs are kept, it is allocated on the .NET side (viaMarshal.AllocHGlobal
) before executing (and read out after execution).I also checked the pointers of the JIT entry point and the loaded DLL exports. Then I looked at the disassembly of the entry point and while it seems reasonable (not an expert though) I was wondering why the call addresses have changed?
I also tested simpler code that doesn't dynamically allocate memory, but once it is long enough we crash. So I think it's a more general issue.
The text was updated successfully, but these errors were encountered: