Skip to content

CMake: catch some recurring problems with LLVM configuration. - #21174

Merged
bjacob merged 2 commits into
iree-org:mainfrom
bjacob:cmake-catch-problems
Jun 24, 2025
Merged

bjacob merged 2 commits into
iree-org:mainfrom
bjacob:cmake-catch-problems

Conversation

@bjacob

@bjacob bjacob commented Jun 24, 2025

Copy link
Copy Markdown
Collaborator

This discord thread is only the latest iteration of a recurring hard-to-diagnose bug that occurs when LLVM is improperly configured. The CMake changes here help diagnose that early. This PR also fixes an instance of that incorrect usage in our own JSON configuration file (thanks Scott for finding it).

Signed-off-by: Benoit Jacob <[email protected]>
@bjacob
bjacob marked this pull request as ready for review June 24, 2025 15:16
@bjacob
bjacob requested a review from ScottTodd as a code owner June 24, 2025 15:16

@benvanik benvanik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty targets to build is not an error and should only be a warning - if building for SPIR-V, Metal, WebGPU, etc trimming the targets to build is a great way to shrink the compiler when you're never emitting native code.

@bjacob

bjacob commented Jun 24, 2025

Copy link
Copy Markdown
Collaborator Author

empty targets to build is not an error and should only be a warning - if building for SPIR-V, Metal, WebGPU, etc trimming the targets to build is a great way to shrink the compiler when you're never emitting native code.

Good point! How about this now? Moved inside the if(IREE_TARGET_BACKEND_LLVM_CPU).

@bjacob
bjacob requested a review from benvanik June 24, 2025 15:27
Signed-off-by: Benoit Jacob <[email protected]>
@benvanik

Copy link
Copy Markdown
Collaborator

if that's where the error mostly hits then SGTM - I think otherwise it'd be a thing we'd want to shard out to the various plugins (CUDA codegen target should check that a CUDA target is enabled, ROCM that a ROCM, and then CPU like what you have here).

@bjacob

bjacob commented Jun 24, 2025 •

Copy link
Copy Markdown
Collaborator Author

Yeah I thought about other backends for a split second, but it was more complex, and this issue has bitten us at least 3 times already, each time on llvm-cpu.

Also note that other backends like ROCm unconditionally populate the LLVM targets with what they need. LLVM-CPU is an outlier in how it relies on LLVM targets being well populated.

@bjacob
bjacob merged commit a2004fc into iree-org:main Jun 24, 2025
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
This [discord
thread](https://discord.com/channels/689900678990135345/1385756730796933360)
is only the latest iteration of a recurring hard-to-diagnose bug that
occurs when LLVM is improperly configured. The CMake changes here help
diagnose that early. This PR also fixes an instance of that incorrect
usage in our own JSON configuration file (thanks Scott for finding it).

---------

Signed-off-by: Benoit Jacob <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants