halide / Halide

a language for fast, portable data-parallel computation
https://halide-lang.org
Other
5.77k stars 1.07k forks source link

Build Failure on Ubuntu 20.04 with LLVM 18.0.0 and Halide Main Branch:: Data Layout Mismatch Errors #8251

Open LiQi19970428 opened 1 month ago

LiQi19970428 commented 1 month ago

Hello Halide Community,

I am encountering a build failure while trying to compile the latest main branch of Halide on WSL2 running Ubuntu 20.04. My setup includes LLVM 18.0.0 and I use CMake and Ninja for the build process.

System and Environment:

OS: WSL2, Ubuntu 20.04 Halide Version: Latest main branch LLVM Version: 18.0.0 Build System: CMake, Ninja Compiler: GCC 9.4.0 Build Commands Used:

cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_DIR=$LLVM_ROOT/lib/cmake/llvm -S . -B build cmake --build build Error Encountered: While building, I encounter the following error across multiple targets:

[1962/3954] Generating adams2019_cost_model.h, adams2019_cost_model.o FAILED: src/autoschedulers/adams2019/adams2019_cost_model.h src/autoschedulers/adams2019/adams2019_cost_model.o cd /Halide/build/src/autoschedulers/adams2019 && /Halide/build/src/autoschedulers/adams2019/adams2019_cost_model.generator -n adams2019_cost_model -d 0 -g cost_model -f cost_model -e c_header,object -o . target=x86-64-linux-no_runtime Unhandled exception: Internal Error at /Halide/src/LLVM_Output.cpp:363 triggered by user code at : Warning: module's data layout does not match target machine's e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128

Halide and LLVM configurations were successful, and the system checks passed. The configurations indicated support for various backends and the system found all required dependencies.

Could anyone please help me understand why this mismatch is happening and how to fix it? Any suggestions or guidance on how to resolve these errors would be greatly appreciated.

Thank you!

abadams commented 1 month ago

I believe this warning was temporary during the development of llvm 18, and it doesn't repro for me with the llvm 18 release (which is llvm 18.1, because they moved to 1-based indexing for minor versions for releases).

I believe it's benign, so you can either ignore it, or update llvm to the latest release.

LiQi19970428 commented 1 month ago

I believe this warning was temporary during the development of llvm 18, and it doesn't repro for me with the llvm 18 release (which is llvm 18.1, because they moved to 1-based indexing for minor versions for releases).

I believe it's benign, so you can either ignore it, or update llvm to the latest release.

First, I want to extend my thanks to you for the advice on using LLVM 18.1; I've successfully built it. However, I'm encountering an issue when testing the auto-scheduling tool with the Lesson 21 example from the Halide tutorials.

I followed the instructions for Lesson 21 and used the following commands to compile and run the generators: g++ lesson_21_auto_scheduler_generate.cpp ../tools/GenGen.cpp -g -std=c++17 -fno-rtti -I ../build/include -L ../build/src -lHalide -lpthread -ldl -o lesson_21_generate

./lesson_21_generate -o . -g auto_schedule_gen -f auto_schedule_false -e static_library,h,schedule,html target=host

./lesson_21_generate -o . -g auto_schedule_gen -f auto_schedule_true -e static_library,h,schedule,html -p ../build/src/autoschedulers/mullapudi2016/libautoschedule_mullapudi2016.so target=host autoscheduler.name=Mullapudi2016 autoscheduler.parallelism=32 autoscheduler.last_level_cache_size=16777216 autoscheduler.balance=40

g++ lesson_21_auto_scheduler_run.cpp -std=c++17 -I ../build/include -I ../tools auto_schedule_false.a auto_schedule_true.a -ldl -lpthread -o lesson_21_run When executing, I encounter the message: "No autoscheduler has been run for this Generator." from the schedule.h file. I'm unsure which part of the command might be incorrect or if there's an issue with how the autoschedulers are being invoked. What's wrong with it?

abadams commented 1 month ago

Replace the string "autoscheduler.name" with "autoscheduler"