[Mlir-commits] [mlir] [mlir][ArmSME][nfc] Add custom CMake targets to group tests (PR #78448)

Cullen Rhodes llvmlistbot at llvm.org
Wed Jan 24 01:47:23 PST 2024


================
@@ -214,3 +214,26 @@ set_target_properties(check-mlir PROPERTIES FOLDER "Tests")
 add_lit_testsuites(MLIR ${CMAKE_CURRENT_SOURCE_DIR}
   DEPENDS ${MLIR_TEST_DEPENDS}
 )
+
+# Convenience targets to group related tests.
+
+# Run all ArmSME unit tests.
+add_custom_target(check-mlir-unit-armsme DEPENDS
+  check-mlir-dialect-armsme
+  check-mlir-dialect-llvmir
+  check-mlir-conversion-armsmetollvm
+  check-mlir-conversion-armsmetoscf
+  check-mlir-conversion-vectortoarmsme
----------------
c-rhodes wrote:

> 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?

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:

```
time ninja check-mlir-dialect-armsme  7.67s user 1.82s system 370% cpu 2.562 total
time ninja check-mlir-integration-armsme  255.53s user 7.44s system 419% cpu 1:02.75 total
time ninja check-mlir-armsme  282.31s user 15.02s system 425% cpu 1:09.95 total
time ninja check-mlir  9558.85s user 292.57s system 2508% cpu 6:32.73 total
```

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.

https://github.com/llvm/llvm-project/pull/78448


More information about the Mlir-commits mailing list