Ruy: Add mechanism to mask out paths.

For example, a "superior" path like AVX-512 can be disabled so that an "inferior" path like AVX2 is executed on a more capable machine.

PiperOrigin-RevId: 267592238
This commit is contained in:
Alex Stark 2019-09-06 07:19:33 -07:00 committed by TensorFlower Gardener
parent a2048b0a19
commit 36e4ce080e

View File

@ -40,6 +40,13 @@ Path Context::GetRuntimeEnabledPaths() {
// Need to resolve now. Start by considering all paths enabled.
runtime_enabled_paths_ = kAllPaths;
// This mechanism is intended to be used for testing and benchmarking. For
// example, one can set RUY_FORCE_DISABLE_PATHS to Path::kAvx512 in order to
// evaluate AVX2 performance on an AVX-512 machine.
#ifdef RUY_FORCE_DISABLE_PATHS
runtime_enabled_paths_ = runtime_enabled_paths_ & ~(RUY_FORCE_DISABLE_PATHS);
#endif
#if RUY_PLATFORM(ARM)
// Now selectively disable paths that aren't supported on this machine.
if ((runtime_enabled_paths_ & Path::kNeonDotprod) != Path::kNone) {