From 38a3f21959d5c68d3034d4d3cef0cc231ebce78a Mon Sep 17 00:00:00 2001 From: Aart Bik Date: Fri, 20 Oct 2017 17:02:21 -0700 Subject: Alignment optimizations in vectorizer. Rationale: Since aligned data access is generally better (enables more efficient aligned moves and prevents nasty cache line splits), computing and/or enforcing alignment has been added to the vectorizer: (1) If the initial alignment is known completely and suffices, then a static peeling factor enforces proper alignment. (2) If (1) fails, but the base alignment allows, dynamically peeling until total offset is aligned forces proper aligned access patterns. By using ART conventions only, any forced alignment is preserved over suspends checks where data may move. Note 1: Current allocation convention is just 8 byte alignment on arrays/strings, so only ARM32 benefits. However, all optimizations are implemented in a general way, so moving to a 16 byte alignment will immediately take advantage of any new convention!! Note 2: This CL also exposes how bad the choice of 12 byte offset of arrays really is. Even though the new optimizations fix the misaligned, it requires peeling for the most common case: 0 indexed loops. Therefore, we may even consider moving to a 16 byte offset. Again the optimizations in this CL will immediately take advantage of that new convention!! Test: test-art-host test-art-target Change-Id: Ib6cc0fb68c9433d3771bee573603e64a3a9423ee --- compiler/optimizing/graph_visualizer.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'compiler/optimizing/graph_visualizer.cc') diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc index 3851877ae5..f7fd9101fd 100644 --- a/compiler/optimizing/graph_visualizer.cc +++ b/compiler/optimizing/graph_visualizer.cc @@ -527,6 +527,10 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor { StartAttributeStream("packed_type") << vec_operation->GetPackedType(); } + void VisitVecMemoryOperation(HVecMemoryOperation* vec_mem_operation) OVERRIDE { + StartAttributeStream("alignment") << vec_mem_operation->GetAlignment().ToString(); + } + void VisitVecHalvingAdd(HVecHalvingAdd* hadd) OVERRIDE { VisitVecBinaryOperation(hadd); StartAttributeStream("unsigned") << std::boolalpha << hadd->IsUnsigned() << std::noboolalpha; -- cgit v1.2.3