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

Use add_halide_generator() everywhere in apps/ #6554

Merged
merged 8 commits into from Jan 13, 2022
Merged

Use add_halide_generator() everywhere in apps/ #6554

merged 8 commits into from Jan 13, 2022

Conversation

@steven-johnson
Copy link
Contributor

@steven-johnson steven-johnson commented Jan 12, 2022

Existing CMake code uses add_executable + target_link_libraries to create a Generator, but the somewhat-recently-added add_halide_generator() helper is a cleaner way to do this. Move to using it everywhere in apps/ instead.

(Note that add_halide_generator()) doesn't yet work for in-tree builds, unfortunately.)

Existing CMake code uses add_executable + target_link_libraries to create a Generator, but the somewhat-recently-added add_halide_generator() helper is a cleaner way to do this. Move to using it everywhere in apps/ instead.

(Note that add_halide_generator()) doesn't yet work for in-tree builds, unfortunately.)
apps/bgu/CMakeLists.txt Show resolved Hide resolved
steven-johnson added a commit that referenced this issue Jan 12, 2022
We currently disable deprecation warnings inside Halide. This re-enables them there, and also inside add_halide_generator().

(Note, additive to PR #6554)
apps/camera_pipe/CMakeLists.txt Outdated Show resolved Hide resolved
apps/bilateral_grid/CMakeLists.txt Outdated Show resolved Hide resolved
@@ -13,7 +13,7 @@ find_package(Halide REQUIRED)

# Generator
add_halide_generator(bilateral_grid.generator SOURCES bilateral_grid_generator.cpp)
target_link_libraries(bilateral_grid.generator PRIVATE Halide::Tools)
target_link_libraries(bilateral_grid::halide_generators::bilateral_grid.generator PRIVATE Halide::Tools)
Copy link
Member

@alexreinking alexreinking Jan 12, 2022

Choose a reason for hiding this comment

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

Does this actually work? I thought you couldn't set properties through aliases (and for imported targets, PRIVATE makes no sense)

Copy link
Contributor Author

@steven-johnson steven-johnson Jan 12, 2022

Choose a reason for hiding this comment

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

...I thought that's what you wanted me to do.

I thought the whole point of this was to make it work for crosscompiling. The if TARGET approach won't because there apparently won't be a non-decorated version of the library in that case.

Copy link
Member

@alexreinking alexreinking Jan 12, 2022

Choose a reason for hiding this comment

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

I'm sorry, I must not have explained well. if (TARGET ${unqualified_name}) is the correct way to check if you're in the host-build scenario, which is the one that matters if you're going to set build options on ${unqualified_name}, like which libraries to link to the generator executable.

  • In the host build scenario, these targets exist:
    • ${unqualified_name} is a normal CMake target that will create an executable. It is linked to Halide::Generator by default.
    • ${qualified_name} is an ALIAS target to ${unqualified_name}.
  • In the cross-build scenario, this target exists:
    • ${qualified_name} is an IMPORTED target that points to the executable in the host build.
    • ${unqualified_name} does not exist.

In the cross-build, you are specifically importing the host-built tools. Since they have already been built, it does not make sense to set build properties on them.

apps/hist/CMakeLists.txt Show resolved Hide resolved
apps/harris/CMakeLists.txt Show resolved Hide resolved
apps/interpolate/CMakeLists.txt Show resolved Hide resolved
apps/lens_blur/CMakeLists.txt Show resolved Hide resolved
apps/max_filter/CMakeLists.txt Show resolved Hide resolved
apps/nl_means/CMakeLists.txt Show resolved Hide resolved
apps/stencil_chain/CMakeLists.txt Show resolved Hide resolved
apps/unsharp/CMakeLists.txt Show resolved Hide resolved
@steven-johnson
Copy link
Contributor Author

@steven-johnson steven-johnson commented Jan 12, 2022

I didn't re-add Halide::Tools to anything that didn't require it for compilation. My guess is that we had a lot that were adding it from copy-paste codegen.

@steven-johnson steven-johnson merged commit b9e0e72 into master Jan 13, 2022
14 of 16 checks passed
@steven-johnson steven-johnson deleted the srj/addgen branch Jan 13, 2022
@alexreinking
Copy link
Member

@alexreinking alexreinking commented Jan 13, 2022

Now that this is merged, we should actually try cross-compiling some of these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants