-
Notifications
You must be signed in to change notification settings - Fork 88
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
Various improvements to the compilation process #621
Conversation
Fix compilation for clspv-reflection when doing a shared-library build. - Add clspv_passes to the public list of dependencies of clspv_core so that clspv-opt, clspv-reflection and any other target depending on clspv_core don't have to link against the dependencies of clspv_passes. - Remove unnecessary dependencies of clspv-opt now that they are transitively added thanks to the previous point. - Move clangCodeGen dependency to clspv_core because it isn't used by clsvp_passes. - Because SPIRV-Tools-shared has hidden symbol visibility, some symbols are undefined when linking against SPIRV-Tools (which is an alias for SPIRV-Tools-shared or SPIRV-Tools-static based on build options). This is worked around by always linking against SPIRV-Tools-static, regardless of the build options. - Don't explicitly list LLVM components as dependencies as this is resolved automatically by CMake. Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Use OBJECT library for clspv_passes to ensure all the symbols for global static variables are present in clspv-opt, ensuring passes using a static RegisterPass<> object are registered. This is effectively equivalent to using the linker option --whole-archive for static build, but in a more portable way as not all toolchains support this option. Previously, the output of `clspv-opt --help-hidden` and `clspv --help-hidden` would differ from a shared library build to a static library build. There are still some differences but they seem to be unrelated to clspv passes but rather related to LLVM passes. The MultiVersionUBOFunctionsPass pass is using such a global static object. Update existing test to cover this pass. Bump required CMake version. Chose 3.13.4 as it is required by the latest LLVM and it supports linking against OBJECT libraries. Add a missing dependency of clspv_passes that was identified by using OBJECT library when using a shared build. Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Should this be considered a bug in the list of visible items in the SPIRV-Tools-shared library? |
I see these undefined references:
These symbols are present in both Yet, these are declared in |
Thanks for merging. Re. visibility of symbols: after digging into SPIR-V Tools issues, I've found this comment which seems relevant (i.e. confirming the symbols are expected to be visible):
|
Yes, they should be exported. Thanks for finding this! |
I've noticed some issues with the build process. Namely, the available options were not the same for a static build than for a shared build. For example, the
--MultiVersionUBOFunctions
option ofclspv-opt
wasn't available in a static build. I had exactly the same issue for the pass I want to introduce for #613 so here is a general fix.I also had to fix compilation for shared build. I tested this using
cmake --target check-spirv
with the four {Debug,Release} x {shared,static} configurations on Linux.Below are the commit messages for the two commits in this PR.
Fix compilation for clspv-reflection when doing a shared-library build.
that clspv-opt, clspv-reflection and any other target depending on
clspv_core don't have to link against the dependencies of
clspv_passes.
transitively added thanks to the previous point.
clsvp_passes.
are undefined when linking against SPIRV-Tools (which is an alias for
SPIRV-Tools-shared or SPIRV-Tools-static based on build options).
This is worked around by always linking against SPIRV-Tools-static,
regardless of the build options.
resolved automatically by CMake.
Use OBJECT library for clspv_passes to ensure all the symbols for global
static variables are present in clspv-opt, ensuring passes using a
static RegisterPass<> object are registered. This is effectively
equivalent to using the linker option --whole-archive for static build,
but in a more portable way as not all toolchains support this option.
Previously, the output of
clspv-opt --help-hidden
andclspv --help-hidden
would differ from a shared library build to a static
library build. There are still some differences but they seem to be
unrelated to clspv passes but rather related to LLVM passes.
The MultiVersionUBOFunctionsPass pass is using such a global static
object. Update existing test to cover this pass.
Bump required CMake version. Chose 3.13.4 as it is required by the
latest LLVM and it supports linking against OBJECT libraries.
Add a missing dependency of clspv_passes that was identified by using
OBJECT library when using a shared build.