Skip to content

Commit

Permalink
Deprecate PrefetchInsertion optimization
Browse files Browse the repository at this point in the history
The optimization has O(n^2) complexity and is currently disabled for
forward array traversals, and recently we've had to disable it under
all array traversals for concurrent scavenge. As read barriers become
more prominent, the introduction of the dataAddr pointer in the header
will force us to further limit this optimization.

This optimization was originally introduced in 2010 for z196
z/Architecture processor to accelerate SPEC workloads. It showed
minimal improvement (1.5%) according to historical data dug up prior to
open sourcing the project. The hardware is hardly used today since it
is so old. In recent iterations of the hardware, software prefetching
has been discouraged due to advancements in hardware prefetching.
Similar observations were seen when we removed prefetching from our
zero memory routines.

Moreover, the phantom words past the end of the GC heap were removed
several years ago, forcing us to disable this optimization for forward
array traversals. As mentioned previously we have been encountering
bugs in this optimization recently due to changes in the JVM and the
fact that this optimization introduces loads on the heap which
previously did not exist.

In the PR we detail performance numbers for several workloads where
we believed this optimization may have provided a benefit. Across all
platforms measured we no longer see a benefit (and sometimes a
degradation) from running this optimization. Here we deprecate the
optimization as we still have access to the original source code in
the history if we ever need to resurrect this effort.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
  • Loading branch information
