// Copyright 2022 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_COMPILER_REVECTORIZER_H_ #define V8_COMPILER_REVECTORIZER_H_ // Revectorizer is an optimization to promote pairs of simd128 nodes to new // simd256 nodes accelerated by wider vector available from hardware e.g. the // YMM registers from AVX2 instruction set when possible and beneficial. The // main algorithm is based on the Superword Level Parallel (SLP) vectorization // technique. #include <vector> #include "src/base/small-vector.h" #include "src/compiler/graph.h" #include "src/compiler/linear-scheduler.h" #include "src/compiler/machine-graph.h" #include "src/compiler/machine-operator.h" #include "src/compiler/node-marker.h" #include "src/compiler/node-properties.h" #include "src/compiler/node.h" #include "src/compiler/schedule.h" #include "src/zone/zone-containers.h" namespace v8 { namespace internal { namespace compiler { class SourcePositionTable; struct V8_EXPORT_PRIVATE MemoryOffsetComparer { … }; StoreNodeSet; // A PackNode consists of a fixed number of isomorphic simd128 nodes which can // execute in parallel and convert to a 256-bit simd node later. The nodes in a // PackNode must satisfy that they can be scheduled in the same basic block and // are mutually independent. class PackNode final : public NON_EXPORTED_BASE(ZoneObject) { … }; // An auxillary tree structure with a set of PackNodes based on the Superword // Level Parallelism (SLP) vectorization technique. The BuildTree method will // start from a selected root, e.g. a group of consecutive stores, and extend // through value inputs to create new PackNodes if the inputs are valid, or // conclude that the current PackNode is a leaf and terminate the tree. // Below is an example of SLPTree where loads and stores in each PackNode are // all consecutive. // [Load0, Load1] [Load2, Load3] // \ / // [Add0, Add1] // | // [Store0, Store1] class SLPTree : public NON_EXPORTED_BASE(ZoneObject) { … }; // The Revectorizer pass will firstly collect seeds with valid group of // consecutive stores as the root to build the SLPTree. If the SLPTree is built // successfully, it will estimate the cost of the 256-bit transformation for // each PackNode and conduct the final revectorization if benefitial. class V8_EXPORT_PRIVATE Revectorizer final : public NON_EXPORTED_BASE(ZoneObject) { … }; } // namespace compiler } // namespace internal } // namespace v8 #endif // V8_COMPILER_REVECTORIZER_H_