This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] enable SpeculativeExecution in NVPTX
ClosedPublic

Authored by jingyue on Jul 14 2015, 2:56 PM.

Details

Summary

SpeculativeExecution enables a series straight line optimizations (such
as SLSR and NaryReassociate) on conditional code. For example,

if (...)
  ... b * s ...
if (...)
  ... (b + 1) * s ...

speculative execution can hoist b * s and (b + 1) * s from then-blocks,
so that we have

... b * s ...
if (...)
  ...
... (b + 1) * s ...
if (...)
  ...

Then, SLSR can rewrite (b + 1) * s to (b * s + s) because after
speculative execution b * s dominates (b + 1) * s.

The performance impact of this change is significant. It speeds up the
benchmarks running EigenFloatContractionKernelInternal16x16
(https://bitbucket.org/eigen/eigen/src/ba68f42fa69e4f43417fe1e52669d4dd5d2b3bee/unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h?at=default#cl-526)
by roughly 2%. Some internal benchmarks that have the above code pattern
are improved by up to 40%. No significant slowdowns are observed on
Eigen CUDA microbenchmarks.

Diff Detail

Event Timeline

jingyue updated this revision to Diff 29717.Jul 14 2015, 2:56 PM
jingyue retitled this revision from to [NVPTX] enable SpeculativeExecution in NVPTX.
jingyue updated this object.
jingyue added reviewers: jholewinski, broune.
jingyue added a subscriber: llvm-commits.
eliben accepted this revision.Jul 16 2015, 9:58 AM
eliben edited edge metadata.

lgtm

This revision is now accepted and ready to land.Jul 16 2015, 9:58 AM
jingyue closed this revision.Jul 16 2015, 1:13 PM