Skip to content
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

Update cpu features #631

Merged
merged 4 commits into from
Sep 27, 2023
Merged

Update cpu features #631

merged 4 commits into from
Sep 27, 2023

Conversation

ashley-b
Copy link
Contributor

  • Update cpu_features to v0.9.0
  • Added BUILD_EXECUTABLE for cpu_features to build list_cpu_features for
    github workflow tests
  • Added ENABLE_INSTALL to install cpu_feature for old behaviour
  • Renamed CpuFeature -> CpuFeatures to match new name
  • Removed duplicated cmake logic

- Update cpu_features to v0.9.0
- Added BUILD_EXECUTABLE for cpu_features to build list_cpu_features for
  github workflow tests
- Added ENABLE_INSTALL to install cpu_feature for old behaviour
- Renamed CpuFeature -> CpuFeatures to match new name

Signed-off-by: Ashley Brighthope <[email protected]>
The else path can not be reached since the root CMake file aborts
if CpuFeatures_FOUND if false

Signed-off-by: Ashley Brighthope <[email protected]>
@ashley-b
Copy link
Contributor Author

Related issue #629

Copy link
Contributor

@jdemel jdemel left a comment

Choose a reason for hiding this comment

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

One tiny change. But besides this looks good. Thanks for the PR!

CMakeLists.txt Outdated
@@ -144,6 +144,7 @@ if (VOLK_CPU_FEATURES)
FORCE)
set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")
set(BUILD_SHARED_LIBS OFF)
set(ENABLE_INSTALL ON)
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to go for set(ENABLE_INSTALL OFF) because cpu_features should never be installed with VOLK. This causes issue #607 . Since we don't need the cpu_features library and don't expose any of its APIs, the NO install solution would be preferred.

Copy link
Contributor Author

@ashley-b ashley-b Sep 20, 2023

Choose a reason for hiding this comment

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

I did try leaving this off before I submit this PR, but it break's the static CI build. This make's sense since the finial stage link needs the cpu_feature library.

One solution to this would be to ENABLE_INSTALL for cpu_features if ENABLE_STATIC_LIBS is set

Copy link
Contributor

Choose a reason for hiding this comment

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

I try to add a bit more context here. I suppose package maintainers, e.g. for Debian, explicitly add patches to make sure cpu_features is not installed together with with VOLK.
Furthermore, VOLK should not slip into a maintainer role for a dependency. Even if this implies to update the submodule pointer every once in a while.
As a consequence, we should try to:

  1. hide all dependencies as private and not expose them in our API (if possible)
  2. not install anything that is not directly VOLK.

Having written all of this, what would be a reasonable approach here?
It's "good news" that only the static build breaks. Right now, I see that the static test fails because one of the tests fails. I suggest to set ENABLE_INSTALL OFF and then we would be able to discuss the situation in more detail.
I would really prefer to not install anything related to cpu_features.

Copy link
Contributor Author

@ashley-b ashley-b Sep 20, 2023

Choose a reason for hiding this comment

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

All good, I've added the change.

As a follow up
It does the right thing when cpu_features is installed as a system package on Fedora distro., the volk shared library dynamical links to the the system cpu_features and it does not build the submodule version

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

If I read this discussion correctly, this line:

target_link_libraries(volk_static PRIVATE CpuFeatures::cpu_features)

though, I haven't had the time to fully understand it yet.

@ashley-b ashley-b force-pushed the fix/cpu_features_update branch from ea3a5fd to 49c1581 Compare September 20, 2023 10:05
@ashley-b ashley-b requested a review from jdemel September 20, 2023 10:06
This avoids issues in the static build since otherwise cmake will add cpu_features to the export set.

Signed-off-by: Andrej Rode <[email protected]>
@noc0lour noc0lour force-pushed the fix/cpu_features_update branch from 7fb4bf4 to 4925681 Compare September 23, 2023 12:16
@noc0lour
Copy link
Member

I hope you don't mind me adding another commit fixing the issues with the build. Though it would be useful to add a test building an "external" binary linking to the dynamic & static builds to see that everything works correctly with this linking. Maybe something for the issue tracker.

Copy link
Contributor

@jdemel jdemel left a comment

Choose a reason for hiding this comment

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

All tests pass. LGTM. Fixes important things. Thank you all!

@jdemel
Copy link
Contributor

jdemel commented Sep 25, 2023

@ashley-b if you're OK with the state of this PR including @noc0lour 's change, I'd merge it.

@jdemel jdemel mentioned this pull request Sep 25, 2023
@ashley-b
Copy link
Contributor Author

@jdemel Sorry for the delay, Im happy with the PR.
Not sure about @noc0lour commit. I could not see any changes in the github Actions build/tests or local builds on my system.

Am not a CMake expert, but I not sure BUILD_INTERFACE has any effect in target_link_libraries.

@jdemel jdemel merged commit 74b6c6a into gnuradio:main Sep 27, 2023
32 checks passed
Alesha72003 pushed a commit to Alesha72003/volk that referenced this pull request May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants