Skip to content
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

Support for LLVM > 3.4 #102

Open
florianjacob opened this issue Jul 3, 2016 · 1 comment
Open

Support for LLVM > 3.4 #102

florianjacob opened this issue Jul 3, 2016 · 1 comment

Comments

@florianjacob
Copy link

In its current state, gpuocelot won't work with anything above LLVM 3.4. e.g. #99 and #100 are symptoms of that.

LLVM seems to have introduced some quite heavy changes, so this probably won't be trivial to fix, and if one were to do so, one would probably have to drop support for LLVM 3.4 as this would really get you in ifdef hell, not only in the includes, but also inside the code.

Problems I found / fixed so far, but there are many more:

#define HAVE_LLVM 1
#include <llvm/Config/llvm-config.h>

/* PassManager is legacy starting from llvm 3.7 */
#if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7
#define LLVM_37_PLUS 1
#endif

/* llvm/Assembly/Parser.h moved to llvm/AsmParser/Parser.h in llvm 3.5 */
/* llvm/Analysis/Verifier.h moved to llvm/IR/Verifier.h in llvm 3.5 */
#if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5
#define LLVM_35_PLUS 1
#endif

#else
#define HAVE_LLVM 0
#endif
#if LLVM_37_PLUS
#include "llvm/IR/LegacyPassManager.h"
using namespace llvm::legacy;
#else
#include <llvm/PassManager.h>
#endif
#if LLVM_35_PLUS
#include <llvm/AsmParser/Parser.h>
#include <llvm/IR/Verifier.h>
#else
#include <llvm/Assembly/Parser.h>
#include <llvm/Analysis/Verifier.h>
#endif

Preview of errors where I gave up, ParseAssemblyString is now parseAssemblyString and freeMachineCodeForFunction doesn't exist anymore at all:

ocelot/ocelot/ir/implementation/ExternalFunctionSet.cpp:320:6: error: 'ParseAssemblyString' is not a member of 'llvm'
  m = llvm::ParseAssemblyString(kernel.code().c_str(),
      ^~~~
ocelot/ocelot/ir/implementation/ExternalFunctionSet.cpp:341:28: error: 'ReturnStatusAction' is not a member of 'llvm'
  if(llvm::verifyModule(*m, llvm::ReturnStatusAction, &verifyError))
                            ^~~~
ocelot/ocelot/ir/implementation/ExternalFunctionSet.cpp: In destructor 'ir::ExternalFunctionSet::~ExternalFunctionSet()':
ocelot/ocelot/ir/implementation/ExternalFunctionSet.cpp:426:33: error: 'class llvm::ExecutionEngine' has no member named 'freeMachineCodeForFunction'
    executive::LLVMState::jit()->freeMachineCodeForFunction(function);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
ocelot/ocelot/ir/implementation/ExternalFunctionSet.cpp: In member function 'void ir::ExternalFunctionSet::remove(const string&)':
ocelot/ocelot/ir/implementation/ExternalFunctionSet.cpp:465:32: error: 'class llvm::ExecutionEngine' has no member named 'freeMachineCodeForFunction'
   executive::LLVMState::jit()->freeMachineCodeForFunction(llvmFunction);
@dmikushin
Copy link

Hi @florianjacob , thank you for sharing your changes, they are very useful!

where I gave up

Never give up: gpuocelot/gpuocelot@0a9d72f#diff-6ebfad6f91f81f64f278a3a4d6920ff0bf60b4f83fca97abb36ad88f9dcd0d27R321

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants