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 15 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).
@@ -64,6 +64,7 @@ function(_add_halide_libraries TARGET)
FEATURES "${args_FEATURES}"
PARAMS "${args_PARAMS}"
PLUGINS "${args_PLUGINS}"
CPP_STUB cpp_stub_out
Copy link
Member

Choose a reason for hiding this comment

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

This is unused but really shouldn't be... which target consumes it? It should be listed in the target_sources of that target.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hrm, ok.

I'm also baffled by the build failures in apps/hannk -- something has somehow tickled the include paths in a way that makes no obvious sense to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is unused but really shouldn't be... which target consumes it? It should be listed in the target_sources of that target.

It's just a header file -- do those need to be in target_sources in CMake?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ping re "It's just a header file -- do those need to be in target_sources in CMake?"

Copy link
Member

Choose a reason for hiding this comment

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

It's just a header file -- do those need to be in target_sources in CMake?

If the header file is generated, then it should be listed in some target, yes. Either:

  1. Directly among the PRIVATE sources of the unique target that consumes it.
  2. As a DEPENDS of a custom target; other targets that use the header should add_dependencies to that target.

@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>
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.

None yet

3 participants