From 5836db479bdb425bb6b46688b40fa77803cecccc Mon Sep 17 00:00:00 2001 From: Balint Cristian Date: Sun, 8 Sep 2024 15:02:16 +0300 Subject: [PATCH] [LLVM][RUNTIME] Fix CodeModel propagation to ORCJIT runtime executor --- src/target/llvm/llvm_instance.h | 5 +++++ src/target/llvm/llvm_module.cc | 1 + 2 files changed, 6 insertions(+) diff --git a/src/target/llvm/llvm_instance.h b/src/target/llvm/llvm_instance.h index fd63140a0b37d..9b25ecaaffdd1 100644 --- a/src/target/llvm/llvm_instance.h +++ b/src/target/llvm/llvm_instance.h @@ -215,6 +215,11 @@ class LLVMTargetInfo { * \return `llvm::TargetOptions` object for this target */ const llvm::TargetOptions& GetTargetOptions() const { return target_options_; } + /*! + * \brief Get the LLVM target code model + * \return `llvm::CodeModel` object for this target + */ + const llvm::CodeModel::Model& GetTargetCodeModel() const { return code_model_; } /*! * \brief Get fast math flags * \return `llvm::FastMathFlags` for this target diff --git a/src/target/llvm/llvm_module.cc b/src/target/llvm/llvm_module.cc index baa68feedfa21..6e7f438393372 100644 --- a/src/target/llvm/llvm_module.cc +++ b/src/target/llvm/llvm_module.cc @@ -476,6 +476,7 @@ void LLVMModuleNode::InitORCJIT() { tm_builder.setCPU(llvm_target->GetCPU()); tm_builder.setFeatures(llvm_target->GetTargetFeatureString()); tm_builder.setOptions(llvm_target->GetTargetOptions()); + tm_builder.setCodeModel(llvm_target->GetTargetCodeModel()); #if TVM_LLVM_VERSION <= 170 tm_builder.setCodeGenOptLevel(llvm::CodeGenOpt::Aggressive); #else