Skip to content

[libclc] link_bc target should depends on target builtins.link.clc-arch_suffix #132338

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 3 commits into from
Mar 24, 2025

Conversation

wenju-he
Copy link
Contributor

@wenju-he wenju-he commented Mar 21, 2025

Currently link_bc command depends on the bitcode file that is associated with custom target builtins.link.clc-arch_suffix.
On windows we randomly see following error:
Generating builtins.link.clc-${ARCH}--.bc Generating builtins.link.libspirv-${ARCH}.bc error : The requested operation cannot be performed on a file with a user-mapped section open.
I suspect that builtins.link.clc-${ARCH}--.bc file is being generated while it is being used in link_bc.
This PR adds target-level dependency to ensure builtins.link.clc-${ARCH}--.bc is generated first.

@wenju-he
Copy link
Contributor Author

@frasercrmck could you please review? thanks

…ch_suffix

Currently link_bc command depends on the bitcode file that is associated
with custom target builtins.link.clc-arch_suffix.
On windows we randomly see following error:
`
  Generating builtins.link.clc-${ARCH}--.bc
  Generating builtins.link.libspirv-${ARCH}.bc
  error : The requested operation cannot be performed on a file with a user-mapped section open.
`
I suspect that builtins.link.clc-${ARCH}--.bc file is being generated
while it is being used in link_bc.
This PR adds target-level dependency to ensure builtins.link.clc-${ARCH}--.bc
is generated first.
@wenju-he wenju-he force-pushed the libclc-link_bc-depends branch from a423c4d to 6ce54aa Compare March 21, 2025 05:17
@@ -211,8 +211,9 @@ endfunction()
# * ALIASES <string> ...
# List of aliases
# * INTERNAL_LINK_DEPENDENCIES <string> ...
Copy link
Contributor

Choose a reason for hiding this comment

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

If this comment is to be updated it should probably say <target> ...? What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -313,8 +314,8 @@ function(add_libclc_builtin_set)
INTERNALIZE
TARGET ${builtins_link_lib_tgt}
INPUTS $<TARGET_PROPERTY:${builtins_link_lib_tmp_tgt},TARGET_FILE>
${ARG_INTERNAL_LINK_DEPENDENCIES}
DEPENDENCIES ${builtins_link_lib_tmp_tgt}
$<TARGET_PROPERTY:${ARG_INTERNAL_LINK_DEPENDENCIES},TARGET_FILE>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this will work correctly if ARG_INTERNAL_LINK_DEPENDENCIES is a list. You won't be able to find a property on foo-target;bar-target, for example. It might silently do the wrong thing, or it might error, I'm not sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, changed to reading TARGE_FILE from each target

@wenju-he
Copy link
Contributor Author

I've tested on Windows for half a day, it seems this PR can fix the issue.

@wenju-he wenju-he requested a review from frasercrmck March 21, 2025 10:18
Copy link
Contributor

@frasercrmck frasercrmck left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@frasercrmck frasercrmck merged commit 735d7c1 into llvm:main Mar 24, 2025
11 checks passed
@wenju-he wenju-he deleted the libclc-link_bc-depends branch March 24, 2025 21:12
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.

2 participants