mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-06 12:20:11 +01:00
Suppress floating-point denormals at the beginning of each Interpreter::Invoke call.
Note this change depends on the RUY commit as shown by 38a9266b83.
PiperOrigin-RevId: 367136983
Change-Id: Ib7b320de9a7afe6e7ef25f87ff2ce7cb2d0c7c47
This commit is contained in:
parent
3fcf9f3cb7
commit
ff72b00581
|
|
@ -359,6 +359,7 @@ cc_library(
|
|||
"//tensorflow/lite/schema:schema_fbs",
|
||||
"//tensorflow/lite/schema:schema_utils",
|
||||
"@flatbuffers//:runtime_cc",
|
||||
"@ruy//ruy:denormal",
|
||||
],
|
||||
alwayslink = 1, # Why?? TODO(b/161243354): eliminate this.
|
||||
)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ limitations under the License.
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "ruy/denormal.h" // from @ruy
|
||||
#include "tensorflow/lite/allocation.h"
|
||||
#include "tensorflow/lite/core/api/error_reporter.h"
|
||||
#include "tensorflow/lite/core/api/profiler.h"
|
||||
|
|
@ -281,6 +282,12 @@ TfLiteStatus Interpreter::ReleaseNonPersistentMemory() {
|
|||
TfLiteStatus Interpreter::Invoke() {
|
||||
ScopedRuntimeInstrumentationProfile scoped_runtime_event(installed_profiler_,
|
||||
"invoke");
|
||||
|
||||
// Denormal floating point numbers could cause significant slowdown on
|
||||
// platforms like x86, therefore, we suppress denormals here to prevent this
|
||||
// from happening.
|
||||
ruy::ScopedSuppressDenormals suppress_denormals;
|
||||
|
||||
TF_LITE_ENSURE_STATUS_WITH_SCOPED_INSTRUMENTATION(
|
||||
scoped_runtime_event, primary_subgraph().Invoke());
|
||||
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ SIFIVE_FE310_LIB_MD5 := "06ee24c4956f8e21670ab3395861fe64"
|
|||
KISSFFT_URL="http://mirror.tensorflow.org/github.com/mborgerding/kissfft/archive/v130.zip"
|
||||
KISSFFT_MD5="438ba1fef5783cc5f5f201395cc477ca"
|
||||
|
||||
RUY_URL="https://github.com/google/ruy/archive/54774a7a2cf85963777289193629d4bd42de4a59.zip"
|
||||
RUY_MD5="c9cb85bf99dab7a49d78758470890b31"
|
||||
RUY_URL="https://github.com/google/ruy/archive/38a9266b832767a3f535a74a9e0cf39f7892e594.zip"
|
||||
RUY_MD5="4cbc3104b27b718c819b2082beb732c5"
|
||||
|
||||
CIFAR10_DATASET_URL="http://mirror.tensorflow.org/www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz"
|
||||
CIFAR10_DATASET_MD5="c32a1d4ab5d03f1284b67883e8d87530"
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ GEMMLOWP_WORKSPACE_BZL_PATH="third_party/gemmlowp/workspace.bzl"
|
|||
GEMMLOWP_COMMIT="$(grep -oP 'GEMMLOWP_COMMIT = "\K[0-9a-f]{40}' "${GEMMLOWP_WORKSPACE_BZL_PATH}")"
|
||||
GEMMLOWP_URL="https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/gemmlowp/archive/"${GEMMLOWP_COMMIT}".zip"
|
||||
GEMMLOWP_SHA="$(grep -oP 'GEMMLOWP_SHA256 = "\K[0-9a-f]{64}' "${GEMMLOWP_WORKSPACE_BZL_PATH}")"
|
||||
RUY_URL="https://github.com/google/ruy/archive/54774a7a2cf85963777289193629d4bd42de4a59.zip"
|
||||
RUY_SHA="da5ec0cc07472bdb21589b0b51c8f3d7f75d2ed6230b794912adf213838d289a"
|
||||
RUY_URL="https://github.com/google/ruy/archive/38a9266b832767a3f535a74a9e0cf39f7892e594.zip"
|
||||
RUY_SHA="dbfee92fcf9d6a767e9689ca46aa6c1ec4eb8fe69376bacff45dd875226d0ba1"
|
||||
GOOGLETEST_URL="https://github.com/google/googletest/archive/release-1.8.0.tar.gz"
|
||||
GOOGLETEST_SHA="58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8"
|
||||
ABSL_WORKSPACE_BZL_PATH="third_party/absl/workspace.bzl"
|
||||
|
|
|
|||
8
third_party/ruy/workspace.bzl
vendored
8
third_party/ruy/workspace.bzl
vendored
|
|
@ -5,11 +5,11 @@ load("//third_party:repo.bzl", "tf_http_archive")
|
|||
def repo():
|
||||
tf_http_archive(
|
||||
name = "ruy",
|
||||
sha256 = "da5ec0cc07472bdb21589b0b51c8f3d7f75d2ed6230b794912adf213838d289a",
|
||||
strip_prefix = "ruy-54774a7a2cf85963777289193629d4bd42de4a59",
|
||||
sha256 = "dbfee92fcf9d6a767e9689ca46aa6c1ec4eb8fe69376bacff45dd875226d0ba1",
|
||||
strip_prefix = "ruy-38a9266b832767a3f535a74a9e0cf39f7892e594",
|
||||
urls = [
|
||||
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/ruy/archive/54774a7a2cf85963777289193629d4bd42de4a59.zip",
|
||||
"https://github.com/google/ruy/archive/54774a7a2cf85963777289193629d4bd42de4a59.zip",
|
||||
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/ruy/archive/38a9266b832767a3f535a74a9e0cf39f7892e594.zip",
|
||||
"https://github.com/google/ruy/archive/38a9266b832767a3f535a74a9e0cf39f7892e594.zip",
|
||||
],
|
||||
build_file = "//third_party/ruy:BUILD",
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user