[all-commits] [llvm/llvm-project] 2e8ad4: [SandboxVec] Add pass to create Regions from metad...

Jorge Gorbe Moya via All-commits all-commits at lists.llvm.org
Tue Oct 15 14:51:52 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e8ad49e7cffb22a169c22d02607708c71a80c65
      https://github.com/llvm/llvm-project/commit/2e8ad49e7cffb22a169c22d02607708c71a80c65
  Author: Jorge Gorbe Moya <jgorbe at google.com>
  Date:   2024-10-15 (Tue, 15 Oct 2024)

  Changed paths:
    M llvm/include/llvm/SandboxIR/Pass.h
    M llvm/include/llvm/SandboxIR/PassManager.h
    M llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h
    A llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/PrintInstructionCount.h
    A llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromMetadata.h
    M llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizer.h
    A llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerPassBuilder.h
    M llvm/lib/Transforms/Vectorize/CMakeLists.txt
    M llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
    M llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/PassRegistry.def
    A llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromMetadata.cpp
    M llvm/lib/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizer.cpp
    A llvm/lib/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerPassBuilder.cpp
    M llvm/test/Transforms/SandboxVectorizer/default_pass_pipeline.ll
    A llvm/test/Transforms/SandboxVectorizer/regions-from-metadata.ll
    M llvm/test/Transforms/SandboxVectorizer/user_pass_pipeline.ll
    M llvm/unittests/SandboxIR/PassTest.cpp

  Log Message:
  -----------
  [SandboxVec] Add pass to create Regions from metadata. Generalize SandboxVec pass pipelines. (#112288)

My previous attempt (#111904) hacked creation of Regions from metadata
into the bottom-up vectorizer. I got some feedback that it should be its
own pass. So now we have two SandboxIR function passes (`BottomUpVec`
and `RegionsFromMetadata`) that are interchangeable, and we could have
other SandboxIR function passes doing other kinds of transforms, so this
commit revamps pipeline creation and parsing.

First, `sandboxir::PassManager::setPassPipeline` now accepts pass
arguments in angle brackets. Pass arguments are arbitrary strings that
must be parsed by each pass, the only requirement is that nested angle
bracket pairs must be balanced, to allow for nested pipelines with more
arguments. For example:
```
    bottom-up-vec<region-pass-1,region-pass-2<arg>,region-pass-3>
```
This has complicated the parser a little bit (the loop over pipeline
characters now contains a small state machine), and we now have some new
test cases to exercise the new features.

The main SandboxVectorizerPass now contains a customizable pipeline of
SandboxIR function passes, defined by the `sbvec-passes` flag. Region
passes for the bottom-up vectorizer pass are now in pass arguments (like
in the example above).

Because we have now several classes that can build sub-pass pipelines,
I've moved the logic that interacts with PassRegistry.def into its own
files (PassBuilder.{h,cpp} so it can be easily reused.

Finally, I've added a `RegionsFromMetadata` function pass, which will
allow us to run region passes in isolation from lit tests without
relying on the bottom-up vectorizer, and a new lit test that does
exactly this.

Note that the new pipeline parser now allows empty pipelines. This is
useful for testing. For example, if we use
```
  -sbvec-passes="bottom-up-vec<>"
```
SandboxVectorizer converts LLVM IR to SandboxIR and runs the bottom-up
vectorizer, but no region passes afterwards.
```
  -sbvec-passes=""
```
SandboxVectorizer converts LLVM IR to SandboxIR and runs no passes on
it. This is useful to exercise SandboxIR conversion on its own.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list