Skip to content

[libclc] [cmake] Fix per-target *_convert.cl dependencies #127315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2025

Conversation

mgorny
Copy link
Member

@mgorny mgorny commented Feb 15, 2025

Fix add_libclc_builtin_set to add an appropriate dependency to either clspv-generate_convert.cl or generate_convert.cl based on the ARCH argument, rather than to both unconditionally. This fixes build failures due to missing dependencies when clspv* targets are not enabled.

The added check mirrors the one from libclc/CMakeLists.txt.

Fixes: #127378

Fix `add_libclc_builtin_set` to add an appropriate dependency to either
`clspv-generate_convert.cl` or `generate_convert.cl` based on the `ARCH`
argument, rather than to both unconditionally.  This fixes build
failures due to missing dependencies when `clspv*` targets are not
enabled.
Copy link
Member

@thesamesam thesamesam left a comment

Choose a reason for hiding this comment

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

Please note in the commit message that you're using the same check from libclc/CMakeLists.txt. LGTM with that.

@sylvestre
Copy link
Collaborator

I will merge it as it as it fixes #127378 and apt.llvm.org has been broken for a few days because of this

This PR can be improved later.

@sylvestre sylvestre merged commit dbc98cf into llvm:main Feb 16, 2025
9 checks passed
frasercrmck added a commit to frasercrmck/llvm-project that referenced this pull request Feb 17, 2025
In llvm#127378 it was reported that builds without clspv targets enabled
were failing after llvm#124727, as all targets had a dependency on a file
that only clspv targets generated.

A quick fix was merged in llvm#127315 which wasn't correct. It moved the
dependency on those generated files to the spirv targets, instead of
onto the clspv targets. This means a build with spirv targets and
without clspv targets would see the same problems as llvm#127378 reported.

I tried simply removing the requirement to explicitly add dependencies
to the custom command, relying instead on the file-level dependencies.
This didn't seem reliable enough; in some cases on a Makefiles build,
the clang command compiling (e.g.,) convert.cl would begin before the
file was fully written.

Instead, we keep the target-level dependency but automatically infer it
based on the generated file name, to avoid manual book-keeping of
pairs of files and targets.

This commit also fixes what looks like an unintended bug where, when
ENABLE_RUNTIME_SUBNORMAL was enabled, the OpenCL conversions weren't
being compiled.
frasercrmck added a commit that referenced this pull request Feb 17, 2025
In #127378 it was reported that builds without clspv targets enabled
were failing after #124727, as all targets had a dependency on a file
that only clspv targets generated.

A quick fix was merged in #127315 which wasn't correct. It moved the
dependency on those generated files to the spirv targets, instead of
onto the clspv targets. This means a build with spirv targets and
without clspv targets would see the same problems as #127378 reported.

I tried simply removing the requirement to explicitly add dependencies
to the custom command, relying instead on the file-level dependencies.
This didn't seem reliable enough; in some cases on a Makefiles build,
the clang command compiling (e.g.,) convert.cl would begin before the
file was fully written.

Instead, we keep the target-level dependency but automatically infer it
based on the generated file name, to avoid manual book-keeping of pairs
of files and targets.

This commit also fixes what looks like an unintended bug where, when
ENABLE_RUNTIME_SUBNORMAL was enabled, the OpenCL conversions weren't
being compiled.
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Feb 24, 2025
Fix `add_libclc_builtin_set` to add an appropriate dependency to either
`clspv-generate_convert.cl` or `generate_convert.cl` based on the `ARCH`
argument, rather than to both unconditionally. This fixes build failures
due to missing dependencies when `clspv*` targets are not enabled.

The added check mirrors the one from `libclc/CMakeLists.txt`.

Fixes: llvm#127378
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.

libclc: `error: 'clspv-generate_convert.cl', needed by 'obj.libclc.dir/cayman-r600--/convert.cl.bc', missing and no known rule to make it
4 participants