-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir][ArmSME][nfc] Add custom CMake targets to group tests #78448
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Where are these targets defined?
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.
they're auto-generated
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.
(You get them from using
add_mlir_conversion_library()
etc in CMake, I think the actualcheck-
targets are added deep in the CMake, maybe inllvm_add_library()
)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.
How can I find them? I assume that I can query that with e.g.
ninja
? It would be good to document that - otherwise this feels like adding some random targets.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.
ninja -t targets
I think they're pretty self-documenting to be honest, they follow the directory structure, i.e.:
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.
Is there a link about how are these generated? I don't remember seeing this before and I can't find it in the code right now.
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.
I think they're generated by
add_lit_testsuites
CMake function in LLVM:llvm-project/llvm/cmake/modules/AddLLVM.cmake
Lines 2036 to 2074 in ccf1e32
which is used in MLIR test configuration:
llvm-project/mlir/test/CMakeLists.txt
Lines 212 to 220 in ccf1e32
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.
Thanks!
For this patch I'm mostly unsure about the maintainability and scalability of the approach. ARM-SME is just the first one, so how are we gonna do the same thing for all of the other components in MLIR? What would this look like here?
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.
Understand your concern, seeing no other examples of this in the codebase did make me question it. The problem I'm trying to solve is having a fast and convenient way to run all the tests related to the ArmSME dialect, particularly when working on large features (such as #78975) with various dialect / conversion / integration tests.
ninja check-mlir
is very slow, takes ~6.5 minutes on my c7g.8xlarge dev machine (Graviton3, Neoverse V1, 32 cores). That's with:MLIR_INCLUDE_INTEGRATION_TESTS
MLIR_INCLUDE_TESTS
MLIR_RUN_ARM_SVE_TESTS
MLIR_RUN_ARM_SME_TESTS
enabled and emulation (
ARM_EMULATOR_EXECUTABLE=qemu-aarch64
). I've not properly benchmarked this but I suspect a decent chunk of the time is spent running the SparseTensor integration tests (there's many) with SVE enabled under emulation. This particular machine does actually have SVE support so running SVE tests under emulation isn't necessary, but currently this level of granularity can't be expressed in the configuration, if an emulator is specified the SVE and SME tests will use it. We should probably address that, but these custom targets just seemed like a simple fix for what I want, here's some rough timings:I'm not sure this is particularly useful for all components, I think this approach is more relevant for target-specific dialects without mature hardware support like ArmSME / AMX / RISCV that require emulation for integration tests.
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.
Here's a bash one-liner based on this patch that runs all targets that match the regex
^check-mlir.*armsme
:ninja $(ninja -t targets | grep -e "^check-mlir.*armsme" | sed 's/:.*//')