1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/test/CodeGen/Hexagon/vect
Roorda, Jan-Willem b03f33eb41 [Pipeliner] Fixed node order issue related to zero latency edges
Summary:
A desired property of the node order in Swing Modulo Scheduling is
that for nodes outside circuits the following holds: none of them is
scheduled after both a successor and a predecessor. We call
node orders that meet this property valid.

Although invalid node orders do not lead to the generation of incorrect
code, they can cause the pipeliner not being able to find a pipelined schedule
for arbitrary II. The reason is that after scheduling the successor and the
predecessor of a node, no room may be left to schedule the node itself.

For data flow graphs with 0-latency edges, the node ordering algorithm
of Swing Modulo Scheduling can generate such undesired invalid node orders.
This patch fixes that.

In the remainder of this commit message, I will give an example
demonstrating the issue, explain the fix, and explain how the the fix is tested.

Consider, as an example, the following data flow graph with all
edge latencies 0 and all edges pointing downward.

```
   n0
  /  \
n1    n3
  \  /
   n2
    |
   n4
```

Consider the implemented node order algorithm in top-down mode. In that mode,
the algorithm orders the nodes based on greatest Height and in case of equal
Height on lowest Movability. Finally, in case of equal Height and
Movability, given two nodes with an edge between them, the algorithm prefers
the source-node.

In the graph, for every node, the Height and Movability are equal to 0.
As will be explained below, the algorithm can generate the order n0, n1, n2, n3, n4.
So, node n3 is scheduled after its predecessor n0 and after its successor n2.

The reason that the algorithm can put node n2 in the order before node n3,
even though they have an edge between them in which node n3 is the source,
is the following: Suppose the algorithm has constructed the partial node
order n0, n1. Then, the nodes left to be ordered are nodes n2, n3, and n4. Suppose
that the while-loop in the implemented algorithm considers the nodes in
the order n4, n3, n2. The algorithm will start with node n4, and look for
more preferable nodes. First, node n4 will be compared with node n3. As the nodes
have equal Height and Movability and have no edge between them, the algorithm
will stick with node n4. Then node n4 is compared with node n2. Again the
Height and Movability are equal. But, this time, there is an edge between
the two nodes, and the algorithm will prefer the source node n2.
As there are no nodes left to compare, the algorithm will add node n2 to
the node order, yielding the partial node order n0, n1, n2. In this way node n2
arrives in the node-order before node n3.

To solve this, this patch introduces the ZeroLatencyHeight (ZLH) property
for nodes. It is defined as the maximum unweighted length of a path from the
given node to an arbitrary node in which each edge has latency 0.
So, ZLH(n0)=3, ZLH(n1)=ZLH(n3)=2, ZLH(n2)=1, and ZLH(n4)=0

In this patch, the preference for a greater ZeroLatencyHeight
is added in the top-down mode of the node ordering algorithm, after the
preference for a greater Height, and before the preference for a
lower Movability.

Therefore, the two allowed node-orders are n0, n1, n3, n2, n4 and n0, n3, n1, n2, n4.
Both of them are valid node orders.

In the same way, the bottom-up mode of the node ordering algorithm is adapted
by introducing the ZeroLatencyDepth property for nodes.

The patch is tested by adding extra checks to the following existing
lit-tests:
test/CodeGen/Hexagon/SUnit-boundary-prob.ll
test/CodeGen/Hexagon/frame-offset-overflow.ll
test/CodeGen/Hexagon/vect/vect-shuffle.ll

Before this patch, the pipeliner failed to pipeline the loops in these tests
due to invalid node-orders. After the patch, the pipeliner successfully
pipelines all these loops.

Reviewers: bcahoon

Reviewed By: bcahoon

Subscribers: Ayal, mgrang, llvm-commits

Differential Revision: https://reviews.llvm.org/D43620

llvm-svn: 326925
2018-03-07 18:53:36 +00:00
..
build-vect64.ll [Hexagon] Fix building 64-bit vector from constant values 2018-01-11 18:30:41 +00:00
setcc-v2i32.ll [Hexagon] SETEQ and SETNE are valid integer condition codes 2018-01-25 18:07:27 +00:00
shuff-32.ll [Hexagon] Rewrite LowerVECTOR_SHUFFLE for 32-/64-bit vectors 2018-01-15 18:33:33 +00:00
shuff-64.ll [Hexagon] Rewrite LowerVECTOR_SHUFFLE for 32-/64-bit vectors 2018-01-15 18:33:33 +00:00
vect-anyextend.ll
vect-apint-truncate.ll
vect-bad-bitcast.ll
vect-bitcast-1.ll
vect-bitcast.ll
vect-bool-basic-compile.ll [Hexagon] Implement basic vector operations on vectors vNi1 2018-01-23 17:53:59 +00:00
vect-bool-isel-crash.ll [Hexagon] Implement basic vector operations on vectors vNi1 2018-01-23 17:53:59 +00:00
vect-cst-v4i8.ll
vect-cst-v4i32.ll [Hexagon] Implement buildVector32 and buildVector64 as utility functions 2017-11-22 20:56:23 +00:00
vect-cst.ll
vect-extract-i1-debug.ll [Hexagon] Adjust the value type for BCvt in LowerFormalArguments 2017-12-20 14:44:05 +00:00
vect-extract-i1.ll
vect-extract.ll
vect-fma.ll
vect-illegal-type.ll
vect-infloop.ll [Hexagon] Allow construction of HVX vector predicates 2017-12-20 20:49:43 +00:00
vect-insert-extract-elt.ll
vect-load-1.ll [Hexagon] Reorganize and update instruction patterns 2017-10-20 19:33:12 +00:00
vect-load-v4i16.ll [Hexagon] Rewrite non-HVX unaligned loads as pairs of aligned ones 2018-03-07 17:27:18 +00:00
vect-load.ll
vect-mul-v2i16.ll
vect-mul-v2i32.ll
vect-mul-v4i8.ll [Hexagon] Reorganize and update instruction patterns 2017-10-20 19:33:12 +00:00
vect-mul-v4i16.ll
vect-mul-v8i8.ll [Hexagon] Reorganize and update instruction patterns 2017-10-20 19:33:12 +00:00
vect-no-tfrs-1.ll
vect-no-tfrs.ll
vect-shift-imm.ll
vect-shuffle.ll [Pipeliner] Fixed node order issue related to zero latency edges 2018-03-07 18:53:36 +00:00
vect-splat.ll
vect-store-v2i16.ll
vect-truncate.ll [Hexagon] Remove {{ *}} from testcases 2018-03-06 19:07:21 +00:00
vect-v4i16.ll [Hexagon] Rewrite non-HVX unaligned loads as pairs of aligned ones 2018-03-07 17:27:18 +00:00
vect-vaddb-1.ll
vect-vaddb.ll
vect-vaddh-1.ll
vect-vaddh.ll
vect-vaddw.ll
vect-vaslw.ll
vect-vshifts.ll
vect-vsplatb.ll [Hexagon] Implement buildVector32 and buildVector64 as utility functions 2017-11-22 20:56:23 +00:00
vect-vsplath.ll
vect-vsubb-1.ll
vect-vsubb.ll
vect-vsubh-1.ll
vect-vsubh.ll
vect-vsubw.ll
vect-xor.ll
vect-zeroextend.ll
vsplat-v8i8.ll [Hexagon] Add pattern for vsplat to v8i8 2018-01-05 20:43:56 +00:00
zext-v4i1.ll [Hexagon] Run late copy propagation and dead code elimination passes 2018-01-24 17:48:11 +00:00