This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Split up VectorToLLVM pass
ClosedPublic

Authored by krzysz00 on Aug 18 2023, 8:38 AM.

Details

Summary

Currently, the VectorToLLVM patterns are built into a library along
with the corresponding pass, which also pulls in all the
platform-specific vector dialects (like AMXDialect) to apply all the
vector to LLVM conversions.

This causes dependency bloat when writing libraries - for example the
GPU to LLVM passes, which use the vector to LLVM patterns, don't need
the X86Vector dialect to be present at all.

This commit partitions the library into VectorToLLVM and
VectorToLLVMPass, where the latter pulls in all the other vector
transformations.

Diff Detail

Event Timeline

krzysz00 created this revision.Aug 18 2023, 8:38 AM
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
krzysz00 requested review of this revision.Aug 18 2023, 8:38 AM
bondhugula added inline comments.
mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.h
2

Use full width.

2

This isn't really a test pass. So avoid "check", instead "converts vector to LLVM".

12

This header file appears out of line. What part of this header needs this include? The pass creation method isn't here. Actually, why is this file even needed?

mlir/test/lib/Dialect/LLVM/CMakeLists.txt
22

A Pass suffix is inconsistent how other things are structured. Just retain this as MLIRVectorToLLVM and instead rename the existing MLIRVectorToLLVM to MLIRVectoToLLVMPatters or ...Utils?

Is the new ConvertToLLVMPass making this pass obsolete potentially?

mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.h
12

Pass creation and registration methods are nowadays all ODS generated! (when you avoid defining let constructor = in the .td file)

@mehdi_amini What's this new ConvertToLLVM pass?

mlir/test/lib/Dialect/LLVM/CMakeLists.txt
22

The documentation gave the example

Conversion passes should live separately from conversions themselves

for convenience of users that only care about a pass and not about its
implementation with patterns or other infrastructure. For example
include/mlir/VectorToLLVM/VectorToLLVMPass.h.

Matt added a subscriber: Matt.Aug 21 2023, 1:12 PM

Ping on what needs to be done here

mehdi_amini accepted this revision.Sep 8 2023, 4:25 PM

LGTM, I actually wasn't sure if you had answer for my question last time? (either way it's fine to merge this refactoring)

This revision is now accepted and ready to land.Sep 8 2023, 4:25 PM
krzysz00 updated this revision to Diff 556437.Sep 11 2023, 8:26 AM

Fix NVVM tests

This revision was landed with ongoing or failed builds.Sep 13 2023, 9:10 AM
This revision was automatically updated to reflect the committed changes.