Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
# TODO: detect this from repo somehow: https://github.com/halide/Halide/issues/8406
LLVM_VERSION: 21.1.8
LLVM_VERSION: 22.1.0
FLATBUFFERS_VERSION: 23.5.26
WABT_VERSION: 1.0.39

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing-arm-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
bits: [ "64", "32" ]
uv_group: [ "ci-llvm-main", "ci-llvm-22", "ci-llvm-21", "ci-llvm-20" ]
uv_group: [ "ci-llvm-main", "ci-llvm-22", "ci-llvm-21" ]
include:
- bits: 32
arch: armv7l
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
bits: [ "32" ] # Intentionally not 64, as we haven't configured self-hosted runners for it yet.
uv_group: [ "ci-llvm-main", "ci-llvm-22", "ci-llvm-21", "ci-llvm-20" ]
uv_group: [ "ci-llvm-main", "ci-llvm-22", "ci-llvm-21" ]
include:
- bits: 32
arch: i686
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing-make.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Makefile

env:
LLVM_VERSION: '21'
LLVM_VERSION: '22'

on:
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
bits: [ "32" ] # Intentionally not 64, as we haven't configured self-hosted runners for it yet.
uv_group: [ "ci-llvm-main", "ci-llvm-22", "ci-llvm-21", "ci-llvm-20" ]
uv_group: [ "ci-llvm-main", "ci-llvm-22", "ci-llvm-21" ]
include:
- bits: 32
arch: x86
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ option(THREADS_PREFER_PTHREAD_FLAG "When enabled, prefer to use the -pthread fla
find_package(Threads REQUIRED)

## LLVM
find_package(Halide_LLVM 20...99 REQUIRED # Use 99 to fake a minimum-only constraint
find_package(Halide_LLVM 21...99 REQUIRED # Use 99 to fake a minimum-only constraint
COMPONENTS WebAssembly X86
OPTIONAL_COMPONENTS AArch64 ARM Hexagon NVPTX PowerPC RISCV)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ issue.

At any point in time, building Halide requires either the latest stable version
of LLVM, the previous stable version of LLVM, or trunk. At the time of writing,
this means versions 22, 21, and 20 are supported, but 19 is not.
this means versions 23, 22, and 21 are supported, but 20 is not.

It is simplest to get a binary release of LLVM on macOS by using
[Homebrew](https://brew.sh). Just run `brew install llvm`. On Debian flavors of
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindHalide_LLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ foreach (
"/usr/local/lib/llvm-@VERSION@" # Third-party packages
"/opt/llvm-@VERSION@" # Third-party packages
)
foreach (VERSION RANGE 20 22) # inclusive!
foreach (VERSION RANGE 21 23) # inclusive!
string(CONFIGURE "${template}" path @ONLY)
list(APPEND llvm_paths "${path}")
endforeach ()
Expand All @@ -28,7 +28,7 @@ find_package(LLVM PATHS ${llvm_paths})

# Neither LLVM_VERSION nor LLVM_PACKAGE_VERSION work as find_package arguments
# in git/development builds as they include a "git" suffix. This applies at
# time of writing to versions 18-21, inclusive.
# time of writing to versions 21-23, inclusive.
if (LLVM_FOUND)
set(Halide_LLVM_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
endif ()
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ ci-base = [
ci-llvm-main = [{ include-group = "ci-base" }, "halide-llvm~=23.0.0.dev0"]
ci-llvm-22 = [{ include-group = "ci-base" }, "halide-llvm~=22.1.0"]
ci-llvm-21 = [{ include-group = "ci-base" }, "halide-llvm~=21.1.0"]
ci-llvm-20 = [{ include-group = "ci-base" }, "halide-llvm~=20.1.0"]

[project.urls]
Homepage = "https://halide-lang.org"
Expand Down
7 changes: 0 additions & 7 deletions src/CodeGen_Internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,6 @@ void get_target_options(const llvm::Module &module, llvm::TargetOptions &options

options = llvm::TargetOptions();
options.AllowFPOpFusion = per_instruction_fast_math_flags ? llvm::FPOpFusion::Strict : llvm::FPOpFusion::Fast;
#if LLVM_VERSION < 210
options.UnsafeFPMath = !per_instruction_fast_math_flags;
#endif
#if LLVM_VERSION < 230
options.NoInfsFPMath = !per_instruction_fast_math_flags;
#endif
Expand Down Expand Up @@ -676,11 +673,7 @@ std::unique_ptr<llvm::TargetMachine> make_target_machine(const llvm::Module &mod
std::string mattrs = get_modflag_string(module, "halide_mattrs");

auto *tm = llvm_target->createTargetMachine(
#if LLVM_VERSION >= 210
triple,
#else
triple.str(),
#endif
mcpu_target,
mattrs,
options,
Expand Down
8 changes: 0 additions & 8 deletions src/CodeGen_LLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,7 @@ void CodeGen_LLVM::init_codegen(const std::string &name) {

internal_assert(module && context);

#if LLVM_VERSION >= 210
debug(1) << "Target triple of initial module: " << module->getTargetTriple().str() << "\n";
#else
debug(1) << "Target triple of initial module: " << module->getTargetTriple() << "\n";
#endif

module->setModuleIdentifier(name);

Expand Down Expand Up @@ -3397,11 +3393,7 @@ void CodeGen_LLVM::visit(const Call *op) {
llvm::BasicBlock *block = llvm::BasicBlock::Create(module->getContext(), "entry", fn);
IRBuilderBase::InsertPoint here = builder->saveIP();
builder->SetInsertPoint(block);
#if LLVM_VERSION >= 210
Value *ret = builder->CreateVScale(i32_t);
#else
Value *ret = builder->CreateVScale(ConstantInt::get(i32_t, 1));
#endif
builder->CreateRet(ret);

// To avoid vscale_range(n,n) added in CodeGen_Internal
Expand Down
7 changes: 0 additions & 7 deletions src/CodeGen_PTX_Dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,6 @@ vector<char> CodeGen_PTX_Dev::compile_to_src() {

TargetOptions options;
options.AllowFPOpFusion = CodeGen_GPU_Dev::any_strict_float ? llvm::FPOpFusion::Strict : llvm::FPOpFusion::Fast;
#if LLVM_VERSION < 210
options.UnsafeFPMath = !CodeGen_GPU_Dev::any_strict_float;
#endif
#if LLVM_VERSION < 230
options.NoInfsFPMath = !CodeGen_GPU_Dev::any_strict_float;
#endif
Expand All @@ -641,11 +638,7 @@ vector<char> CodeGen_PTX_Dev::compile_to_src() {

std::unique_ptr<TargetMachine>
target_machine(llvm_target->createTargetMachine(
#if LLVM_VERSION >= 210
triple,
#else
triple.str(),
#endif
mcpu_target(), mattrs(), options,
llvm::Reloc::PIC_,
llvm::CodeModel::Small,
Expand Down
18 changes: 0 additions & 18 deletions src/JITModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,7 @@ void compile_module_impl(

// Make the execution engine
debug(2) << "Creating new execution engine\n";
#if LLVM_VERSION >= 210
debug(2) << "Target triple: " << m->getTargetTriple().str() << "\n";
#else
debug(2) << "Target triple: " << m->getTargetTriple() << "\n";
#endif
string error_string;

llvm::for_each(*m, set_function_attributes_from_halide_target_options);
Expand Down Expand Up @@ -412,29 +408,15 @@ void compile_module_impl(
// i386: "JIT session error: Unsupported i386 relocation:4" (R_386_PLT32)
// ARM 32bit: Unsupported target machine architecture in ELF object shared runtime-jitted-objectbuffer
// Windows 64-bit: JIT session error: could not register eh-frame: __register_frame function not found
#if LLVM_VERSION >= 210
linkerBuilder = [&](llvm::orc::ExecutionSession &session) {
return std::make_unique<llvm::orc::RTDyldObjectLinkingLayer>(session, [&](const llvm::MemoryBuffer &) {
return std::make_unique<HalideJITMemoryManager>(dependencies);
});
};
#else
linkerBuilder = [&](llvm::orc::ExecutionSession &session, const llvm::Triple &) {
return std::make_unique<llvm::orc::RTDyldObjectLinkingLayer>(session, [&]() {
return std::make_unique<HalideJITMemoryManager>(dependencies);
});
};
#endif
} else {
#if LLVM_VERSION >= 210
linkerBuilder = [](llvm::orc::ExecutionSession &session) {
return std::make_unique<llvm::orc::ObjectLinkingLayer>(session);
};
#else
linkerBuilder = [](llvm::orc::ExecutionSession &session, const llvm::Triple &) {
return std::make_unique<llvm::orc::ObjectLinkingLayer>(session);
};
#endif
}

auto JIT = llvm::cantFail(llvm::orc::LLJITBuilder()
Expand Down
4 changes: 2 additions & 2 deletions src/LLVM_Headers.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef HALIDE_LLVM_HEADERS_H
#define HALIDE_LLVM_HEADERS_H

#if LLVM_VERSION >= 200
#if LLVM_VERSION >= 210
// We're good to go
#else
#error "Compiling Halide requires LLVM 20.0 or newer"
#error "Compiling Halide requires LLVM 21.0 or newer"
#endif

// No msvc warnings from llvm headers please
Expand Down
4 changes: 0 additions & 4 deletions src/LLVM_Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,7 @@ void emit_file(const llvm::Module &module_in, Internal::LLVMOStream &out,
llvm::CodeGenFileType file_type) {
// Make sure to run this with a large stack!
debug(1) << "emit_file.Compiling to native code...\n";
#if LLVM_VERSION >= 210
debug(2) << "Target triple: " << module_in.getTargetTriple().str() << "\n";
#else
debug(2) << "Target triple: " << module_in.getTargetTriple() << "\n";
#endif

auto time_start = std::chrono::high_resolution_clock::now();

Expand Down
8 changes: 0 additions & 8 deletions src/LLVM_Runtime_Linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,11 +630,7 @@ void link_modules(std::vector<std::unique_ptr<llvm::Module>> &modules, Target t,
}
}
module->setDataLayout(data_layout);
#if LLVM_VERSION >= 210
module->setTargetTriple(triple);
#else
module->setTargetTriple(triple.str());
#endif
}

// Link them all together
Expand Down Expand Up @@ -1420,11 +1416,7 @@ std::unique_ptr<llvm::Module> get_initial_module_for_ptx_device(Target target, l
}

llvm::Triple triple("nvptx64--");
#if LLVM_VERSION >= 210
modules[0]->setTargetTriple(triple);
#else
modules[0]->setTargetTriple(triple.str());
#endif

llvm::DataLayout dl("e-i64:64-v16:16-v32:32-n16:32:64");
modules[0]->setDataLayout(dl);
Expand Down
9 changes: 0 additions & 9 deletions test/autoschedulers/mullapudi2016/histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,6 @@ int main(int argc, char **argv) {
return 0;
}

// LLVM 20 generates poor SVE2 code for the histogram autoscheduler test,
// causing it to exceed the performance threshold. Fixed in LLVM 21+.
if (Internal::get_llvm_version() < 210 &&
get_jit_target_from_environment().has_feature(Target::SVE2)) {
printf("[SKIP] LLVM %d generates suboptimal SVE2 code for this test.\n",
Internal::get_llvm_version());
return 0;
}

if (argc != 2) {
fprintf(stderr, "Usage: %s <autoscheduler-lib>\n", argv[0]);
return 1;
Expand Down
3 changes: 1 addition & 2 deletions test/autoschedulers/mullapudi2016/max_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ int main(int argc, char **argv) {
// LLVM 21 calls getFixedValue() on scalable TypeSize objects in the
// AArch64 backend, triggering an assertion. Fixed in LLVM 22 by:
// https://github.com/llvm/llvm-project/commit/d1500d12be60 (PR #169764)
if (Internal::get_llvm_version() >= 210 &&
Internal::get_llvm_version() < 220 &&
if (Internal::get_llvm_version() < 220 &&
get_jit_target_from_environment().has_feature(Target::SVE2)) {
printf("[SKIP] LLVM 21 has known getFixedValue() assertion failures on SVE scalable types.\n");
return 0;
Expand Down
3 changes: 1 addition & 2 deletions test/correctness/align_bounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ int main(int argc, char **argv) {
// LLVM 21 calls getFixedValue() on scalable TypeSize objects in the
// AArch64 backend, triggering an assertion. Fixed in LLVM 22 by:
// https://github.com/llvm/llvm-project/commit/d1500d12be60 (PR #169764)
if (Internal::get_llvm_version() >= 210 &&
Internal::get_llvm_version() < 220 &&
if (Internal::get_llvm_version() < 220 &&
get_jit_target_from_environment().has_feature(Target::SVE2)) {
printf("[SKIP] LLVM 21 has known getFixedValue() assertion failures on SVE scalable types.\n");
return 0;
Expand Down
3 changes: 1 addition & 2 deletions test/correctness/bound_small_allocations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ int main(int argc, char **argv) {
// LLVM 21 calls getFixedValue() on scalable TypeSize objects in the
// AArch64 backend, triggering an assertion. Fixed in LLVM 22 by:
// https://github.com/llvm/llvm-project/commit/d1500d12be60 (PR #169764)
if (Internal::get_llvm_version() >= 210 &&
Internal::get_llvm_version() < 220 &&
if (Internal::get_llvm_version() < 220 &&
get_jit_target_from_environment().has_feature(Target::SVE2)) {
printf("[SKIP] LLVM 21 has known getFixedValue() assertion failures on SVE scalable types.\n");
return 0;
Expand Down
3 changes: 1 addition & 2 deletions test/correctness/fit_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ int main(int argc, char **argv) {
// LLVM 21 calls getFixedValue() on scalable TypeSize objects in the
// AArch64 backend, triggering an assertion. Fixed in LLVM 22 by:
// https://github.com/llvm/llvm-project/commit/d1500d12be60 (PR #169764)
if (Internal::get_llvm_version() >= 210 &&
Internal::get_llvm_version() < 220 &&
if (Internal::get_llvm_version() < 220 &&
get_jit_target_from_environment().has_feature(Target::SVE2)) {
printf("[SKIP] LLVM 21 has known getFixedValue() assertion failures on SVE scalable types.\n");
return 0;
Expand Down
3 changes: 1 addition & 2 deletions test/correctness/logical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ int main(int argc, char **argv) {
// LLVM 21 calls getFixedValue() on scalable TypeSize objects in the
// AArch64 backend, triggering an assertion. Fixed in LLVM 22 by:
// https://github.com/llvm/llvm-project/commit/d1500d12be60 (PR #169764)
if (Internal::get_llvm_version() >= 210 &&
Internal::get_llvm_version() < 220 &&
if (Internal::get_llvm_version() < 220 &&
get_jit_target_from_environment().has_feature(Target::SVE2)) {
printf("[SKIP] LLVM 21 has known getFixedValue() assertion failures on SVE scalable types.\n");
return 0;
Expand Down
3 changes: 1 addition & 2 deletions test/correctness/predicated_store_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,7 @@ int main(int argc, char **argv) {
// LLVM 21 calls getFixedValue() on scalable TypeSize objects in the
// AArch64 backend, triggering an assertion. Fixed in LLVM 22 by:
// https://github.com/llvm/llvm-project/commit/d1500d12be60 (PR #169764)
if (Internal::get_llvm_version() >= 210 &&
Internal::get_llvm_version() < 220 &&
if (Internal::get_llvm_version() < 220 &&
t.has_feature(Target::SVE2)) {
printf("[SKIP] LLVM 21 has known getFixedValue() assertion failures on SVE scalable types.\n");
return 0;
Expand Down
3 changes: 1 addition & 2 deletions test/correctness/truncated_pyramid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ int main(int argc, char **argv) {
// LLVM 21 calls getFixedValue() on scalable TypeSize objects in the
// AArch64 backend, triggering an assertion. Fixed in LLVM 22 by:
// https://github.com/llvm/llvm-project/commit/d1500d12be60 (PR #169764)
if (Internal::get_llvm_version() >= 210 &&
Internal::get_llvm_version() < 220 &&
if (Internal::get_llvm_version() < 220 &&
get_jit_target_from_environment().has_feature(Target::SVE2)) {
printf("[SKIP] LLVM 21 has known getFixedValue() assertion failures on SVE scalable types.\n");
return 0;
Expand Down
3 changes: 1 addition & 2 deletions test/correctness/vectorize_nested.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@ int main(int argc, char **argv) {
// LLVM 21 calls getFixedValue() on scalable TypeSize objects in the
// AArch64 backend, triggering an assertion. Fixed in LLVM 22 by:
// https://github.com/llvm/llvm-project/commit/d1500d12be60 (PR #169764)
if (Internal::get_llvm_version() >= 210 &&
Internal::get_llvm_version() < 220 &&
if (Internal::get_llvm_version() < 220 &&
get_jit_target_from_environment().has_feature(Target::SVE2)) {
printf("[SKIP] LLVM 21 has known getFixedValue() assertion failures on SVE scalable types.\n");
return 0;
Expand Down
8 changes: 0 additions & 8 deletions test/performance/block_transpose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,6 @@ int main(int argc, char **argv) {
return 0;
}

// LLVM 20 is missing llvm.vector.interleave4/deinterleave4 for SVE.
if (Internal::get_llvm_version() < 210 &&
target.has_feature(Target::SVE2)) {
printf("[SKIP] LLVM %d is missing SVE vector interleave/deinterleave intrinsics.\n",
Internal::get_llvm_version());
return 0;
}

test_transpose(scalar_trans);
test_transpose_wrap(scalar_trans);
test_transpose(vec_y_trans);
Expand Down
3 changes: 1 addition & 2 deletions test/performance/const_division.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ int main(int argc, char **argv) {
// LLVM 21 calls getFixedValue() on scalable TypeSize objects in the
// AArch64 backend, triggering an assertion. Fixed in LLVM 22 by:
// https://github.com/llvm/llvm-project/commit/d1500d12be60 (PR #169764)
if (Internal::get_llvm_version() >= 210 &&
Internal::get_llvm_version() < 220 &&
if (Internal::get_llvm_version() < 220 &&
target.has_feature(Target::SVE2)) {
printf("[SKIP] LLVM 21 has known getFixedValue() assertion failures on SVE scalable types.\n");
return 0;
Expand Down
8 changes: 0 additions & 8 deletions test/performance/nested_vectorization_gemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ int main(int argc, char **argv) {
return 0;
}

// LLVM 20 is missing llvm.vector.interleave4/deinterleave4 for SVE.
if (Internal::get_llvm_version() < 210 &&
target.has_feature(Target::SVE2)) {
printf("[SKIP] LLVM %d is missing SVE vector interleave/deinterleave intrinsics.\n",
Internal::get_llvm_version());
return 0;
}

// 8-bit mat-mul into 32-bit accumulator
{

Expand Down
Loading
Loading