Skip to content

Commit

Permalink
Fix subsetted build issues with arm32/64, hexagon. Fixes #5744. Fixes #…
Browse files Browse the repository at this point in the history
…5628 (#5745) (#5753)

(cherry picked from commit d053463)
  • Loading branch information
alexreinking authored Feb 17, 2021
1 parent 0a1a77e commit 405cd5f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/CodeGen_Hexagon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2313,6 +2313,7 @@ std::unique_ptr<CodeGen_Posix> new_CodeGen_Hexagon(const Target &target, llvm::L

std::unique_ptr<CodeGen_Posix> new_CodeGen_Hexagon(const Target &target, llvm::LLVMContext &context) {
user_error << "hexagon not enabled for this build of Halide.\n";
return nullptr;
}

#endif // WITH_HEXAGON
Expand Down
55 changes: 39 additions & 16 deletions src/LLVM_Runtime_Linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,17 @@ std::unique_ptr<llvm::Module> parse_bitcode_file(llvm::StringRef buf, llvm::LLVM
return parse_bitcode_file(sb, context, #mod); \
}

#define DECLARE_NO_INITMOD(mod) \
std::unique_ptr<llvm::Module> get_initmod_##mod(llvm::LLVMContext *, bool, bool) { \
user_error << "Halide was compiled without support for this target\n"; \
return std::unique_ptr<llvm::Module>(); \
} \
std::unique_ptr<llvm::Module> get_initmod_##mod##_ll(llvm::LLVMContext *) { \
user_error << "Halide was compiled without support for this target\n"; \
return std::unique_ptr<llvm::Module>(); \
#define DECLARE_NO_INITMOD(mod) \
std::unique_ptr<llvm::Module> get_initmod_##mod(llvm::LLVMContext *, bool = false, bool = false) { \
user_error << "Halide was compiled without support for this target\n"; \
return std::unique_ptr<llvm::Module>(); \
} \
std::unique_ptr<llvm::Module> get_initmod_##mod##_ll(llvm::LLVMContext *) { \
user_error << "Halide was compiled without support for this target\n"; \
return std::unique_ptr<llvm::Module>(); \
}

#define DECLARE_CPP_INITMOD(mod) \
DECLARE_INITMOD(mod##_32_debug) \
DECLARE_INITMOD(mod##_64_debug) \
DECLARE_INITMOD(mod##_32) \
DECLARE_INITMOD(mod##_64) \
#define DECLARE_CPP_INITMOD_LOOKUP(mod) \
std::unique_ptr<llvm::Module> get_initmod_##mod(llvm::LLVMContext *context, bool bits_64, bool debug) { \
if (bits_64) { \
if (debug) { \
Expand All @@ -65,6 +61,13 @@ std::unique_ptr<llvm::Module> parse_bitcode_file(llvm::StringRef buf, llvm::LLVM
} \
}

#define DECLARE_CPP_INITMOD(mod) \
DECLARE_INITMOD(mod##_32_debug) \
DECLARE_INITMOD(mod##_64_debug) \
DECLARE_INITMOD(mod##_32) \
DECLARE_INITMOD(mod##_64) \
DECLARE_CPP_INITMOD_LOOKUP(mod)

#define DECLARE_LL_INITMOD(mod) \
DECLARE_INITMOD(mod##_ll)

Expand Down Expand Up @@ -197,14 +200,34 @@ DECLARE_LL_INITMOD(ptx_compute_30)
DECLARE_LL_INITMOD(ptx_compute_35)
#endif // WITH_NVPTX

#ifdef WITH_D3D12
#if defined(WITH_D3D12) && defined(WITH_X86)
DECLARE_CPP_INITMOD(windows_d3d12compute_x86)
DECLARE_CPP_INITMOD(windows_d3d12compute_arm)
#else
DECLARE_NO_INITMOD(windows_d3d12compute_x86)
DECLARE_NO_INITMOD(windows_d3d12compute_arm)
#endif

#ifdef WITH_D3D12
#ifdef WITH_ARM
DECLARE_INITMOD(windows_d3d12compute_arm_32)
DECLARE_INITMOD(windows_d3d12compute_arm_32_debug)
#else
DECLARE_NO_INITMOD(windows_d3d12compute_arm_32)
DECLARE_NO_INITMOD(windows_d3d12compute_arm_32_debug)
#endif

#ifdef WITH_AARCH64
DECLARE_INITMOD(windows_d3d12compute_arm_64)
DECLARE_INITMOD(windows_d3d12compute_arm_64_debug)
#else
DECLARE_NO_INITMOD(windows_d3d12compute_arm_64)
DECLARE_NO_INITMOD(windows_d3d12compute_arm_64_debug)
#endif

DECLARE_CPP_INITMOD_LOOKUP(windows_d3d12compute_arm)
#else
DECLARE_NO_INITMOD(windows_d3d12compute_arm)
#endif // WITH_D3D12

#ifdef WITH_X86
DECLARE_LL_INITMOD(x86_avx2)
DECLARE_LL_INITMOD(x86_avx)
Expand Down
6 changes: 4 additions & 2 deletions src/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ foreach (i IN LISTS RUNTIME_CPP)
endif ()
# Windows on ARM
elseif (i MATCHES "windows_.*_arm$")
if (j EQUAL 32)
if (j EQUAL 32 AND TARGET_ARM)
set(TARGET "arm-unknown-windows-unknown")
else ()
elseif (j EQUAL 64 AND TARGET_AARCH64)
set(TARGET "aarch64-unknown-windows-unknown")
else ()
continue()
endif ()
# Windows Generic
else()
Expand Down

0 comments on commit 405cd5f

Please sign in to comment.