This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Initial MLIR VP intrinsic integration test on host and RVV emulator.
ClosedPublic

Authored by zhanghb97 on Nov 11 2022, 12:46 AM.

Details

Summary

This patch adds the initial VP intrinsic integration test on the host backend and RVV emulator. Please see more detailed discussion on the discourse.

  • Run the test cases on the host by configuring the CMake option: -DMLIR_INCLUDE_INTEGRATION_TESTS=ON
  • Build the RVV environment and run the test cases on RVV QEMU by this doc.

Diff Detail

Event Timeline

zhanghb97 created this revision.Nov 11 2022, 12:46 AM
zhanghb97 requested review of this revision.Nov 11 2022, 12:46 AM

Hey @aartbik, could you please help with the review? I think this should be similar to the integration tests for AMX.

aartbik added inline comments.Nov 15 2022, 8:59 PM
mlir/test/Integration/Dialect/LLVMIR/CPU/test-vp-intrinsic.mlir
8

If you want to follow the previous taken convention, I would put this test (and the lit extension)
in a new directory

e.g we have

test/Integration/Dialect/Vector/CPU/ all vector tests
test/Integration/Dialect/Vector/CPU/AMX AMX specific tests
test/Integration/Dialect/Vector/CPU/ArmSVE ARM SVE specific tests

so it feels like you should move this really into

test/Integration/Dialect/Vector/CPU/RISCV

or at very best

test/Integration/Dialect/LLVMIR/CPU/RISCV

(but I fail to see why you would want it under LLVMIR?)

mlir/test/lit.site.cfg.py.in
40

move one up, this is closer under X86VECTOR than CUDA is

zhanghb97 updated this revision to Diff 475998.Nov 16 2022, 8:47 PM

Place MLIR_RUN_RISCV_VECTOR_TESTS option under X86VECTOR.

zhanghb97 marked an inline comment as done.Nov 16 2022, 8:48 PM
zhanghb97 added inline comments.
mlir/test/Integration/Dialect/LLVMIR/CPU/test-vp-intrinsic.mlir
8

Thanks for the suggestion!

it feels like you should move this really into test/Integration/Dialect/Vector/CPU/RISCV

The VP intrinsic operations are cross-platform, which means that we should test them on different SIMD/Vector backends (Intel AVX series, Arm Neon, RISC-V Vector, etc.), so I don't think we should move the cases into a backend-specific directory. This case can pass on the Intel AVX series and Arm Neon machine (I use Intel Xeon and AppleM1 for the test). As for the RVV side, there are no widely available RVV products now, so we should use an RVV emulator here.

I fail to see why you would want it under LLVMIR?

The VP intrinsic operations are defined in the LLVM dialect, so I write the test under LLVMIR.

In summary, I think the test/Integration/Dialect/LLVMIR/CPU/ is a suitable directory for the VP integration test. WDYT?

mlir/test/lit.site.cfg.py.in
40

Done.

aartbik added inline comments.Nov 21 2022, 10:16 AM
mlir/test/Integration/Dialect/LLVMIR/CPU/test-vp-intrinsic.mlir
8

Many ops in the vector dialect lower to LLVM IR intrinsics (e.g. llvm.intr.vector.reduce.fadd), so by that reasoning, everything should be put under LLVM IR. I still feel this is really a test that belongs under Vector.

aartbik added inline comments.Nov 21 2022, 10:24 AM
mlir/test/Integration/Dialect/LLVMIR/CPU/test-vp-intrinsic.mlir
8

On the other hand, I seem to have written tests like test-vector-reductions-int.mlir myself, so I can see you reasoning ;-)

aartbik accepted this revision.Nov 21 2022, 10:25 AM
This revision is now accepted and ready to land.Nov 21 2022, 10:25 AM
zhanghb97 marked an inline comment as done.Nov 22 2022, 1:28 AM
zhanghb97 added inline comments.
mlir/test/Integration/Dialect/LLVMIR/CPU/test-vp-intrinsic.mlir
8

Yes, this is very similar to the vector reduction cases. It seems that there is no rule to explain where the test of vector-like LLVMOps should be placed. The current integration tests here are only for the VP intrinsic ops themselves. They do not extend to the lowering part from the Vector dialect. So I will land this patch first to place the cases under LLVMIR, and I am open to modifying the directory if the relevant rules are confirmed in future discussions.