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

Improve support for GCC dual ABI with LLVM/AX/Houdini builds #1716

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions openvdb_ax/openvdb_ax/compiler/Compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
#include <llvm/Target/TargetMachine.h>
#include <llvm/Target/TargetOptions.h>

// @note We use the C implementation of llvm::sys::getDefaultTargetTriple(),
// LLVMGetDefaultTargetTriple(), as the C++ version returns a std::string
// which causes issues with GCCs dual ABI (whereby most LLVM installations
// are on the newer ABI and the VFX platform, i.e. Houdini, is on the old ABI).
#include <llvm-c/TargetMachine.h>

// @note As of adding support for LLVM 5.0 we not longer explicitly
// perform standard compiler passes (-std-compile-opts) based on the changes
// to the opt binary in the llvm codebase (tools/opt.cpp). We also no
Expand Down Expand Up @@ -66,13 +72,13 @@ namespace
/// @brief Initialize a target machine for the host platform. Returns a nullptr
/// if a target could not be created.
/// @note This logic is based off the Kaleidoscope tutorial below with extensions
/// for CPU and CPU featrue set targetting
/// for CPU and CPU feature set targeting
/// https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl08.html
inline std::unique_ptr<llvm::ExecutionEngine>
initializeExecutionEngine(std::unique_ptr<llvm::Module> M, Logger& logger)
{
// This handles MARCH (i.e. we don't need to set it on the EngineBuilder)
M->setTargetTriple(llvm::sys::getDefaultTargetTriple());
M->setTargetTriple(LLVMGetDefaultTargetTriple());
llvm::Module* module = M.get();

// stringref->bool map of features->enabled
Expand Down
3 changes: 2 additions & 1 deletion openvdb_ax/openvdb_ax/test/backend/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <llvm/IR/IRBuilder.h>
#include <llvm/ExecutionEngine/ExecutionEngine.h>
#include <llvm/Support/Host.h>
#include <llvm-c/TargetMachine.h> // LLVMGetDefaultTargetTriple

#include <memory>
#include <string>
Expand Down Expand Up @@ -46,7 +47,7 @@ struct LLVMState

inline std::unique_ptr<llvm::ExecutionEngine> EE()
{
mModule->setTargetTriple(llvm::sys::getDefaultTargetTriple());
mModule->setTargetTriple(LLVMGetDefaultTargetTriple());
llvm::StringMap<bool> HostFeatures;
llvm::sys::getHostCPUFeatures(HostFeatures);
std::vector<llvm::StringRef> features;
Expand Down
4 changes: 4 additions & 0 deletions pendingchanges/llvm_dual_abi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
OpenVDB AX:
- Improvements:
Improved build support for using both GCCs old/new ABI which makes it
easier to use AX with Houdini.