[PATCH] D44338: [LV][VPlan] Build plain CFG with simple recipes for outer loops.

Diego Caballero via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 9 16:44:29 PST 2018


dcaballe created this revision.
dcaballe added reviewers: rengolin, fhahn, mkuper, mssimpso, a.elovikov, hfinkel.
Herald added subscribers: llvm-commits, bollu, mgorny.

Context
-------

This is the patch #3 of the Patch Series #1 to introduce outer loop vectorization support in LV using the VPlan infrastructure.

- RFC: http://lists.llvm.org/pipermail/llvm-dev/2017-December/119523.html
- Patch #1: https://reviews.llvm.org/D40874
- Patch #2: https://reviews.llvm.org/D42447

Patch Series #1. Sub-patch #3.
------------------------------

This patch is expected to be NFC for the current inner loop vectorization path. It introduces the basic algorithm to build the VPlan **plain** CFG (single-level CFG, no hierarchical CFG (H-CFG), yet) in the VPlan-native vectorization path. It includes:

- VPlanHCFGBuilder: Main class to build the VPlan H-CFG (plain CFG without nested regions, for now).
- VPlanVerifier: Main class with utilities to check the consistency of a H-CFG.
- VPlanBlockUtils: Main class with utilities to manipulate VPBlockBases in VPlan.

The VPlan H-CFG is the basic infrastructure on which future VPlan-to-VPlan transformations will be implemented. VPInstruction will be the main instruction-level representation in the VPlan-native vectorization path. However, in this patch we are using existing VPWidenRecipe and VPWidenMemoryInstruction as stepping-stone towards the final VPInstruction representation goal. This approach allows us to keep this patch small and easily introduce code generation support in the VPlan-native path in subsequent patches.

Testing
-------

We don't have code generation capabilities to generate vector code in the VPlan-native path yet. Therefore, we cannot introduce LIT tests to check the correctness of the vector code generated. However, we introduce the flag -vplan-build-stress-test, which enables a stress testing mode that builds the VPlan H-CFG for any supported loop nest from the outermost loop. We also introduce the flag -vplan-verify-hcfg, which checks the consistency of a VPlan H-CFG. Both flags can be used together to thoroughly check the stability of the H-CFG construction algorithm and the consistency of the H-CFGs built. We used this approach on a wide variety of benchmarks suites. We plan to introduce LIT tests once code generation for the VPlan-native path is in place.

Files in 'Vectorize' Dir:
-------------------------

In this patch, we introduce new files for the VPlanHCFGBuilder class (VPlanHCFGBuilder.h/.cpp) and the VPlanVerifier class (VPlanVerifier.h/.cpp). Please, note that header files are private.

We would appreciate feedback on this regard. We understand that having too many small files is not a good idea, but the opposite extreme is not good either. We expect VPlanHCFGBuilder to grow when we introduce simplification/transformations necessary to build a H-CFG and support a wider range of outer loops (see RFC). VPlanVerifier will grow when we introduce verification utilities for regions and VPInstructions. Having separate files also allows having independent debug filters (DEBUG_TYPE) per individual component, which we think it's very convenient.

Thanks,
Diego


Repository:
  rL LLVM

https://reviews.llvm.org/D44338

Files:
  lib/Transforms/Vectorize/CMakeLists.txt
  lib/Transforms/Vectorize/LoopVectorize.cpp
  lib/Transforms/Vectorize/VPlan.h
  lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp
  lib/Transforms/Vectorize/VPlanHCFGBuilder.h
  lib/Transforms/Vectorize/VPlanVerifier.cpp
  lib/Transforms/Vectorize/VPlanVerifier.h
  test/Transforms/LoopVectorize/vplan_hcfg_stress_test.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44338.137868.patch
Type: text/x-patch
Size: 33804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180310/9f397bf8/attachment.bin>


More information about the llvm-commits mailing list