-
Notifications
You must be signed in to change notification settings - Fork 277
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
[CMake] Implement add_circt_tool() #5821
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good step forward. Unfortunately I don't think MLIR does this the way we want (their targets for tools aren't exported under MLIR, they get added as LLVM exports, see https://llvm.org/PR52334, tools need you to manually set LLVM_BUILD_TOOLS
to be included/installed by default, vs other projects having their own PROJECT_BUILD_TOOLS
); maybe related mlir-tblgen
doesn't work when building downstream project against standalone-built MLIR, but there's other differences there)-- we should probably have our own implementation of llvm_add_tool
that does the right thing for our project (which is what lld/clang/flang/bolt do).
Look at CIRCTTargets.cmake
to see what I mean-- no executables .
Anyway, this is to enable building CIRCT as part of a unified build and directing its tools into a different directory than the others (LLVM bits), is that right?
Yes, but also for packaging hygiene. Even with a standalone build it's bizarre and unintuitive to pass
Eh, quick look at lld suggests this should be quick. Will try this approach |
That's super weird! This is needed for a standalone build?? That's no good, absolutely. Thanks for your interest and working on improving this! I wonder why you're seeing that, I've been packaging CIRCT (standalone) for some time now and never had to specify this. If you'd like to investigate/work on some of the other bits that'd be swell, but absolutely that's not a blocker here 👍. |
This is inherent to how Hilariously, LLD and friends screw this up. They set a MLIR doesn't screw this up because they don't roll their own |
442eeeb
to
f5dfdb5
Compare
f5dfdb5
to
f7916b8
Compare
@dtzSiFive I believe this does what we want now. It generates export targets for the CIRCT tools under CIRCTTargets.cmake, it uses the The second commit is cleanliness. We don't use these variables (except something to do with PyCDE?) and they're the last references to LLVM vars in the top level CML. I'll drop it if desired. |
Test are failing because But I don't actually know how CIRCT was getting cmake to relocate the binaries in the first place so I need to investigate. I'll say now the way that LLVM projects operate out of build trees is very alien to me. |
f7916b8
to
d6bdc7d
Compare
This passes
Don't see a lot of value in writing our own |
FYI: I'm about to remove esi-tester. If this PR gets merged promptly, I can wait. |
When PyCDE is enabled. I spent a lot of time a few months ago figuring out the cmake stuff for PyCDE install, so please don't break it. |
I didn't test the unified build 😔 Ok, more investigation to get this right. Crash coursing in the LLVM build environment right now, apologies for the false assurances this was ready Don't delay anything on my account, rebasing this is easy |
d6bdc7d
to
f344c88
Compare
- Adds/renames the associated CMake variables: * CIRCT_BUILD_TOOLS * CIRCT_INCLUDE_TOOLS * CIRCT_TOOLS_INSTALL_DIR - Actually uses the CIRCT_INCLUDE_TOOLS variable now
f344c88
to
29f5699
Compare
Stupid bug, Fixed, unified builds work now. PyCDE builds clean. So uh, run it again 🤞 |
Yep. It also installs properly. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didn't break me and my policy when it comes to cmake changes is if it seems reasonable and doesn't break ppl it's ok since I don't know much about cmake. @dtzSiFive? it seems we collided.
I have the same policy as John :) If this makes sense to Will, it makes sense to me. |
Just pointed my nix packaging of CIRCT at this and works great for me! (as expected, but just went to confirm) |
@nickelpro, would you like to land this (become a contributor), or have one of us do it for you? Or we can merge this for you. Thank you for your contribution! |
Shot Chris an email, but no reason to hold this up. Anyone can feel free to merge. Might as well take this chance for brief introduction: My name's Vito, I run the NYU ProcDesign team. I personally mostly focus on packaging, toolchain, and frontends. Very new to MIRL and all involved. Going to be working with CIRCT for most of this year. Thanks for fast feedback/approval 🎉 |
Right now we use
add_llvm_tool()
to add tools, which is equivalent tollvm_add_tool(LLVM ${ARGV})
. This puts packagers of CIRCT in the somewhat awkward situation of needing to useLLVM_TOOLS_INSTALL_DIR
to specify where CIRCT tools should be placed in the install tree.CIRCT is not LLVM.
This patch adds a specialization of
llvm_add_tool()
. This is the same approach used by MLIR and LLVM itself.