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

Add CMake build rules for (some) of the generator jit tests #7693

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

steven-johnson
Copy link
Contributor

Amazingly, these have been TODO for ~ever. This adds two of them; registration_test and rungen_test will be added subsequently (assuming this PR works).

Amazingly, these have been TODO for ~ever. This adds two of them; registration_test and rungen_test will be added subsequently (assuming this PR works).
@steven-johnson
Copy link
Contributor Author

Monday morning review ping

@steven-johnson
Copy link
Contributor Author

Monday morning review ping, again

@steven-johnson
Copy link
Contributor Author

Pingity ping ping ping

@steven-johnson
Copy link
Contributor Author

♫ Old McDonald had a ping
Pingity pingity ping ♫

@steven-johnson steven-johnson requested review from vksnk and removed request for alexreinking August 28, 2023 18:17
@steven-johnson
Copy link
Contributor Author

Re-adding @alexreinking -- the reason that apps/hannk is now failing is because of the insertion of the generator "library" for cpp_stub usage... previously, adding a dep to a Generator could be done by just doing target_link_libraries(foo.generator ... ); now, that doesn't actually help, because you would need to do target_link_libraries(foo.generator_lib ... ) for it to actually work.

Ugly options:

  • Add a DEPS argument to the add_halide_generator() rule. Would work, but would break existing code. (And maybe be a weird thing for CMake users? Dunno, it's all still weird to me.)
  • Build the library for cpp-stub usage separately from the generator exe (ie, redundantly). This would maintain existing usage, but means that the hidden _lib target would need explicit attention from users that need to add deps to it.
  • Something else? For good or ill, we can't do the JIT tests without the cpp-stub stuff (even though cpp-stub stuff is gross and awful, but we can't delete it just yet).

@steven-johnson
Copy link
Contributor Author

Post-vacation ping to @alexreinking

@steven-johnson
Copy link
Contributor Author

Bride of Return of Ping to @alexreinking

cmake/HalideGeneratorHelpers.cmake Outdated Show resolved Hide resolved
test/generator/CMakeLists.txt Outdated Show resolved Hide resolved
@alexreinking
Copy link
Member

There's a nice...ish... way to do this in CMake 3.27 (latest) that I outlined in the review suggestions. You create an interface library that propagates the links / includes and object files (filtering out GenGen.cpp.o is 3.27+).

For now, I'd prefer to preserve existing usage since an eventual upgrade to CMake will allow us to do that anyway. Maybe only build redundantly if the cpp stubs are requested via the argument?

@alexreinking
Copy link
Member

  • Add a DEPS argument to the add_halide_generator() rule. Would work, but would break existing code. (And maybe be a weird thing for CMake users? Dunno, it's all still weird to me.)

This already exists as LINK_LIBRARIES doesn't it?

  • Build the library for cpp-stub usage separately from the generator exe (ie, redundantly). This would maintain existing usage, but means that the hidden _lib target would need explicit attention from users that need to add deps to it.

I think this is the way to go given our current CMake version.

steven-johnson and others added 3 commits September 18, 2023 15:39
Co-authored-by: Alex Reinking <alex.reinking@gmail.com>
Co-authored-by: Alex Reinking <alex.reinking@gmail.com>
@steven-johnson
Copy link
Contributor Author

Wow, I had forgotten about this PR. Will your upcoming CMake upgrade make any of this easier? (or at least less-bad)

@steven-johnson
Copy link
Contributor Author

We should really clean this up and land it (otherwise we aren't getting all of our tests built + tested under CMake); what are the sticking points?

@alexreinking
Copy link
Member

I think I'm happy with this after removing the FILTER.

Co-authored-by: Alex Reinking <areinking@adobe.com>
@@ -93,8 +93,15 @@ function(add_halide_generator TARGET)
# TODO: what do we need to do for PACKAGE_NAME PACKAGE_NAMESPACE EXPORT_FILE in this case?
else ()
add_executable(${TARGET} ${ARG_SOURCES})
target_link_libraries("${TARGET}" PRIVATE Halide::Generator ${ARG_LINK_LIBRARIES})
target_include_directories("${TARGET}" PRIVATE "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
Copy link
Member

Choose a reason for hiding this comment

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

QQ: why is this needed? Which files do they access?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At this point, I don't remember. I'll remove it and see what breaks :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The target_include_directories is apparently unnecessary, removing

@steven-johnson
Copy link
Contributor Author

@alexreinking I'm not sure how to resolve the conflicts here to land this, can you take a quick look?

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.

3 participants