This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Add an end-to-end test for scalable vectorisation
ClosedPublic

Authored by awarzynski on Jul 20 2023, 6:53 AM.

Details

Summary

This patch adds our first integration test for scalable vectorisation in
Linalg. It simply runs linalg.fill to fill a scalable vector with a
pre-defined f32 value. The result is printed to stdout.

Note that with scalable architectures, the vector size is not know at
compile time, but it is known at runtime. For this reason, the length of
the output generated by the new test depends on the hardware implementation. For
Arm's SVE we do know that there will be at least 4 f32 elements in every
scalable vector register. CHECK lines were designed accordingly.

In order to see what happens for different implementations of SVE, you
can use the following QEMU settings:

  • qemu-aarch64 -cpu max,sve128=on
  • qemu-aarch64 -cpu max,sve512=on

ATM, this test is only enabled when MLIR_RUN_ARM_SVE_TESTS is set.

Diff Detail

Event Timeline

awarzynski created this revision.Jul 20 2023, 6:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2023, 6:53 AM
awarzynski requested review of this revision.Jul 20 2023, 6:53 AM
Matt added a subscriber: Matt.Jul 20 2023, 10:12 AM
Matt added inline comments.Jul 20 2023, 10:15 AM
mlir/test/Integration/Dialect/Linalg/CPU/Scalable/fill-1d.mlir
35

Nit: s/for/four/

(Perhaps f32 would be a bit clearer than FP, too?)

dcaballe accepted this revision.Jul 20 2023, 10:39 AM

Thanks!

This revision is now accepted and ready to land.Jul 20 2023, 10:39 AM
c-rhodes accepted this revision.Jul 22 2023, 4:02 AM

Thanks Andrzej, I've left a few suggestions that could simplify this a little but overall LGTM. I did try to run it locally but it fails for me when running under Lit (exit code 74), runs fine when I manually run it using command from lit -a. Initially I thought it was because I didn't have D155920 but I rebased and still doesn't work, also tried fresh build, flags I'm using relating to this are -DMLIR_INCLUDE_INTEGRATION_TESTS=ON -DARM_EMULATOR_EXECUTABLE="$HOME/qemu-7.1.0/build/qemu-aarch64" -DMLIR_RUN_ARM_SVE_TESTS=ON FWIW. Suspect my build isn't configured correctly?

mlir/test/Integration/Dialect/Linalg/CPU/Scalable/fill-1d.mlir
2

there's nothing in the ArmSVE dialect used here?

2

there's no affine ops?

2–4

nit: with unused printMemrefF32 removed I get the same IR with these flags

59–60

unused

Incorporate suggestions from Matt and Cullen - thanks!

@c-rhodes, no luck reproducing your failure :( Could you try again?

Incorporate suggestions from Matt and Cullen - thanks!

@c-rhodes, no luck reproducing your failure :( Could you try again?

Just tried it again and it works for me, not sure what changed, apologies for confusion. This LGTM cheers.