Hello, I am trying to create a JIT version of the ISPC compiler (without modifying offline behavior). The branch is public and I would love to work together to integrate changes into the master once the interface is more stable, https://github.com/ivalduan/ispc/tree/llvm_orc_jit
ispc::ispcInit(); ispc::TargetOptions topt; ispc::Target * target = new ispc::Target(topt, true); ispc::Module * module = new ispc::Module("main"); module->SetTarget(target); int err; err = module->Compile(sourceStr); ispc::IspcJIT * ispcJit = new ispc::IspcJIT; err = ispcJit->initExecutionEngine(target); ispc::IspcJIT::ModuleHandle H = ispcJit->addModule(module); llvm::JITSymbol sym1 = ispcJit->findSymbol("main_ispc"); assert(sym1 && "Function not found"); llvm::JITTargetAddress addr1 = llvm::cantFail(sym1.getAddress()); ... ispc::ispcTerminate(); As far as I do not need external symbols everything works as expected, the problem is JIT compiling kernels with calls to ISPCAlloc, ISPCLaunch and ISPCSync. Those symbols are statically linked into the library calling the JIT. I figured out that I need to add the external symbols with llvm::DynamicLibrary::AddSymbol(..) at runtime in order to be able to find them, but after finding them I am having resolve issues ("Relocation overflow"), file RuntimeDyldCOFFX86_64.h. This is the function that adds the external symbols. void ispcJitAddExplicitSymbols() { llvm::sys::DynamicLibrary::AddSymbol("ISPCAlloc", &ISPCAlloc); llvm::sys::DynamicLibrary::AddSymbol("ISPCLaunch", &ISPCLaunch); llvm::sys::DynamicLibrary::AddSymbol("ISPCSync", &ISPCSync); } I am new to the COFF object format but I guess I need somehow to indicate that those symbols are not internal when they are added to a module as builtin functions with ISPC. Could anyone knowing better than me all the machinery give me some hints? Thanks. -- You received this message because you are subscribed to the Google Groups "Intel SPMD Program Compiler Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to ispc-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.