fjeremic committed Feb 25, 2021
1 parent 57056f9 commit 46e59bf
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 630 deletions.
15 changes: 1 addition & 14 deletions compiler/control/OMROptions.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corp. and others
* Copyright (c) 2000, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -480,7 +480,6 @@ TR::OptionTable OMR::Options::_jitOptions[] = {
{"disablePRBE", "O\tdisable partial redundancy branch elimination", SET_OPTION_BIT(TR_DisablePRBE), "F"},
{"disablePRE", "O\tdisable partial redundancy elimination", TR::Options::disableOptimization, partialRedundancyElimination, 0, "P"},
{"disablePreexistenceDuringGracePeriod","O\tdisable preexistence during CLP grace period", SET_OPTION_BIT(TR_DisablePrexistenceDuringGracePeriod), "F"},
{"disablePrefetchInsertion", "O\tdisable prefetch insertion", TR::Options::disableOptimization, prefetchInsertion, 0, "P"},
{"disableProfiledInlining", "O\tdisable inlining based on profiled this values", SET_OPTION_BIT(TR_DisableProfiledInlining), "F"},
{"disableProfiledMethodInlining", "O\tdisable inlining based on profiled methods", SET_OPTION_BIT(TR_DisableProfiledMethodInlining), "F"},
{"disableProfiledNodeVersioning", "O\tdisable profiled node versioning", TR::Options::disableOptimization, profiledNodeVersioning, 0, "P"},
Expand Down Expand Up @@ -1183,7 +1182,6 @@ TR::OptionTable OMR::Options::_jitOptions[] = {
#endif
{"traceOSRLiveRangeAnalysis", "L\ttrace OSR live range analysis", TR::Options::traceOptimization, osrLiveRangeAnalysis, 0, "P"},
{"tracePRE", "L\ttrace partial redundancy elimination", TR::Options::traceOptimization, partialRedundancyElimination, 0, "P"},
{"tracePrefetchInsertion", "L\ttrace prefetch insertion", TR::Options::traceOptimization, prefetchInsertion, 0, "P"},
{"tracePREForSubNodeReplacement", "L\ttrace partial redundancy elimination focussed on optimal subnode replacement", SET_OPTION_BIT(TR_TracePREForOptimalSubNodeReplacement), "P" },
{"traceProfiledNodeVersioning", "L\ttrace profiled node versioning", TR::Options::traceOptimization, profiledNodeVersioning, 0, "P"},
#ifdef J9_PROJECT_SPECIFIC
Expand Down Expand Up @@ -2626,17 +2624,6 @@ OMR::Options::jitPreProcess()

self()->setOption(TR_EnableAnnotations);

TR::Compilation* comp = TR::comp();
if (comp && TR::Compiler->om.canGenerateArraylets())
{
_disabledOptimizations[prefetchInsertion] = true;
}

#if defined(TR_HOST_ARM64)
// Prefetch is not supported on ARM64 yet
_disabledOptimizations[prefetchInsertion] = true;
#endif

self()->setOption(TR_DisableThunkTupleJ2I); // JSR292:TODO: Figure out how to do this without confusing startPCIfAlreadyCompiled

self()->setOption(TR_DisableSeparateInitFromAlloc);
Expand Down
3 changes: 1 addition & 2 deletions compiler/optimizer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2017, 2019 IBM Corp. and others
# Copyright (c) 2017, 2021 IBM Corp. and others
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -74,7 +74,6 @@ compiler_library(optimizer
${CMAKE_CURRENT_LIST_DIR}/OSRDefAnalysis.cpp
${CMAKE_CURRENT_LIST_DIR}/PartialRedundancy.cpp
${CMAKE_CURRENT_LIST_DIR}/PreExistence.cpp
${CMAKE_CURRENT_LIST_DIR}/PrefetchInsertion.cpp
${CMAKE_CURRENT_LIST_DIR}/Reachability.cpp
${CMAKE_CURRENT_LIST_DIR}/ReachingDefinitions.cpp
${CMAKE_CURRENT_LIST_DIR}/OMRRecognizedCallTransformer.cpp
Expand Down
3 changes: 1 addition & 2 deletions compiler/optimizer/OMROptimizationGroups.enum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corp. and others
* Copyright (c) 2000, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -57,7 +57,6 @@
OPTIMIZATION(lateLocalGroup)
OPTIMIZATION(eachLocalAnalysisPassGroup)
OPTIMIZATION(stripMiningGroup)
OPTIMIZATION(prefetchInsertionGroup)
OPTIMIZATION(sequentialLoadAndStoreColdGroup)
OPTIMIZATION(sequentialLoadAndStoreWarmGroup)
OPTIMIZATION(methodHandleInvokeInliningGroup)
5 changes: 1 addition & 4 deletions compiler/optimizer/OMROptimizationManager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2019 IBM Corp. and others
* Copyright (c) 2000, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -189,9 +189,6 @@ OMR::OptimizationManager::OptimizationManager(TR::Optimizer *o, OptimizationFact
case OMR::stripMining:
_flags.set(requiresStructure | checkStructure | dumpStructure);
break;
case OMR::prefetchInsertion:
_flags.set(requiresStructure | checkStructure | dumpStructure);
break;
case OMR::osrDefAnalysis:
if (self()->comp()->getOption(TR_DisableOSRSharedSlots))
_flags.set(doesNotRequireAliasSets | doesNotRequireTreeDumps | supportsIlGenOptLevel);
Expand Down
3 changes: 1 addition & 2 deletions compiler/optimizer/OMROptimizations.enum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2019 IBM Corp. and others
* Copyright (c) 2000, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -99,7 +99,6 @@
OPTIMIZATION(profiledNodeVersioning)
OPTIMIZATION(allocationSinking)
OPTIMIZATION(stripMining)
OPTIMIZATION(prefetchInsertion)
OPTIMIZATION(samplingJProfiling)
OPTIMIZATION(trivialDeadTreeRemoval)
OPTIMIZATION(osrDefAnalysis)
Expand Down
15 changes: 1 addition & 14 deletions compiler/optimizer/OMROptimizer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2019 IBM Corp. and others
* Copyright (c) 2000, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -104,7 +104,6 @@
#include "optimizer/SinkStores.hpp"
#include "optimizer/PartialRedundancy.hpp"
#include "optimizer/OSRDefAnalysis.hpp"
#include "optimizer/PrefetchInsertion.hpp"
#include "optimizer/StripMiner.hpp"
#include "optimizer/FieldPrivatizer.hpp"
#include "optimizer/ReorderIndexExpr.hpp"
Expand Down Expand Up @@ -444,13 +443,6 @@ const OptimizationStrategy stripMiningOpts[] =
{ endGroup }
};

const OptimizationStrategy prefetchInsertionOpts[] =
{
{ inductionVariableAnalysis },
{ prefetchInsertion },
{ endGroup }
};

const OptimizationStrategy blockManipulationOpts[] =
{
// { generalLoopUnroller, IfLoops }, //Unroll Loops
Expand Down Expand Up @@ -605,7 +597,6 @@ static const OptimizationStrategy omrHotStrategyOpts[] =
{ OMR::globalCopyPropagation, },
{ OMR::loopCanonicalizationGroup, }, // canonicalize loops (improve fall throughs)
{ OMR::expressionsSimplification, },
{ OMR::prefetchInsertionGroup, }, // created IL should not be moved
{ OMR::partialRedundancyEliminationGroup },
{ OMR::globalDeadStoreElimination, },
{ OMR::inductionVariableAnalysis, },
Expand Down Expand Up @@ -849,8 +840,6 @@ OMR::Optimizer::Optimizer(TR::Compilation *comp, TR::ResolvedMethodSymbol *metho
new (comp->allocator()) TR::OptimizationManager(self(), TR_OSRExceptionEdgeRemoval::create, OMR::osrExceptionEdgeRemoval);
_opts[OMR::regDepCopyRemoval] =
new (comp->allocator()) TR::OptimizationManager(self(), TR::RegDepCopyRemoval::create, OMR::regDepCopyRemoval);
_opts[OMR::prefetchInsertion] =
new (comp->allocator()) TR::OptimizationManager(self(), TR_PrefetchInsertion::create, OMR::prefetchInsertion);
_opts[OMR::stripMining] =
new (comp->allocator()) TR::OptimizationManager(self(), TR_StripMiner::create, OMR::stripMining);
_opts[OMR::fieldPrivatization] =
Expand Down Expand Up @@ -904,8 +893,6 @@ OMR::Optimizer::Optimizer(TR::Compilation *comp, TR::ResolvedMethodSymbol *metho
new (comp->allocator()) TR::OptimizationManager(self(), NULL, OMR::veryExpensiveGlobalValuePropagationGroup, veryExpensiveGlobalValuePropagationOpts);
_opts[OMR::loopSpecializerGroup] =
new (comp->allocator()) TR::OptimizationManager(self(), NULL, OMR::loopSpecializerGroup, loopSpecializerOpts);
_opts[OMR::prefetchInsertionGroup] =
new (comp->allocator()) TR::OptimizationManager(self(), NULL, OMR::prefetchInsertionGroup, prefetchInsertionOpts);
_opts[OMR::lateLocalGroup] =
new (comp->allocator()) TR::OptimizationManager(self(), NULL, OMR::lateLocalGroup, lateLocalOpts);
_opts[OMR::eachLocalAnalysisPassGroup] =
Expand Down
3 changes: 1 addition & 2 deletions compiler/optimizer/OptimizationStrategies.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2019 IBM Corp. and others
* Copyright (c) 2000, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -55,7 +55,6 @@ extern const OptimizationStrategy loopCanonicalizationOpts[];
extern const OptimizationStrategy blockManipulationOpts[];
extern const OptimizationStrategy eachLocalAnalysisPassOpts[];
extern const OptimizationStrategy stripMiningOpts[];
extern const OptimizationStrategy prefetchInsertionOpts[];
extern const OptimizationStrategy methodHandleInvokeInliningOpts[];

//arrays of optimizations
Expand Down

0 comments on commit 46e59bf

Please sign in to comment.