[XLA] Use absl string types and functions instead of the TF versions.
Unfortunately this has to be one big patch, because e.g. absl::StrCat doesn't accept a TF StringPiece, but as soon as we switch to absl::string_view, we have to switch away from all of the TF functions. PiperOrigin-RevId: 209957896
This commit is contained in:
parent
5da5e8af46
commit
90d9d2b194
tensorflow/compiler
aot
jit/kernels
xla
BUILDarray.harray2d.harray4d.h
client
BUILDclient.cccompile_only_client.cccompile_only_client.hexecutable_build_options.ccexecutable_build_options.h
device_util.hlayout_util.cclib
xla_builder.ccxla_builder.hlegacy_flags
literal.ccliteral.hliteral_comparison.ccliteral_test.ccliteral_util.ccliteral_util.hmetric_table_report.ccmetric_table_report.hpython
service
BUILDalgebraic_simplifier.ccalgebraic_simplifier.halgebraic_simplifier_test.ccallocation_tracker.ccbackend.hbatch_dot_simplification.ccbatch_dot_simplification.hbatchnorm_expander.hbfloat16_conversion_folding.hbfloat16_normalization.hbfloat16_propagation.hbuffer_assignment.ccbuffer_value.cccall_graph.cccall_inliner.hchannel_tracker.cccompile_only_service.cccomputation_layout.cccomputation_placer.ccconditional_simplifier.ccconditional_simplifier.hconvolution_feature_group_converter.hcopy_insertion.cccopy_insertion.h
cpu
BUILDconv_canonicalization.hcpu_compiler.cccpu_copy_insertion.hcpu_executable.cccpu_hlo_support_checker.hcpu_instruction_fusion_test.cccpu_options.ccdot_op_emitter.ccdot_op_emitter.hir_emitter.ccir_emitter.hir_function.ccir_function.hparallel_loop_emitter.ccparallel_loop_emitter.hparallel_task_assignment.ccparallel_task_assignment.hsimple_orc_jit.cc
defuser.hdespecializer.ccdespecializer.hdfs_hlo_visitor.hdfs_hlo_visitor_with_default.hdot_decomposer.helemental_ir_emitter.ccflatten_call_graph.hgather_expander.htests
gpu
@ -97,7 +97,7 @@ static StatusOr<std::unique_ptr<llvm::TargetMachine>>
|
||||
GetTargetMachineFromTriple(StringPiece target_triple) {
|
||||
std::string error;
|
||||
std::string normalized_triple =
|
||||
llvm::Triple::normalize(AsStringRef(target_triple));
|
||||
llvm::Triple::normalize(AsStringRef(absl::string_view(target_triple)));
|
||||
const llvm::Target* target =
|
||||
llvm::TargetRegistry::lookupTarget(normalized_triple, error);
|
||||
if (target == nullptr) {
|
||||
|
@ -226,5 +226,6 @@ tf_cc_test(
|
||||
"//tensorflow/core:test",
|
||||
"//tensorflow/core:test_main",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||
#define EIGEN_USE_THREADS
|
||||
#define EIGEN_USE_CUSTOM_THREAD_POOL
|
||||
|
||||
#include "absl/strings/str_split.h"
|
||||
#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
|
||||
#include "tensorflow/compiler/aot/tests/test_graph_tfadd.h"
|
||||
#include "tensorflow/compiler/aot/tests/test_graph_tfadd_with_ckpt.h"
|
||||
@ -546,7 +547,7 @@ TEST(TFCompileTest, HloProfiling) {
|
||||
VLOG(1) << "HLO profile string:\n" << hlo_profile_as_string;
|
||||
|
||||
std::vector<string> hlo_profile_lines =
|
||||
tensorflow::str_util::Split(hlo_profile_as_string, '\n');
|
||||
absl::StrSplit(hlo_profile_as_string, '\n');
|
||||
|
||||
auto header = HasSubstr("Execution profile for");
|
||||
auto total_cycles_profile_line = HasSubstr("[total]");
|
||||
|
@ -39,6 +39,7 @@ cc_library(
|
||||
"//tensorflow/core:core_cpu",
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "absl/strings/numbers.h"
|
||||
#include "tensorflow/compiler/jit/legacy_flags/parallel_check_op_flags.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/framework/op.h"
|
||||
@ -41,14 +42,12 @@ class ParallelCheckOp : public OpKernel {
|
||||
double rtol;
|
||||
legacy_flags::ParallelCheckOpFlags* flags =
|
||||
legacy_flags::GetParallelCheckOpFlags();
|
||||
if (!tensorflow::strings::safe_strtod(flags->parallel_check_rtol.c_str(),
|
||||
&rtol)) {
|
||||
if (!absl::SimpleAtod(flags->parallel_check_rtol.c_str(), &rtol)) {
|
||||
LOG(ERROR) << "can't convert parallel_check_rtol "
|
||||
<< flags->parallel_check_rtol << " to double";
|
||||
}
|
||||
double atol;
|
||||
if (!tensorflow::strings::safe_strtod(flags->parallel_check_atol.c_str(),
|
||||
&atol)) {
|
||||
if (!absl::SimpleAtod(flags->parallel_check_atol.c_str(), &atol)) {
|
||||
LOG(ERROR) << "can't convert parallel_check_atol "
|
||||
<< flags->parallel_check_atol << " to double";
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ cc_library(
|
||||
":statusor",
|
||||
":types",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -173,6 +174,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/algorithm:container",
|
||||
"@com_google_absl//absl/container:inlined_vector",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -242,6 +244,7 @@ cc_library(
|
||||
"//tensorflow/core:lib_internal",
|
||||
"//tensorflow/core:regexp_internal",
|
||||
"@com_google_absl//absl/container:inlined_vector",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
)
|
||||
@ -259,6 +262,7 @@ tf_cc_test(
|
||||
":xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:test_main",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -301,6 +305,7 @@ cc_library(
|
||||
":xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -320,6 +325,7 @@ tf_cc_test(
|
||||
"//tensorflow/core:test",
|
||||
"//tensorflow/core:test_main",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -341,6 +347,7 @@ cc_library(
|
||||
":xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -359,6 +366,7 @@ cc_library(
|
||||
":literal_util",
|
||||
":util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -370,6 +378,7 @@ cc_library(
|
||||
deps = [
|
||||
":util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -379,8 +388,8 @@ cc_library(
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":types",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -391,6 +400,7 @@ cc_library(
|
||||
":status",
|
||||
":types",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -411,8 +421,10 @@ cc_library(
|
||||
deps = [
|
||||
":array",
|
||||
":types",
|
||||
":util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -457,6 +469,7 @@ cc_library(
|
||||
":array2d",
|
||||
":types",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -510,6 +523,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:regexp_internal",
|
||||
"//tensorflow/core:test",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -529,6 +543,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:lib_internal",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -559,6 +574,7 @@ cc_library(
|
||||
":types",
|
||||
":xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -629,6 +645,7 @@ cc_library(
|
||||
":types",
|
||||
":xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -27,12 +27,12 @@ limitations under the License.
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/status.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/core/lib/core/bits.h"
|
||||
#include "tensorflow/core/lib/gtl/array_slice.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/macros.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
@ -25,11 +25,11 @@ limitations under the License.
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/array.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/core/lib/core/bits.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/macros.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
@ -26,12 +26,12 @@ limitations under the License.
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/array.h"
|
||||
#include "tensorflow/compiler/xla/array2d.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/core/lib/gtl/array_slice.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/lib/strings/stringprintf.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/macros.h"
|
||||
|
@ -77,6 +77,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/service:hlo_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -90,6 +91,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/compiler/xla/service:device_memory_allocator",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
)
|
||||
@ -216,6 +218,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/algorithm:container",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -19,6 +19,7 @@ limitations under the License.
|
||||
#include <utility>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/client/xla_computation.h"
|
||||
#include "tensorflow/compiler/xla/execution_options_util.h"
|
||||
#include "tensorflow/compiler/xla/legacy_flags/debug_options_flags.h"
|
||||
@ -26,7 +27,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/status_macros.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/protobuf.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
@ -400,7 +400,7 @@ StatusOr<string> Client::ExecutionStatsAsString(
|
||||
int64 nanoseconds = profile.compute_time_ns();
|
||||
int64 cycle_count = profile.compute_cycle_count();
|
||||
double gflops = total_flops / nanoseconds;
|
||||
return tensorflow::strings::StrCat(
|
||||
return absl::StrCat(
|
||||
"[Execution Statistics] flop count: ", computation_stats.flop_count(),
|
||||
", transcendental count: ", computation_stats.transcendental_count(),
|
||||
", compute execution time: ", nanoseconds, " nsec",
|
||||
|
@ -41,7 +41,7 @@ CompileOnlyClient::CompileAheadOfTime(
|
||||
metadata);
|
||||
}
|
||||
|
||||
int64 CompileOnlyClient::PointerSizeForTriple(tensorflow::StringPiece triple) {
|
||||
int64 CompileOnlyClient::PointerSizeForTriple(absl::string_view triple) {
|
||||
llvm::Triple llvm_triple(
|
||||
llvm::Triple::normalize(llvm::StringRef(triple.data(), triple.size())));
|
||||
if (llvm_triple.isArch64Bit()) {
|
||||
|
@ -57,7 +57,7 @@ class CompileOnlyClient : public Client {
|
||||
std::unique_ptr<AotCompilationMetadata>* metadata = nullptr);
|
||||
|
||||
// Returns the size of a pointer in bytes for a given triple.
|
||||
static int64 PointerSizeForTriple(tensorflow::StringPiece triple);
|
||||
static int64 PointerSizeForTriple(absl::string_view triple);
|
||||
|
||||
private:
|
||||
CompileOnlyService* compiler_service_;
|
||||
|
@ -77,7 +77,7 @@ const absl::optional<string>& ExecutableBuildOptions::generate_hlo_graph()
|
||||
}
|
||||
|
||||
ExecutableBuildOptions& ExecutableBuildOptions::set_dump_optimized_hlo_proto_to(
|
||||
tensorflow::StringPiece dirpath) {
|
||||
absl::string_view dirpath) {
|
||||
dump_optimized_hlo_proto_to_ = string(dirpath);
|
||||
return *this;
|
||||
}
|
||||
@ -89,8 +89,8 @@ ExecutableBuildOptions::dump_optimized_hlo_proto_to() const {
|
||||
|
||||
ExecutableBuildOptions&
|
||||
ExecutableBuildOptions::set_dump_unoptimized_hlo_proto_to(
|
||||
tensorflow::StringPiece dirpath) {
|
||||
dump_unoptimized_hlo_proto_to_ = dirpath.ToString();
|
||||
absl::string_view dirpath) {
|
||||
dump_unoptimized_hlo_proto_to_ = string(dirpath);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ ExecutableBuildOptions::dump_unoptimized_hlo_proto_to() const {
|
||||
}
|
||||
|
||||
ExecutableBuildOptions& ExecutableBuildOptions::set_dump_per_pass_hlo_proto_to(
|
||||
tensorflow::StringPiece dirpath) {
|
||||
absl::string_view dirpath) {
|
||||
dump_per_pass_hlo_proto_to_ = string(dirpath);
|
||||
return *this;
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ limitations under the License.
|
||||
#ifndef TENSORFLOW_COMPILER_XLA_CLIENT_EXECUTABLE_BUILD_OPTIONS_H_
|
||||
#define TENSORFLOW_COMPILER_XLA_CLIENT_EXECUTABLE_BUILD_OPTIONS_H_
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "tensorflow/compiler/xla/service/device_memory_allocator.h"
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
|
||||
namespace xla {
|
||||
|
||||
@ -62,19 +62,19 @@ class ExecutableBuildOptions {
|
||||
// If set, specifies a dirpath to dump the end-of-optimization-pipeline HLO
|
||||
// protobuf to (as in DebugOptions).
|
||||
ExecutableBuildOptions& set_dump_optimized_hlo_proto_to(
|
||||
tensorflow::StringPiece dirpath);
|
||||
absl::string_view dirpath);
|
||||
const absl::optional<string>& dump_optimized_hlo_proto_to() const;
|
||||
|
||||
// If set, specifies a dirpath to dump the start-of-optimization-pipeline HLO
|
||||
// protobuf to (as in DebugOptions).
|
||||
ExecutableBuildOptions& set_dump_unoptimized_hlo_proto_to(
|
||||
tensorflow::StringPiece dirpath);
|
||||
absl::string_view dirpath);
|
||||
const absl::optional<string>& dump_unoptimized_hlo_proto_to() const;
|
||||
|
||||
// If set, specifies a dirpath to dump the per-pass-in-pipeline HLO protobufs
|
||||
// to (as in DebugOptions).
|
||||
ExecutableBuildOptions& set_dump_per_pass_hlo_proto_to(
|
||||
tensorflow::StringPiece dirpath);
|
||||
absl::string_view dirpath);
|
||||
const absl::optional<string>& dump_per_pass_hlo_proto_to() const;
|
||||
|
||||
// If true, specifies that we should record an HLO profile during execution
|
||||
@ -83,7 +83,7 @@ class ExecutableBuildOptions {
|
||||
ExecutableBuildOptions& set_hlo_profile(bool enabled);
|
||||
absl::optional<bool> hlo_profile() const;
|
||||
|
||||
void add_disabled_hlo_pass(tensorflow::StringPiece pass_name) {
|
||||
void add_disabled_hlo_pass(absl::string_view pass_name) {
|
||||
disabled_hlo_passes_.push_back(std::string(pass_name));
|
||||
}
|
||||
const tensorflow::gtl::ArraySlice<std::string> disabled_hlo_passes() const {
|
||||
|
@ -31,7 +31,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/compiler/xla/client:xla_builder",
|
||||
"//tensorflow/compiler/xla/client:xla_computation",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -221,5 +221,6 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/client:xla_computation",
|
||||
"//tensorflow/compiler/xla/tests:test_utils",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/client/lib/constants.h"
|
||||
#include "tensorflow/compiler/xla/client/xla_builder.h"
|
||||
#include "tensorflow/compiler/xla/client/xla_computation.h"
|
||||
@ -24,7 +25,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/status_macros.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
|
||||
namespace xla {
|
||||
namespace {
|
||||
@ -39,7 +39,7 @@ XlaComputation CreateScalarComputation(const string& name, PrimitiveType type,
|
||||
b = builder->CreateSubBuilder(name);
|
||||
} else {
|
||||
b = builder->CreateSubBuilder(
|
||||
tensorflow::strings::StrCat(name, "_", PrimitiveType_Name(type)));
|
||||
absl::StrCat(name, "_", PrimitiveType_Name(type)));
|
||||
}
|
||||
|
||||
const Shape scalar = ShapeUtil::MakeShape(type, {});
|
||||
|
@ -15,6 +15,7 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/compiler/xla/client/lib/testing.h"
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/client/xla_builder.h"
|
||||
#include "tensorflow/compiler/xla/execution_options_util.h"
|
||||
#include "tensorflow/compiler/xla/literal.h"
|
||||
@ -23,7 +24,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/tests/test_utils.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/protobuf.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
@ -61,8 +61,7 @@ XlaOp BuildFakeDataOpOnDevice(const Shape& shape, XlaBuilder* builder) {
|
||||
|
||||
std::unique_ptr<GlobalData> MakeFakeDataViaDeviceOrDie(const Shape& shape,
|
||||
Client* client) {
|
||||
XlaBuilder b(
|
||||
tensorflow::strings::StrCat("make_fake_", ShapeUtil::HumanString(shape)));
|
||||
XlaBuilder b(absl::StrCat("make_fake_", ShapeUtil::HumanString(shape)));
|
||||
BuildFakeDataOpOnDevice(shape, &b);
|
||||
XlaComputation computation = b.Build().ConsumeValueOrDie();
|
||||
|
||||
|
@ -23,6 +23,8 @@ limitations under the License.
|
||||
|
||||
#include "absl/algorithm/container.h"
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/client/sharding_builder.h"
|
||||
#include "tensorflow/compiler/xla/client/xla_computation.h"
|
||||
#include "tensorflow/compiler/xla/execution_options_util.h"
|
||||
@ -31,12 +33,11 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/service/shape_inference.h"
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/core/lib/gtl/flatset.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/mutex.h"
|
||||
|
||||
namespace xla {
|
||||
|
||||
using tensorflow::strings::StrCat;
|
||||
using absl::StrCat;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -223,8 +224,7 @@ XlaComputation XlaBuilder::BuildAndNoteError() {
|
||||
auto build_status = Build();
|
||||
if (!build_status.ok()) {
|
||||
parent_builder_->ReportError(
|
||||
AddStatus(build_status.status(),
|
||||
tensorflow::strings::StrCat("error from: ", name_)));
|
||||
AddStatus(build_status.status(), absl::StrCat("error from: ", name_)));
|
||||
return {};
|
||||
}
|
||||
return build_status.ConsumeValueOrDie();
|
||||
@ -1013,7 +1013,7 @@ StatusOr<Window> XlaBuilder::MakeWindow(
|
||||
return Status::OK();
|
||||
} else {
|
||||
return InvalidArgument(
|
||||
"%s", tensorflow::strings::StrCat(
|
||||
"%s", absl::StrCat(
|
||||
"Window has different number of window dimensions than of ",
|
||||
x_name,
|
||||
"\nNumber of window dimensions: ", window_dimensions.size(),
|
||||
@ -1283,7 +1283,7 @@ XlaOp XlaBuilder::CustomCall(const string& call_target_name,
|
||||
const Shape& shape) {
|
||||
return ReportErrorOrReturn([&]() -> StatusOr<XlaOp> {
|
||||
HloInstructionProto instr;
|
||||
if (tensorflow::str_util::StartsWith(call_target_name, "$")) {
|
||||
if (absl::StartsWith(call_target_name, "$")) {
|
||||
return InvalidArgument(
|
||||
"Invalid custom_call_target \"%s\": Call targets that start with '$' "
|
||||
"are reserved for internal use.",
|
||||
|
@ -21,6 +21,7 @@ limitations under the License.
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/compiler/xla/client/padding.h"
|
||||
#include "tensorflow/compiler/xla/client/xla_computation.h"
|
||||
#include "tensorflow/compiler/xla/literal.h"
|
||||
@ -32,7 +33,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/statusor.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/gtl/array_slice.h"
|
||||
#include "tensorflow/core/lib/gtl/flatset.h"
|
||||
#include "tensorflow/core/platform/macros.h"
|
||||
|
@ -21,8 +21,8 @@ limitations under the License.
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/stream_executor_no_cuda.h"
|
||||
|
||||
namespace xla {
|
||||
@ -30,8 +30,8 @@ namespace xla {
|
||||
// Returns a string that represents the device in terms of platform and ordinal;
|
||||
// e.g. the first CUDA device will be "cuda:0"
|
||||
string DeviceIdentifier(se::StreamExecutor* stream_exec) {
|
||||
return tensorflow::strings::StrCat(stream_exec->platform()->Name(), ":",
|
||||
stream_exec->device_ordinal());
|
||||
return absl::StrCat(stream_exec->platform()->Name(), ":",
|
||||
stream_exec->device_ordinal());
|
||||
}
|
||||
|
||||
} // namespace xla
|
||||
|
@ -23,6 +23,7 @@ limitations under the License.
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/protobuf_util.h"
|
||||
#include "tensorflow/compiler/xla/shape_util.h"
|
||||
#include "tensorflow/compiler/xla/status_macros.h"
|
||||
@ -32,7 +33,6 @@ limitations under the License.
|
||||
#include "tensorflow/core/lib/hash/hash.h"
|
||||
#include "tensorflow/core/lib/strings/numbers.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/protobuf.h"
|
||||
|
||||
@ -403,11 +403,10 @@ Layout CreateDefaultLayoutForRank(int64 rank) {
|
||||
|
||||
/* static */ string LayoutUtil::HumanString(const Layout& layout) {
|
||||
if (IsSparse(layout)) {
|
||||
return tensorflow::strings::StrCat("sparse{", layout.max_sparse_elements(),
|
||||
"}");
|
||||
return absl::StrCat("sparse{", layout.max_sparse_elements(), "}");
|
||||
}
|
||||
CHECK(IsDense(layout));
|
||||
return tensorflow::strings::StrCat(
|
||||
return absl::StrCat(
|
||||
"{", tensorflow::str_util::Join(layout.minor_to_major(), ","), "}");
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/service:hlo",
|
||||
"//tensorflow/core:framework_internal",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -73,5 +74,6 @@ tf_cc_test(
|
||||
"//tensorflow/core:framework_internal",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:test",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||
|
||||
#include <mutex> // NOLINT(build/c++11): only using std::call_once, not mutex.
|
||||
#include <vector>
|
||||
#include "absl/strings/str_split.h"
|
||||
#include "tensorflow/compiler/xla/legacy_flags/debug_options_parsers.h"
|
||||
#include "tensorflow/compiler/xla/legacy_flags/parse_flags_from_env.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
@ -87,7 +88,7 @@ void AllocateFlags() {
|
||||
// Custom "sub-parser" lambda for xla_disable_hlo_passes.
|
||||
auto setter_for_xla_disable_hlo_passes = [](string comma_separated_values) {
|
||||
std::vector<string> disabled_passes =
|
||||
tensorflow::str_util::Split(comma_separated_values, ',');
|
||||
absl::StrSplit(comma_separated_values, ',');
|
||||
for (const auto& passname : disabled_passes) {
|
||||
flag_values->add_xla_disable_hlo_passes(passname);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||
#define TENSORFLOW_COMPILER_XLA_LEGACY_FLAGS_DEBUG_OPTIONS_PARSERS_H_
|
||||
|
||||
#include <vector>
|
||||
#include "absl/strings/str_split.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_opcode.h"
|
||||
#include "tensorflow/compiler/xla/xla.pb.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
@ -30,7 +31,7 @@ template <typename T>
|
||||
void parse_xla_backend_extra_options(T* extra_options_map,
|
||||
string comma_separated_values) {
|
||||
std::vector<string> extra_options_parts =
|
||||
tensorflow::str_util::Split(comma_separated_values, ',');
|
||||
absl::StrSplit(comma_separated_values, ',');
|
||||
|
||||
// The flag contains a comma-separated list of options; some options
|
||||
// have arguments following "=", some don't.
|
||||
@ -59,8 +60,7 @@ void parse_xla_backend_extra_options(T* extra_options_map,
|
||||
inline bool parse_xla_reduce_precision_option(
|
||||
HloReducePrecisionOptions* options, string option_string) {
|
||||
// Split off "LOCATION" from remainder of string.
|
||||
std::vector<string> eq_split =
|
||||
tensorflow::str_util::Split(option_string, '=');
|
||||
std::vector<string> eq_split = absl::StrSplit(option_string, '=');
|
||||
if (eq_split.size() != 2) {
|
||||
return false;
|
||||
}
|
||||
@ -80,8 +80,7 @@ inline bool parse_xla_reduce_precision_option(
|
||||
}
|
||||
|
||||
// Split off "E,M" from remainder of string.
|
||||
std::vector<string> colon_split =
|
||||
tensorflow::str_util::Split(eq_split[1], ':');
|
||||
std::vector<string> colon_split = absl::StrSplit(eq_split[1], ':');
|
||||
if (colon_split.size() != 2) {
|
||||
return false;
|
||||
}
|
||||
@ -98,8 +97,7 @@ inline bool parse_xla_reduce_precision_option(
|
||||
|
||||
// Split off OPS comma-separated list from remainder of string, if the
|
||||
// remainder exists.
|
||||
std::vector<string> semicolon_split =
|
||||
tensorflow::str_util::Split(colon_split[1], ';');
|
||||
std::vector<string> semicolon_split = absl::StrSplit(colon_split[1], ';');
|
||||
if (semicolon_split.size() > 2) {
|
||||
return false;
|
||||
}
|
||||
@ -113,8 +111,7 @@ inline bool parse_xla_reduce_precision_option(
|
||||
options->add_opcodes_to_suffix(i);
|
||||
}
|
||||
} else {
|
||||
std::vector<string> opcodes =
|
||||
tensorflow::str_util::Split(opcode_string, ',');
|
||||
std::vector<string> opcodes = absl::StrSplit(opcode_string, ',');
|
||||
for (const string& opcode : opcodes) {
|
||||
bool found = false;
|
||||
for (int i = 0; i < HloOpcodeCount(); i++) {
|
||||
@ -132,8 +129,7 @@ inline bool parse_xla_reduce_precision_option(
|
||||
|
||||
// Process the NAMES string, if it exists.
|
||||
if (semicolon_split.size() == 2) {
|
||||
std::vector<string> opnames =
|
||||
tensorflow::str_util::Split(semicolon_split[1], ',');
|
||||
std::vector<string> opnames = absl::StrSplit(semicolon_split[1], ',');
|
||||
for (const string& opname : opnames) {
|
||||
if (opname.length() > 0) {
|
||||
options->add_opname_substrings_to_suffix(opname);
|
||||
|
@ -23,6 +23,7 @@ limitations under the License.
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/index_util.h"
|
||||
#include "tensorflow/compiler/xla/shape_util.h"
|
||||
#include "tensorflow/compiler/xla/status_macros.h"
|
||||
@ -32,13 +33,12 @@ limitations under the License.
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/hash/hash.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/lib/strings/stringprintf.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
using absl::StrCat;
|
||||
using tensorflow::strings::Printf;
|
||||
using tensorflow::strings::StrCat;
|
||||
|
||||
namespace xla {
|
||||
|
||||
|
@ -26,6 +26,7 @@ limitations under the License.
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/compiler/xla/array2d.h"
|
||||
#include "tensorflow/compiler/xla/array3d.h"
|
||||
#include "tensorflow/compiler/xla/array4d.h"
|
||||
@ -40,7 +41,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
#include "tensorflow/core/lib/core/bitmap.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/gtl/array_slice.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/macros.h"
|
||||
|
@ -19,16 +19,16 @@ limitations under the License.
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/literal_util.h"
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/core/lib/core/casts.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/env.h"
|
||||
|
||||
using absl::StrAppend;
|
||||
using absl::StrCat;
|
||||
using tensorflow::strings::Appendf;
|
||||
using tensorflow::strings::Printf;
|
||||
using tensorflow::strings::StrAppend;
|
||||
using tensorflow::strings::StrCat;
|
||||
|
||||
namespace xla {
|
||||
namespace literal_comparison {
|
||||
|
@ -18,6 +18,8 @@ limitations under the License.
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/tf2xla/shape_util.h"
|
||||
#include "tensorflow/compiler/xla/array3d.h"
|
||||
#include "tensorflow/compiler/xla/array4d.h"
|
||||
@ -1324,8 +1326,8 @@ TEST_F(LiteralUtilTest, BitcastConvertBetweenInvalidTypes) {
|
||||
auto literal = LiteralUtil::CreateR0<uint32>(1234);
|
||||
Status status = literal->BitcastConvert(F64).status();
|
||||
EXPECT_NE(Status::OK(), status);
|
||||
EXPECT_TRUE(tensorflow::str_util::StrContains(status.error_message(),
|
||||
"bit widths are different"));
|
||||
EXPECT_TRUE(
|
||||
absl::StrContains(status.error_message(), "bit widths are different"));
|
||||
}
|
||||
|
||||
TEST_F(LiteralUtilTest, CopyFromProto_Bool) {
|
||||
@ -1819,21 +1821,20 @@ TEST_F(LiteralUtilTest, GetSparseElementAsString) {
|
||||
"false");
|
||||
ASSERT_EQ(LiteralUtil::CreateSparse<int64>(dimensions, indices, {1, 2, 3})
|
||||
->GetSparseElementAsString(1),
|
||||
tensorflow::strings::StrCat(int64{2}));
|
||||
absl::StrCat(int64{2}));
|
||||
ASSERT_EQ(
|
||||
LiteralUtil::CreateSparse<double>(dimensions, indices, {1.0, 2.0, 3.0})
|
||||
->GetSparseElementAsString(1),
|
||||
tensorflow::strings::StrCat(double{2.0}));
|
||||
absl::StrCat(double{2.0}));
|
||||
ASSERT_EQ(LiteralUtil::CreateSparse<half>(dimensions, indices,
|
||||
{half{1.0}, half{2.0}, half{3.0}})
|
||||
->GetSparseElementAsString(1),
|
||||
tensorflow::strings::StrCat(static_cast<float>(half{2.0})));
|
||||
ASSERT_EQ(
|
||||
LiteralUtil::CreateSparse<complex64>(
|
||||
dimensions, indices,
|
||||
std::vector<complex64>{{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}})
|
||||
->GetSparseElementAsString(1),
|
||||
tensorflow::strings::StrCat("(", float{3.0}, ", ", float{4.0}, ")"));
|
||||
absl::StrCat(static_cast<float>(half{2.0})));
|
||||
ASSERT_EQ(LiteralUtil::CreateSparse<complex64>(
|
||||
dimensions, indices,
|
||||
std::vector<complex64>{{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}})
|
||||
->GetSparseElementAsString(1),
|
||||
absl::StrCat("(", float{3.0}, ", ", float{4.0}, ")"));
|
||||
}
|
||||
|
||||
TEST_F(LiteralUtilTest, BroadcastVectorToMatrix0) {
|
||||
|
@ -23,6 +23,7 @@ limitations under the License.
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/index_util.h"
|
||||
#include "tensorflow/compiler/xla/shape_util.h"
|
||||
#include "tensorflow/compiler/xla/status_macros.h"
|
||||
@ -32,13 +33,12 @@ limitations under the License.
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/hash/hash.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/lib/strings/stringprintf.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/mem.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
using tensorflow::strings::StrCat;
|
||||
using absl::StrCat;
|
||||
|
||||
namespace xla {
|
||||
|
||||
@ -287,7 +287,7 @@ std::unique_ptr<Literal> ConvertType(LiteralSlice literal) {
|
||||
}
|
||||
|
||||
/* static */ std::unique_ptr<Literal> LiteralUtil::CreateR1U8(
|
||||
tensorflow::StringPiece value) {
|
||||
absl::string_view value) {
|
||||
auto literal = absl::make_unique<Literal>(
|
||||
ShapeUtil::MakeShape(U8, {static_cast<int64>(value.size())}));
|
||||
for (int i = 0; i < value.size(); ++i) {
|
||||
|
@ -28,6 +28,7 @@ limitations under the License.
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/compiler/xla/array2d.h"
|
||||
#include "tensorflow/compiler/xla/array3d.h"
|
||||
#include "tensorflow/compiler/xla/array4d.h"
|
||||
@ -43,7 +44,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
#include "tensorflow/core/lib/core/bitmap.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/gtl/array_slice.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/macros.h"
|
||||
@ -187,7 +187,7 @@ class LiteralUtil {
|
||||
const Array4D<NativeT>& values, const Layout& layout);
|
||||
|
||||
// Creates a new vector of U8s literal value from a string.
|
||||
static std::unique_ptr<Literal> CreateR1U8(tensorflow::StringPiece value);
|
||||
static std::unique_ptr<Literal> CreateR1U8(absl::string_view value);
|
||||
|
||||
// Creates a linspace-populated literal with the given number of rows and
|
||||
// columns.
|
||||
|
@ -18,6 +18,7 @@ limitations under the License.
|
||||
#include <cctype>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/core/lib/strings/stringprintf.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
@ -84,7 +85,7 @@ void MetricTableReport::WriteReportToInfoLog(double expected_metric_sum) {
|
||||
if (end_of_line == string::npos) {
|
||||
end_of_line = report.size();
|
||||
}
|
||||
tensorflow::StringPiece line(report.data() + pos, end_of_line - pos);
|
||||
absl::string_view line(report.data() + pos, end_of_line - pos);
|
||||
|
||||
// TODO(b/34779244): Figure out how to do this without the verbose log-line
|
||||
// prefix. The usual way didn't compile on open source.
|
||||
@ -152,8 +153,8 @@ void MetricTableReport::AppendCategoryTable() {
|
||||
if (text.empty()) {
|
||||
text = "[no category]";
|
||||
}
|
||||
tensorflow::strings::StrAppend(&text, " (", category.entries.size(), " ",
|
||||
entry_name_, ")");
|
||||
absl::StrAppend(&text, " (", category.entries.size(), " ", entry_name_,
|
||||
")");
|
||||
AppendTableRow(text, category.metric_sum, metric_sum);
|
||||
|
||||
// Show the top entries in the category.
|
||||
@ -177,9 +178,9 @@ void MetricTableReport::AppendCategoryTable() {
|
||||
}
|
||||
const int64 remaining_categories = categories.size() - categories_shown;
|
||||
if (remaining_categories > 0) {
|
||||
AppendTableRow(tensorflow::strings::StrCat("... (", remaining_categories,
|
||||
" more categories)"),
|
||||
expected_metric_sum_ - metric_sum, expected_metric_sum_);
|
||||
AppendTableRow(
|
||||
absl::StrCat("... (", remaining_categories, " more categories)"),
|
||||
expected_metric_sum_ - metric_sum, expected_metric_sum_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,9 +207,9 @@ void MetricTableReport::AppendEntryTable() {
|
||||
}
|
||||
const int64 remaining_entries = entries_.size() - entries_shown;
|
||||
if (remaining_entries > 0) {
|
||||
AppendTableRow(tensorflow::strings::StrCat("... (", remaining_entries,
|
||||
" more ", entry_name_, ")"),
|
||||
expected_metric_sum_ - metric_sum, expected_metric_sum_);
|
||||
AppendTableRow(
|
||||
absl::StrCat("... (", remaining_entries, " more ", entry_name_, ")"),
|
||||
expected_metric_sum_ - metric_sum, expected_metric_sum_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,10 +242,10 @@ double MetricTableReport::UnaccountedMetric() {
|
||||
|
||||
string MetricTableReport::MetricString(double metric) {
|
||||
// Round to integer and stringify.
|
||||
string s1 = tensorflow::strings::StrCat(std::llround(metric));
|
||||
string s1 = absl::StrCat(std::llround(metric));
|
||||
|
||||
// Code below commafies the string, e.g. "1234" becomes "1,234".
|
||||
tensorflow::StringPiece sp1(s1);
|
||||
absl::string_view sp1(s1);
|
||||
string output;
|
||||
// Copy leading non-digit characters unconditionally.
|
||||
// This picks up the leading sign.
|
||||
|
@ -18,9 +18,9 @@ limitations under the License.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
|
||||
namespace xla {
|
||||
|
||||
@ -108,7 +108,7 @@ class MetricTableReport {
|
||||
// Append all parameters to the report.
|
||||
template <typename... Args>
|
||||
void AppendLine(Args... args) {
|
||||
tensorflow::strings::StrAppend(&report_, std::forward<Args>(args)..., "\n");
|
||||
absl::StrAppend(&report_, std::forward<Args>(args)..., "\n");
|
||||
}
|
||||
|
||||
// Represents a set of entries with the same category_text.
|
||||
|
@ -39,6 +39,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/python:numpy_lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -109,6 +109,7 @@ limitations under the License.
|
||||
// Must be included first
|
||||
#include "tensorflow/python/lib/core/numpy.h"
|
||||
|
||||
#include "third_party/absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/literal.h"
|
||||
#include "tensorflow/compiler/xla/shape_util.h"
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
@ -896,7 +897,7 @@ tensorflow::ImportNumpy();
|
||||
if (o != Py_None) {
|
||||
StatusOr<Shape> statusor = numpy::XlaShapeFromPyShape(o);
|
||||
if (!statusor.ok()) {
|
||||
PyErr_SetString(PyExc_TypeError, tensorflow::strings::StrCat("ExecutableBuildOptions.result_shape could not be created from Python shape value: ", statusor.status().ToString()).c_str());
|
||||
PyErr_SetString(PyExc_TypeError, absl::StrCat("ExecutableBuildOptions.result_shape could not be created from Python shape value: ", statusor.status().ToString()).c_str());
|
||||
Py_DECREF(o);
|
||||
SWIG_fail;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "tensorflow/compiler/xla/python/numpy_bridge.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/literal_util.h"
|
||||
#include "tensorflow/compiler/xla/shape_util.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
@ -191,8 +192,8 @@ StatusOr<Shape> XlaShapeFromPyShape(PyObject* o) {
|
||||
PyObject* result =
|
||||
PyObject_CallMethod(o, const_cast<char*>(method.c_str()), nullptr);
|
||||
if (result == nullptr) {
|
||||
return error(tensorflow::strings::StrCat(
|
||||
"Failed to call method of shape object:", method));
|
||||
return error(
|
||||
absl::StrCat("Failed to call method of shape object:", method));
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
@ -176,6 +176,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/algorithm:container",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -241,6 +242,7 @@ cc_library(
|
||||
"@com_google_absl//absl/algorithm:container",
|
||||
"@com_google_absl//absl/container:inlined_vector",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
)
|
||||
@ -320,6 +322,7 @@ cc_library(
|
||||
"@com_google_absl//absl/algorithm:container",
|
||||
"@com_google_absl//absl/container:inlined_vector",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -346,7 +349,7 @@ cc_library(
|
||||
deps = [
|
||||
":hlo",
|
||||
"//tensorflow/compiler/xla:shape_util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -460,6 +463,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -587,6 +591,7 @@ cc_library(
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -629,6 +634,7 @@ cc_library(
|
||||
"//tensorflow/core:ptr_util",
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
@ -662,6 +668,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -684,6 +691,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:lib_internal",
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -735,6 +743,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -832,6 +841,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -851,6 +861,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -886,6 +897,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:lib_internal",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -896,6 +908,7 @@ cc_library(
|
||||
deps = [
|
||||
"//tensorflow/compiler/xla:types",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -974,6 +987,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:lib_internal",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1113,6 +1127,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1199,6 +1214,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/service:hlo",
|
||||
"//tensorflow/compiler/xla/service:hlo_pass",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1215,6 +1231,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:util",
|
||||
"@com_google_absl//absl/algorithm:container",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1330,6 +1347,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/algorithm:container",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
)
|
||||
@ -1355,6 +1373,7 @@ tf_cc_test(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:test",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1419,6 +1438,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:types",
|
||||
"//tensorflow/compiler/xla:util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1457,6 +1477,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1497,6 +1518,7 @@ cc_library(
|
||||
":while_loop_analysis",
|
||||
"//tensorflow/compiler/xla:statusor",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
)
|
||||
@ -1511,6 +1533,7 @@ tf_cc_test(
|
||||
"//tensorflow/compiler/xla/tests:hlo_verified_test_base",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:test",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1701,6 +1724,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
alwayslink = True, # Contains per-platform computation placer registration
|
||||
)
|
||||
@ -1714,6 +1738,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:types",
|
||||
"//tensorflow/compiler/xla:util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1807,6 +1832,7 @@ tf_cc_test(
|
||||
"//tensorflow/compiler/xla/tests:hlo_test_base",
|
||||
"//tensorflow/compiler/xla/tests:xla_internal_test_main",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1839,6 +1865,7 @@ tf_cc_binary(
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1871,6 +1898,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:lib_internal",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1898,6 +1926,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:lib_internal",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1916,6 +1945,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1936,6 +1966,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/container:inlined_vector",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1978,6 +2009,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2014,6 +2046,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:util",
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2034,6 +2067,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:util",
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2093,6 +2127,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/container:inlined_vector",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2144,6 +2179,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2166,6 +2202,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:types",
|
||||
"//tensorflow/compiler/xla:util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2278,6 +2315,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/container:inlined_vector",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2400,6 +2438,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2633,6 +2672,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:lib_internal",
|
||||
"@com_google_absl//absl/algorithm:container",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@llvm//:core",
|
||||
"@llvm//:transform_utils",
|
||||
],
|
||||
@ -2668,6 +2708,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:xla_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
)
|
||||
@ -2681,6 +2722,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:types",
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2719,6 +2761,7 @@ cc_library(
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2752,6 +2795,7 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:lib_internal",
|
||||
"//tensorflow/core:regexp_internal",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
alwayslink = 1,
|
||||
@ -2769,6 +2813,7 @@ tf_cc_test(
|
||||
"//tensorflow/compiler/xla/tests:test_utils",
|
||||
"//tensorflow/compiler/xla/tests:xla_internal_test_main", # fixdeps: keep
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2997,8 +3042,8 @@ cc_library(
|
||||
":hlo_creation_utils",
|
||||
":tuple_util",
|
||||
"//tensorflow/compiler/xla:literal_util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/algorithm:container",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -3114,6 +3159,7 @@ cc_library(
|
||||
"//tensorflow/core:ptr_util",
|
||||
"@com_google_absl//absl/algorithm:container",
|
||||
"@com_google_absl//absl/container:inlined_vector",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
)
|
||||
@ -3150,6 +3196,7 @@ cc_library(
|
||||
"//tensorflow/core:lib_internal",
|
||||
"@com_google_absl//absl/algorithm:container",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -3164,6 +3211,7 @@ tf_cc_test(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:test",
|
||||
"//tensorflow/core:test_main", # fixdeps: keep
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -3182,6 +3230,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:regexp_internal",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
)
|
||||
|
@ -24,6 +24,7 @@ limitations under the License.
|
||||
|
||||
#include "absl/algorithm/container.h"
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "tensorflow/compiler/xla/layout_util.h"
|
||||
#include "tensorflow/compiler/xla/literal.h"
|
||||
@ -1989,9 +1990,9 @@ Status AlgebraicSimplifierVisitor::HandleReduceWindow(
|
||||
|
||||
VLOG(10) << "Considering folding Pad: " << pad->ToString()
|
||||
<< "\ninto reduce-window: " << reduce_window->ToString()
|
||||
<< (convert != nullptr ? tensorflow::strings::StrCat(
|
||||
"\nvia convert: ", convert->ToString())
|
||||
: "");
|
||||
<< (convert != nullptr
|
||||
? absl::StrCat("\nvia convert: ", convert->ToString())
|
||||
: "");
|
||||
|
||||
// Do not fold interior padding into ReduceWindow since the backends do not
|
||||
// support it.
|
||||
|
@ -47,7 +47,7 @@ class AlgebraicSimplifier : public HloPassInterface {
|
||||
enable_dot_strength_reduction_(enable_dot_strength_reduction),
|
||||
enable_conv_simplification_(enable_conv_simplification) {}
|
||||
~AlgebraicSimplifier() override = default;
|
||||
tensorflow::StringPiece name() const override { return "algsimp"; }
|
||||
absl::string_view name() const override { return "algsimp"; }
|
||||
|
||||
// Run algebraic simplification on the given computation. Returns whether the
|
||||
// computation was changed.
|
||||
|
@ -19,6 +19,7 @@ limitations under the License.
|
||||
#include <utility>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/layout_util.h"
|
||||
#include "tensorflow/compiler/xla/literal.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_computation.h"
|
||||
@ -2143,7 +2144,7 @@ TEST_F(AlgebraicSimplifierTest, ConvertConvToMatmul) {
|
||||
root->operand(0)->opcode() == HloOpcode::kDot) {
|
||||
auto lhs_shape = root->operand(0)->operand(0)->shape();
|
||||
auto rhs_shape = root->operand(0)->operand(1)->shape();
|
||||
return tensorflow::strings::StrCat(
|
||||
return absl::StrCat(
|
||||
tensorflow::str_util::Join(lhs_shape.dimensions(), "x"), " DOT ",
|
||||
tensorflow::str_util::Join(rhs_shape.dimensions(), "x"));
|
||||
}
|
||||
@ -2660,11 +2661,11 @@ struct PadReduceWindowEffectiveBroadcastCase {
|
||||
bool should_become_broadcast;
|
||||
|
||||
string ToTestCaseName() const {
|
||||
return tensorflow::strings::StrCat(
|
||||
tensorflow::str_util::Join(input_spatials, ","), ";",
|
||||
tensorflow::str_util::Join(symmetric_pad_spatials, ","), ";",
|
||||
tensorflow::str_util::Join(reduce_window_spatials, ","), ";", prepend_a,
|
||||
";", should_become_broadcast);
|
||||
return absl::StrCat(tensorflow::str_util::Join(input_spatials, ","), ";",
|
||||
tensorflow::str_util::Join(symmetric_pad_spatials, ","),
|
||||
";",
|
||||
tensorflow::str_util::Join(reduce_window_spatials, ","),
|
||||
";", prepend_a, ";", should_become_broadcast);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -18,6 +18,7 @@ limitations under the License.
|
||||
#include <utility>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/map_util.h"
|
||||
#include "tensorflow/compiler/xla/service/device_memory_allocator.h"
|
||||
#include "tensorflow/compiler/xla/service/transfer_manager.h"
|
||||
@ -25,7 +26,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/status_macros.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
|
||||
namespace xla {
|
||||
|
@ -21,6 +21,7 @@ limitations under the License.
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/service/compiler.h"
|
||||
#include "tensorflow/compiler/xla/service/computation_placer.h"
|
||||
#include "tensorflow/compiler/xla/service/device_memory_allocator.h"
|
||||
@ -29,7 +30,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/statusor.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/core/lib/gtl/array_slice.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/mutex.h"
|
||||
#include "tensorflow/core/platform/stream_executor_no_cuda.h"
|
||||
#include "tensorflow/core/platform/thread_annotations.h"
|
||||
@ -130,7 +130,7 @@ class Backend {
|
||||
|
||||
// Return a string identifier for the given device, eg: "GPU:3".
|
||||
string device_name(int device_ordinal) const {
|
||||
return tensorflow::strings::StrCat(platform_->Name(), ":", device_ordinal);
|
||||
return absl::StrCat(platform_->Name(), ":", device_ordinal);
|
||||
}
|
||||
|
||||
// Returns true if the devices with the given ordinals are equivalent from
|
||||
|
@ -78,7 +78,7 @@ BatchDotSimplification::ElideDegenerateBatchDimensionFromBatchDot(
|
||||
return true;
|
||||
}
|
||||
|
||||
tensorflow::StringPiece BatchDotSimplification::name() const {
|
||||
absl::string_view BatchDotSimplification::name() const {
|
||||
return "batch-dot-simplification";
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace xla {
|
||||
class BatchDotSimplification : public HloPassInterface {
|
||||
public:
|
||||
StatusOr<bool> Run(HloModule* module) override;
|
||||
tensorflow::StringPiece name() const override;
|
||||
absl::string_view name() const override;
|
||||
|
||||
private:
|
||||
StatusOr<bool> ElideDegenerateBatchDimensionFromBatchDot(
|
||||
|
@ -36,7 +36,7 @@ class BatchNormExpander : public HloPassInterface {
|
||||
rewrite_inference_op_(rewrite_inference_op),
|
||||
rewrite_grad_op_(rewrite_grad_op) {}
|
||||
~BatchNormExpander() = default;
|
||||
tensorflow::StringPiece name() const override { return "batchnorm_expander"; }
|
||||
absl::string_view name() const override { return "batchnorm_expander"; }
|
||||
|
||||
// Run operation expander on the given computation. Returns whether the
|
||||
// computation was changed.
|
||||
|
@ -37,7 +37,7 @@ class BFloat16ConversionFolding : public HloPassInterface {
|
||||
: bfloat16_support_(bfloat16_support) {}
|
||||
|
||||
~BFloat16ConversionFolding() override = default;
|
||||
tensorflow::StringPiece name() const override { return "bfloat16-fold"; }
|
||||
absl::string_view name() const override { return "bfloat16-fold"; }
|
||||
|
||||
// Run BF16 conversion folding on the given computation. Returns whether the
|
||||
// computation was changed.
|
||||
|
@ -31,7 +31,7 @@ class BFloat16Normalization : public HloPassInterface {
|
||||
: bfloat16_support_(bfloat16_support) {}
|
||||
|
||||
~BFloat16Normalization() override = default;
|
||||
tensorflow::StringPiece name() const override { return "bf16-normalization"; }
|
||||
absl::string_view name() const override { return "bf16-normalization"; }
|
||||
|
||||
// Run BF16 normalization on the given computation. Returns whether the
|
||||
// computation was changed.
|
||||
@ -54,7 +54,7 @@ class BFloat16MixedPrecisionRemoval : public HloPassInterface {
|
||||
|
||||
~BFloat16MixedPrecisionRemoval() override = default;
|
||||
|
||||
tensorflow::StringPiece name() const override {
|
||||
absl::string_view name() const override {
|
||||
return "bf16-mixed-precision-removal";
|
||||
}
|
||||
|
||||
|
@ -64,9 +64,7 @@ class BFloat16Propagation : public HloPassInterface {
|
||||
|
||||
~BFloat16Propagation() override = default;
|
||||
|
||||
tensorflow::StringPiece name() const override {
|
||||
return "bfloat16-propagation";
|
||||
}
|
||||
absl::string_view name() const override { return "bfloat16-propagation"; }
|
||||
|
||||
// Runs the pass on the given module. Returns whether the module was changed
|
||||
// (precision reductions were added).
|
||||
|
@ -23,6 +23,7 @@ limitations under the License.
|
||||
#include <utility>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/map_util.h"
|
||||
#include "tensorflow/compiler/xla/service/buffer_value_containers.h"
|
||||
#include "tensorflow/compiler/xla/service/heap_simulator.h"
|
||||
@ -37,17 +38,16 @@ limitations under the License.
|
||||
#include "tensorflow/core/lib/hash/hash.h"
|
||||
#include "tensorflow/core/lib/strings/numbers.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/lib/strings/stringprintf.h"
|
||||
|
||||
namespace xla {
|
||||
|
||||
using ::absl::StrAppend;
|
||||
using ::tensorflow::gtl::FlatMap;
|
||||
using ::tensorflow::gtl::FlatSet;
|
||||
using ::tensorflow::strings::Appendf;
|
||||
using ::tensorflow::strings::HumanReadableNumBytes;
|
||||
using ::tensorflow::strings::Printf;
|
||||
using ::tensorflow::strings::StrAppend;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -236,8 +236,8 @@ size_t BufferAllocation::Slice::Hasher::operator()(Slice s) const {
|
||||
}
|
||||
|
||||
string BufferAllocation::Slice::ToString() const {
|
||||
return tensorflow::strings::StrCat("{index:", index(), ", offset:", offset_,
|
||||
", size:", size_, "}");
|
||||
return absl::StrCat("{index:", index(), ", offset:", offset_,
|
||||
", size:", size_, "}");
|
||||
}
|
||||
|
||||
BufferAllocation::Slice BufferAllocation::GetSlice(
|
||||
@ -678,9 +678,9 @@ string BufferAssignment::Stats::ToString() const {
|
||||
|
||||
string BufferAssignment::ToString() const {
|
||||
string output;
|
||||
tensorflow::strings::StrAppend(&output, "BufferAssignment:\n");
|
||||
absl::StrAppend(&output, "BufferAssignment:\n");
|
||||
for (auto& allocation : allocations_) {
|
||||
tensorflow::strings::StrAppend(&output, allocation.ToString());
|
||||
absl::StrAppend(&output, allocation.ToString());
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
@ -17,11 +17,11 @@ limitations under the License.
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_computation.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_instruction.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
namespace xla {
|
||||
|
@ -18,20 +18,20 @@ limitations under the License.
|
||||
#include <queue>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/map_util.h"
|
||||
#include "tensorflow/compiler/xla/status_macros.h"
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/lib/strings/stringprintf.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
namespace xla {
|
||||
|
||||
using ::absl::StrCat;
|
||||
using ::tensorflow::strings::Appendf;
|
||||
using ::tensorflow::strings::StrCat;
|
||||
|
||||
string CallContextToString(CallContext context) {
|
||||
switch (context) {
|
||||
|
@ -35,7 +35,7 @@ class CallInliner : public HloPassInterface {
|
||||
static StatusOr<InlinedInstructionMap> Inline(HloInstruction* call);
|
||||
|
||||
~CallInliner() override = default;
|
||||
tensorflow::StringPiece name() const override { return "CallInliner"; }
|
||||
absl::string_view name() const override { return "CallInliner"; }
|
||||
|
||||
StatusOr<bool> Run(HloModule* module) override;
|
||||
};
|
||||
|
@ -16,13 +16,13 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/service/channel_tracker.h"
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_computation.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_instruction.h"
|
||||
#include "tensorflow/compiler/xla/status.h"
|
||||
#include "tensorflow/compiler/xla/status_macros.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/mutex.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
@ -19,6 +19,7 @@ limitations under the License.
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/legacy_flags/debug_options_flags.h"
|
||||
#include "tensorflow/compiler/xla/service/backend.h"
|
||||
#include "tensorflow/compiler/xla/service/computation_layout.h"
|
||||
@ -28,7 +29,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/core/lib/gtl/cleanup.h"
|
||||
#include "tensorflow/core/lib/io/path.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/host_info.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/stream_executor_no_cuda.h"
|
||||
@ -76,9 +76,9 @@ CompileOnlyService::CompileAheadOfTime(
|
||||
if (!directory_path.empty()) {
|
||||
HloSnapshot hlo_snapshot;
|
||||
*hlo_snapshot.mutable_hlo()->mutable_hlo_module() = instance.computation;
|
||||
string filename = tensorflow::strings::StrCat(
|
||||
"computation_", instance.computation.id(), "__",
|
||||
instance.computation.entry_computation_name());
|
||||
string filename =
|
||||
absl::StrCat("computation_", instance.computation.id(), "__",
|
||||
instance.computation.entry_computation_name());
|
||||
const string& per_host_path = tensorflow::io::JoinPath(
|
||||
directory_path, tensorflow::port::Hostname());
|
||||
|
||||
|
@ -17,9 +17,9 @@ limitations under the License.
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
|
||||
namespace xla {
|
||||
|
||||
@ -52,9 +52,8 @@ string ComputationLayout::ToString() const {
|
||||
for (auto& param_layout : parameter_layouts_) {
|
||||
params.push_back(param_layout.ToString());
|
||||
}
|
||||
return tensorflow::strings::StrCat("(",
|
||||
tensorflow::str_util::Join(params, ", "),
|
||||
") => ", result_layout_.ToString());
|
||||
return absl::StrCat("(", tensorflow::str_util::Join(params, ", "), ") => ",
|
||||
result_layout_.ToString());
|
||||
}
|
||||
|
||||
} // namespace xla
|
||||
|
@ -20,6 +20,7 @@ limitations under the License.
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/literal.h"
|
||||
#include "tensorflow/compiler/xla/shape_util.h"
|
||||
#include "tensorflow/compiler/xla/status.h"
|
||||
@ -29,12 +30,11 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/stream_executor_no_cuda.h"
|
||||
|
||||
using tensorflow::strings::StrAppend;
|
||||
using tensorflow::strings::StrCat;
|
||||
using absl::StrAppend;
|
||||
using absl::StrCat;
|
||||
|
||||
namespace xla {
|
||||
|
||||
|
@ -19,6 +19,7 @@ limitations under the License.
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/literal.h"
|
||||
#include "tensorflow/compiler/xla/service/call_inliner.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_computation.h"
|
||||
@ -29,7 +30,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
|
||||
namespace xla {
|
||||
|
||||
|
@ -16,10 +16,10 @@ limitations under the License.
|
||||
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_CONDITIONAL_SIMPLIFIER_H_
|
||||
#define TENSORFLOW_COMPILER_XLA_SERVICE_CONDITIONAL_SIMPLIFIER_H_
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_module.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_pass_interface.h"
|
||||
#include "tensorflow/compiler/xla/statusor.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
|
||||
namespace xla {
|
||||
|
||||
@ -27,9 +27,7 @@ namespace xla {
|
||||
// with their true or false computation as appropriate.
|
||||
class ConditionalSimplifier : public HloPassInterface {
|
||||
public:
|
||||
tensorflow::StringPiece name() const override {
|
||||
return "simplify-conditional";
|
||||
}
|
||||
absl::string_view name() const override { return "simplify-conditional"; }
|
||||
StatusOr<bool> Run(HloModule* module) override;
|
||||
};
|
||||
|
||||
|
@ -16,10 +16,10 @@ limitations under the License.
|
||||
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_CONVOLUTION_FEATURE_GROUP_CONVERTER_H_
|
||||
#define TENSORFLOW_COMPILER_XLA_SERVICE_CONVOLUTION_FEATURE_GROUP_CONVERTER_H_
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_module.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_pass_interface.h"
|
||||
#include "tensorflow/compiler/xla/status_macros.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
|
||||
namespace xla {
|
||||
|
||||
@ -29,7 +29,7 @@ class ConvolutionFeatureGroupConverter : public HloPassInterface {
|
||||
public:
|
||||
ConvolutionFeatureGroupConverter() {}
|
||||
|
||||
tensorflow::StringPiece name() const override {
|
||||
absl::string_view name() const override {
|
||||
return "convolution-feature-group-converter";
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/compiler/xla/service/copy_insertion.h"
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_alias_analysis.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_computation.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_dce.h"
|
||||
@ -32,14 +33,13 @@ limitations under the License.
|
||||
#include "tensorflow/core/lib/gtl/flatmap.h"
|
||||
#include "tensorflow/core/lib/gtl/flatset.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
|
||||
namespace xla {
|
||||
|
||||
using ::absl::StrAppend;
|
||||
using ::absl::StrCat;
|
||||
using ::tensorflow::str_util::Join;
|
||||
using ::tensorflow::strings::StrAppend;
|
||||
using ::tensorflow::strings::StrCat;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace xla {
|
||||
// InstructionAliasSet::IsDistinct return true.
|
||||
class CopyInsertion : public HloPassInterface {
|
||||
public:
|
||||
tensorflow::StringPiece name() const override { return "copy-insertion"; }
|
||||
absl::string_view name() const override { return "copy-insertion"; }
|
||||
|
||||
// fusion_can_share_buffer: backend specific function that decides whether a
|
||||
// fusion can share buffer with its operand.
|
||||
|
@ -87,6 +87,7 @@ cc_library(
|
||||
":parallel_task_assignment",
|
||||
":simple_orc_jit",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//tensorflow/compiler/tf2xla:cpu_function_runtime",
|
||||
"//tensorflow/compiler/xla/service:scatter_expander",
|
||||
"//tensorflow/compiler/xla:literal",
|
||||
@ -232,6 +233,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/service:tuple_points_to_analysis",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@llvm//:orc_jit",
|
||||
],
|
||||
)
|
||||
@ -279,6 +281,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/service/llvm_ir:loop_emitter",
|
||||
"//tensorflow/compiler/xla/service/llvm_ir:tuple_ops",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@llvm//:code_gen",
|
||||
"@llvm//:core",
|
||||
"@llvm//:support",
|
||||
@ -323,6 +326,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/service/cpu:cpu_runtime",
|
||||
"//tensorflow/compiler/xla/service/llvm_ir:llvm_util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@llvm//:core",
|
||||
],
|
||||
)
|
||||
@ -365,6 +369,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/service/llvm_ir:llvm_loop",
|
||||
"//tensorflow/compiler/xla/service/llvm_ir:llvm_util",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@llvm//:core",
|
||||
],
|
||||
)
|
||||
@ -653,6 +658,7 @@ tf_cc_test(
|
||||
"//tensorflow/compiler/xla/tests:hlo_test_base",
|
||||
"//tensorflow/compiler/xla/tests:xla_internal_test_main",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -816,6 +822,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/service:hlo_cost_analysis",
|
||||
"//tensorflow/compiler/xla/service:hlo_pass",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -852,6 +859,7 @@ cc_library(
|
||||
deps = [
|
||||
"//tensorflow/compiler/xla/service:hlo_module_config",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -38,7 +38,7 @@ class ConvCanonicalization : public HloPassInterface {
|
||||
: target_machine_features_(*target_machine_features) {}
|
||||
|
||||
~ConvCanonicalization() override {}
|
||||
tensorflow::StringPiece name() const override {
|
||||
absl::string_view name() const override {
|
||||
return "convolution-canonicalization";
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ limitations under the License.
|
||||
// IWYU pragma: no_include "llvm/Config/Disassemblers.def.inc"
|
||||
// IWYU pragma: no_include "llvm/Config/Targets.def.inc"
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
@ -102,7 +103,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
|
||||
namespace xla {
|
||||
namespace cpu {
|
||||
|
@ -32,7 +32,7 @@ namespace xla {
|
||||
// (module-scoped).
|
||||
class CpuCopyInsertion : public HloPassInterface {
|
||||
public:
|
||||
tensorflow::StringPiece name() const override { return "copy-insertion"; }
|
||||
absl::string_view name() const override { return "copy-insertion"; }
|
||||
|
||||
StatusOr<bool> Run(HloModule* module) override;
|
||||
};
|
||||
|
@ -22,6 +22,7 @@ limitations under the License.
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
|
||||
#include "tensorflow/compiler/xla/service/buffer_assignment.h"
|
||||
#include "tensorflow/compiler/xla/service/computation_layout.h"
|
||||
@ -36,7 +37,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/lib/strings/stringprintf.h"
|
||||
#include "tensorflow/core/platform/env.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
@ -177,7 +177,7 @@ Status CpuExecutable::ExecuteComputeFunction(
|
||||
buffer_pointers.size(), profile_counters_size);
|
||||
VLOG(3) << tensorflow::strings::Printf(" result = %p", result_buffer);
|
||||
auto ptr_printer = [](string* out, const void* p) {
|
||||
tensorflow::strings::StrAppend(out, tensorflow::strings::Printf("%p", p));
|
||||
absl::StrAppend(out, tensorflow::strings::Printf("%p", p));
|
||||
};
|
||||
VLOG(3) << " params = nullptr";
|
||||
VLOG(3) << tensorflow::strings::Printf(
|
||||
|
@ -28,9 +28,7 @@ class CpuHloSupportChecker : public HloPassInterface {
|
||||
CpuHloSupportChecker() = default;
|
||||
~CpuHloSupportChecker() override = default;
|
||||
|
||||
tensorflow::StringPiece name() const override {
|
||||
return "cpu_hlo_support_checker";
|
||||
}
|
||||
absl::string_view name() const override { return "cpu_hlo_support_checker"; }
|
||||
|
||||
// Note: always returns false (no instructions are ever modified by this
|
||||
// pass).
|
||||
|
@ -18,6 +18,7 @@ limitations under the License.
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_matchers.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_parser.h"
|
||||
#include "tensorflow/compiler/xla/service/transpose_folding.h"
|
||||
@ -773,8 +774,8 @@ class GatherLoopFusionTest
|
||||
|
||||
TEST_P(GatherLoopFusionTest, GatherLoopFusion) {
|
||||
const GatherLoopFusionTestSpec& spec = GetParam();
|
||||
string hlo_string = tensorflow::strings::StrCat(
|
||||
"HloModule ", spec.test_name, "\n\n", spec.hlo_computation_text);
|
||||
string hlo_string = absl::StrCat("HloModule ", spec.test_name, "\n\n",
|
||||
spec.hlo_computation_text);
|
||||
TF_ASSERT_OK_AND_ASSIGN(std::unique_ptr<HloModule> module,
|
||||
ParseHloString(hlo_string));
|
||||
|
||||
|
@ -15,6 +15,8 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/compiler/xla/service/cpu/cpu_options.h"
|
||||
|
||||
#include "absl/strings/numbers.h"
|
||||
#include "absl/strings/str_split.h"
|
||||
#include "tensorflow/core/lib/strings/numbers.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
|
||||
@ -51,7 +53,7 @@ absl::optional<int64> LlvmIrGemvTilingFactor(const HloModuleConfig& config) {
|
||||
auto it = extra_options_map.find(kLlvmIrDotTilingFactor);
|
||||
int64 tiling_factor;
|
||||
if (it != extra_options_map.end() &&
|
||||
tensorflow::strings::safe_strto64(it->second, &tiling_factor)) {
|
||||
absl::SimpleAtoi(it->second, &tiling_factor)) {
|
||||
return tiling_factor;
|
||||
}
|
||||
return absl::nullopt;
|
||||
@ -63,8 +65,8 @@ bool EnableExperimentalLlvmIrGemm(const HloModuleConfig& config) {
|
||||
return extra_options_map.count(kXlaEnableExperimentalLlvmIrGemm) > 0;
|
||||
}
|
||||
|
||||
static tensorflow::StringPiece RemoveSuffix(tensorflow::StringPiece str,
|
||||
tensorflow::StringPiece suffix) {
|
||||
static absl::string_view RemoveSuffix(absl::string_view str,
|
||||
absl::string_view suffix) {
|
||||
CHECK_GE(str.size(), suffix.size());
|
||||
CHECK_EQ(str.substr(str.size() - suffix.size()), suffix);
|
||||
return str.substr(0, str.size() - suffix.size());
|
||||
@ -79,22 +81,21 @@ absl::optional<std::tuple<int64, int64, int64>> LlvmIrGemmTileSize(
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
std::vector<string> tile_components =
|
||||
tensorflow::str_util::Split(it->second, ':');
|
||||
std::vector<string> tile_components = absl::StrSplit(it->second, ':');
|
||||
CHECK_EQ(tile_components.size(), 3);
|
||||
|
||||
int64 tile_size_m;
|
||||
int64 tile_size_k;
|
||||
int64 tile_size_n_in_vector_width;
|
||||
|
||||
CHECK(tensorflow::strings::safe_strto64(tile_components[0], &tile_size_m));
|
||||
CHECK(tensorflow::strings::safe_strto64(tile_components[1], &tile_size_k));
|
||||
CHECK(absl::SimpleAtoi(tile_components[0], &tile_size_m));
|
||||
CHECK(absl::SimpleAtoi(tile_components[1], &tile_size_k));
|
||||
|
||||
tensorflow::StringPiece tile_size_n_in_vector_width_str =
|
||||
absl::string_view tile_size_n_in_vector_width_str =
|
||||
RemoveSuffix(tile_components[2], "*vectwidth");
|
||||
|
||||
CHECK(tensorflow::strings::safe_strto64(tile_size_n_in_vector_width_str,
|
||||
&tile_size_n_in_vector_width));
|
||||
CHECK(absl::SimpleAtoi(tile_size_n_in_vector_width_str,
|
||||
&tile_size_n_in_vector_width));
|
||||
|
||||
return std::tuple<int64, int64, int64>(tile_size_m, tile_size_k,
|
||||
tile_size_n_in_vector_width);
|
||||
|
@ -18,6 +18,7 @@ limitations under the License.
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
@ -146,9 +147,9 @@ class GemvConfig {
|
||||
bool has_addend() const { return has_addend_; }
|
||||
|
||||
string GetCacheKey() const {
|
||||
return tensorflow::strings::StrCat(
|
||||
name_, "_", PrimitiveType_Name(scalar_type()), "_", tile_rows(), "_",
|
||||
tile_cols(), "_", m(), "_", k(), has_addend() ? "_with_addend" : "");
|
||||
return absl::StrCat(name_, "_", PrimitiveType_Name(scalar_type()), "_",
|
||||
tile_rows(), "_", tile_cols(), "_", m(), "_", k(),
|
||||
has_addend() ? "_with_addend" : "");
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -642,9 +643,7 @@ class TiledSmallGemmEmitter {
|
||||
int64 k() const { return k_; }
|
||||
int64 n() const { return n_; }
|
||||
|
||||
string ToString() const {
|
||||
return tensorflow::strings::StrCat(m(), "x", k(), "x", n());
|
||||
}
|
||||
string ToString() const { return absl::StrCat(m(), "x", k(), "x", n()); }
|
||||
|
||||
private:
|
||||
const int64 m_;
|
||||
@ -687,10 +686,10 @@ class TiledSmallGemmEmitter {
|
||||
tile_size_k_(tile_size_k) {}
|
||||
|
||||
string GetCacheKey() const {
|
||||
return tensorflow::strings::StrCat(
|
||||
"gemm_", PrimitiveType_Name(scalar_type()), "_", dims().ToString(),
|
||||
"_", max_vectorization_width(), "_", min_vectorization_width(), "_",
|
||||
tile_size_m(), "_", tile_size_k());
|
||||
return absl::StrCat("gemm_", PrimitiveType_Name(scalar_type()), "_",
|
||||
dims().ToString(), "_", max_vectorization_width(),
|
||||
"_", min_vectorization_width(), "_", tile_size_m(),
|
||||
"_", tile_size_k());
|
||||
}
|
||||
|
||||
PrimitiveType scalar_type() const { return scalar_type_; }
|
||||
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_CPU_DOT_OP_EMITTER_H_
|
||||
#define TENSORFLOW_COMPILER_XLA_SERVICE_CPU_DOT_OP_EMITTER_H_
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/cpu_options.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/target_machine_features.h"
|
||||
@ -25,7 +26,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/service/llvm_ir/llvm_loop.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
namespace xla {
|
||||
|
@ -27,6 +27,7 @@ limitations under the License.
|
||||
#include "tensorflow/core/lib/math/math_util.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
// IWYU pragma: no_include "llvm/IR/Intrinsics.gen.inc"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "llvm/CodeGen/TargetRegisterInfo.h"
|
||||
#include "llvm/CodeGen/TargetSubtargetInfo.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
@ -67,7 +68,6 @@ limitations under the License.
|
||||
#include "tensorflow/core/lib/gtl/array_slice.h"
|
||||
#include "tensorflow/core/lib/gtl/flatmap.h"
|
||||
#include "tensorflow/core/lib/gtl/flatset.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/lib/strings/stringprintf.h"
|
||||
|
||||
namespace xla {
|
||||
@ -502,7 +502,7 @@ Status IrEmitter::HandleTuple(HloInstruction* tuple) {
|
||||
llvm::Value* IrEmitter::EmitElementalMap(
|
||||
const HloMapInstruction& map_instr,
|
||||
tensorflow::gtl::ArraySlice<llvm::Value*> elemental_operands,
|
||||
tensorflow::StringPiece name) {
|
||||
absl::string_view name) {
|
||||
return EmitThreadLocalCall(*map_instr.to_apply(), elemental_operands, name);
|
||||
}
|
||||
|
||||
@ -846,7 +846,7 @@ StatusOr<llvm::Value*> IrEmitter::EmitTargetElementLoopBodyForConvolution(
|
||||
loops
|
||||
.AddLoop(
|
||||
0, rhs->shape().dimensions(dnums.kernel_spatial_dimensions(i)),
|
||||
tensorflow::strings::StrCat("k", i))
|
||||
absl::StrCat("k", i))
|
||||
->GetIndVarValue();
|
||||
}
|
||||
llvm::Value* input_feature =
|
||||
@ -2118,7 +2118,7 @@ Status IrEmitter::HandleCall(HloInstruction* call) {
|
||||
|
||||
Status IrEmitter::HandleCustomCall(HloInstruction* custom_call) {
|
||||
gtl::ArraySlice<HloInstruction*> operands(custom_call->operands());
|
||||
tensorflow::StringPiece custom_call_target(custom_call->custom_call_target());
|
||||
absl::string_view custom_call_target(custom_call->custom_call_target());
|
||||
llvm::Type* i8_ptr_type = b_.getInt8PtrTy();
|
||||
llvm::AllocaInst* operands_alloca =
|
||||
llvm_ir::EmitAllocaAtFunctionEntryWithCount(
|
||||
@ -2687,9 +2687,8 @@ llvm::Value* IrEmitter::EmitThreadLocalTempBufferPointer(
|
||||
auto buf_it = thread_local_buffers_.find(key);
|
||||
if (buf_it == thread_local_buffers_.end()) {
|
||||
llvm::Value* buffer = llvm_ir::EmitAllocaAtFunctionEntry(
|
||||
IrShapeType(shape),
|
||||
tensorflow::strings::StrCat("thread_local", slice.ToString()), &b_,
|
||||
MinimumAlignmentForShape(target_shape));
|
||||
IrShapeType(shape), absl::StrCat("thread_local", slice.ToString()),
|
||||
&b_, MinimumAlignmentForShape(target_shape));
|
||||
auto it_inserted_pair = thread_local_buffers_.insert({key, buffer});
|
||||
CHECK(it_inserted_pair.second);
|
||||
buf_it = it_inserted_pair.first;
|
||||
@ -2753,7 +2752,7 @@ Status IrEmitter::EmitTargetElementLoop(
|
||||
}
|
||||
|
||||
Status IrEmitter::EmitTargetElementLoop(
|
||||
HloInstruction* target_op, tensorflow::StringPiece desc,
|
||||
HloInstruction* target_op, absl::string_view desc,
|
||||
const llvm_ir::ElementGenerator& element_generator) {
|
||||
VLOG(2) << "EmitTargetElementLoop: " << target_op->ToString();
|
||||
|
||||
@ -2848,7 +2847,7 @@ Status IrEmitter::DefaultAction(HloInstruction* hlo) {
|
||||
llvm::Value* IrEmitter::EmitThreadLocalCall(
|
||||
const HloComputation& callee,
|
||||
tensorflow::gtl::ArraySlice<llvm::Value*> parameters,
|
||||
tensorflow::StringPiece name) {
|
||||
absl::string_view name) {
|
||||
const Shape& return_shape = callee.root_instruction()->shape();
|
||||
|
||||
// Lifting this restriction to allow "small" arrays should be easy. Allowing
|
||||
@ -2869,7 +2868,7 @@ llvm::Value* IrEmitter::EmitThreadLocalCall(
|
||||
|
||||
llvm::Value* return_value_buffer = llvm_ir::EmitAllocaAtFunctionEntry(
|
||||
llvm_ir::PrimitiveTypeToIrType(return_type, module_),
|
||||
tensorflow::strings::StrCat(name, "_retval_addr"), &b_,
|
||||
absl::StrCat(name, "_retval_addr"), &b_,
|
||||
MinimumAlignmentForPrimitiveType(return_type));
|
||||
|
||||
b_.CreateCall(
|
||||
@ -2886,7 +2885,7 @@ llvm::Value* IrEmitter::EmitThreadLocalCall(
|
||||
}
|
||||
|
||||
void IrEmitter::EmitGlobalCall(const HloComputation& callee,
|
||||
tensorflow::StringPiece name) {
|
||||
absl::string_view name) {
|
||||
b_.CreateCall(FindOrDie(emitted_functions_, &callee),
|
||||
GetArrayFunctionCallArguments(
|
||||
/*parameter_addresses=*/{}, &b_, name,
|
||||
|
@ -23,6 +23,7 @@ limitations under the License.
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
@ -44,7 +45,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/statusor.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/gtl/array_slice.h"
|
||||
#include "tensorflow/core/lib/gtl/flatmap.h"
|
||||
#include "tensorflow/core/platform/macros.h"
|
||||
@ -107,7 +107,7 @@ class IrEmitter : public DfsHloVisitorWithDefault {
|
||||
llvm::Value* EmitElementalMap(
|
||||
const HloMapInstruction& map_instr,
|
||||
tensorflow::gtl::ArraySlice<llvm::Value*> elemental_operands,
|
||||
tensorflow::StringPiece name);
|
||||
absl::string_view name);
|
||||
|
||||
protected:
|
||||
//
|
||||
@ -239,7 +239,7 @@ class IrEmitter : public DfsHloVisitorWithDefault {
|
||||
// function that a map operation applies.
|
||||
StatusOr<llvm::Function*> EmitFunction(
|
||||
HloComputation* function, // The function to emit.
|
||||
tensorflow::StringPiece
|
||||
absl::string_view
|
||||
function_name_suffix); // Used for LLVM IR register names.
|
||||
|
||||
// Emits a call to a thread local function (e.g. to the computation nested
|
||||
@ -251,14 +251,13 @@ class IrEmitter : public DfsHloVisitorWithDefault {
|
||||
llvm::Value* EmitThreadLocalCall(
|
||||
const HloComputation& callee,
|
||||
tensorflow::gtl::ArraySlice<llvm::Value*> parameters,
|
||||
tensorflow::StringPiece name);
|
||||
absl::string_view name);
|
||||
|
||||
// Emits a call to a "global" function (e.g. to the computation nested within
|
||||
// a kWhile or a kCall). Buffer assignment unabiguously assignes buffers to
|
||||
// the parameters and return values for these computations so there is no need
|
||||
// to explicitly pass parameters or return results.
|
||||
void EmitGlobalCall(const HloComputation& callee,
|
||||
tensorflow::StringPiece name);
|
||||
void EmitGlobalCall(const HloComputation& callee, absl::string_view name);
|
||||
|
||||
// Returns the buffer to which a global call to `callee` would have written
|
||||
// its result.
|
||||
@ -285,7 +284,7 @@ class IrEmitter : public DfsHloVisitorWithDefault {
|
||||
HloInstruction* target_op,
|
||||
const llvm_ir::ElementGenerator& element_generator);
|
||||
Status EmitTargetElementLoop(
|
||||
HloInstruction* target_op, tensorflow::StringPiece desc,
|
||||
HloInstruction* target_op, absl::string_view desc,
|
||||
const llvm_ir::ElementGenerator& element_generator);
|
||||
|
||||
// Emits a memcpy from the source instruction's result value to the
|
||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/compiler/xla/service/cpu/ir_function.h"
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/cpu_runtime.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/shape_partition.h"
|
||||
#include "tensorflow/compiler/xla/service/llvm_ir/llvm_util.h"
|
||||
@ -189,7 +190,7 @@ void IrFunction::Initialize(const string& function_name,
|
||||
llvm::Value* IrFunction::GetDynamicLoopBound(const int64 offset) {
|
||||
CHECK_GT(num_dynamic_loop_bounds_, 0);
|
||||
CHECK_LT(offset, num_dynamic_loop_bounds_ * 2);
|
||||
string name = tensorflow::strings::StrCat("dynamic_loop_bound_", offset);
|
||||
string name = absl::StrCat("dynamic_loop_bound_", offset);
|
||||
return b_->CreateLoad(b_->CreateGEP(CHECK_NOTNULL(dynamic_loop_bounds_arg_),
|
||||
b_->getInt64(offset), AsStringRef(name)));
|
||||
}
|
||||
@ -200,7 +201,7 @@ llvm::Value* IrFunction::GetDynamicLoopBound(const int64 offset) {
|
||||
// address buffer).
|
||||
std::vector<llvm::Value*> GetArrayFunctionCallArguments(
|
||||
tensorflow::gtl::ArraySlice<llvm::Value*> parameter_addresses,
|
||||
llvm::IRBuilder<>* b, tensorflow::StringPiece name,
|
||||
llvm::IRBuilder<>* b, absl::string_view name,
|
||||
llvm::Value* return_value_buffer, llvm::Value* exec_run_options_arg,
|
||||
llvm::Value* temp_buffers_arg, llvm::Value* profile_counters_arg) {
|
||||
llvm::Value* parameter_addresses_buffer;
|
||||
@ -211,13 +212,13 @@ std::vector<llvm::Value*> GetArrayFunctionCallArguments(
|
||||
} else {
|
||||
parameter_addresses_buffer = llvm_ir::EmitAllocaAtFunctionEntryWithCount(
|
||||
b->getInt8PtrTy(), b->getInt32(parameter_addresses.size()),
|
||||
tensorflow::strings::StrCat(name, "_parameter_addresses"), b);
|
||||
absl::StrCat(name, "_parameter_addresses"), b);
|
||||
|
||||
for (size_t i = 0; i < parameter_addresses.size(); ++i) {
|
||||
llvm::Value* parameter_as_i8ptr =
|
||||
b->CreateBitCast(parameter_addresses[i], b->getInt8PtrTy(),
|
||||
AsStringRef(tensorflow::strings::StrCat(
|
||||
name, "_parameter_", i, "_address_as_i8ptr")));
|
||||
AsStringRef(absl::StrCat(name, "_parameter_", i,
|
||||
"_address_as_i8ptr")));
|
||||
llvm::Value* slot_in_param_addresses =
|
||||
b->CreateInBoundsGEP(parameter_addresses_buffer, {b->getInt64(i)});
|
||||
b->CreateStore(parameter_as_i8ptr, slot_in_param_addresses);
|
||||
@ -320,8 +321,7 @@ Status EmitCallToParallelForkJoin(
|
||||
/*Linkage=*/llvm::GlobalValue::PrivateLinkage,
|
||||
/*Initializer=*/partitions_array,
|
||||
/*Name=*/
|
||||
AsStringRef(
|
||||
tensorflow::strings::StrCat(name, "_parallel_dimension_partitions")));
|
||||
AsStringRef(absl::StrCat(name, "_parallel_dimension_partitions")));
|
||||
|
||||
// Add argument specifying parallel dimension partitions.
|
||||
fork_join_arguments.push_back(
|
||||
|
@ -116,7 +116,7 @@ class IrFunction {
|
||||
// Returns an array of compute function call argument ir values.
|
||||
std::vector<llvm::Value*> GetArrayFunctionCallArguments(
|
||||
tensorflow::gtl::ArraySlice<llvm::Value*> parameter_addresses,
|
||||
llvm::IRBuilder<>* b, tensorflow::StringPiece name,
|
||||
llvm::IRBuilder<>* b, absl::string_view name,
|
||||
llvm::Value* return_value_buffer, llvm::Value* exec_run_options_arg,
|
||||
llvm::Value* temp_buffers_arg, llvm::Value* profile_counters_arg);
|
||||
|
||||
|
@ -30,8 +30,8 @@ ParallelLoopEmitter::ParallelLoopEmitter(
|
||||
dynamic_loop_bounds_(dynamic_loop_bounds) {}
|
||||
|
||||
std::vector<llvm_ir::IrArray::Index>
|
||||
ParallelLoopEmitter::EmitIndexAndSetExitBasicBlock(
|
||||
tensorflow::StringPiece loop_name, llvm::Type* index_type) {
|
||||
ParallelLoopEmitter::EmitIndexAndSetExitBasicBlock(absl::string_view loop_name,
|
||||
llvm::Type* index_type) {
|
||||
CHECK_NE(index_type, nullptr);
|
||||
|
||||
CHECK(!ShapeUtil::IsTuple(shape_));
|
||||
|
@ -61,7 +61,7 @@ class ParallelLoopEmitter : public llvm_ir::LoopEmitter {
|
||||
~ParallelLoopEmitter() override = default;
|
||||
|
||||
std::vector<llvm_ir::IrArray::Index> EmitIndexAndSetExitBasicBlock(
|
||||
tensorflow::StringPiece loop_name, llvm::Type* index_type) override;
|
||||
absl::string_view loop_name, llvm::Type* index_type) override;
|
||||
|
||||
private:
|
||||
const DynamicLoopBounds* dynamic_loop_bounds_;
|
||||
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/service/cpu/parallel_task_assignment.h"
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/dot_op_emitter.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/ir_emission_utils.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/shape_partition.h"
|
||||
@ -217,8 +218,7 @@ bool ParallelTaskAssigner::AssignParallelTasksHelper(
|
||||
|
||||
// Outline 'instruction' in 'computation' for parallel task assignment.
|
||||
auto* call = module->OutlineExpressionFromComputation(
|
||||
{instruction},
|
||||
tensorflow::strings::StrCat("parallel_", instruction->name()),
|
||||
{instruction}, absl::StrCat("parallel_", instruction->name()),
|
||||
computation);
|
||||
|
||||
// Set assigned dimension partitioning to 'instruction'.
|
||||
|
@ -73,7 +73,7 @@ class ParallelTaskAssigner : public HloPassInterface {
|
||||
target_machine_features_(*target_machine_features) {}
|
||||
~ParallelTaskAssigner() override {}
|
||||
|
||||
tensorflow::StringPiece name() const override {
|
||||
absl::string_view name() const override {
|
||||
return "cpu-parallel-task-assigner";
|
||||
}
|
||||
|
||||
|
@ -170,15 +170,14 @@ namespace {
|
||||
bool RegisterKnownJITSymbols() {
|
||||
CustomCallTargetRegistry* registry = CustomCallTargetRegistry::Global();
|
||||
|
||||
#define REGISTER_CPU_RUNTIME_SYMBOL(base_name) \
|
||||
do { \
|
||||
auto* function_address = \
|
||||
reinterpret_cast<void*>(__xla_cpu_runtime_##base_name); \
|
||||
registry->Register(xla::cpu::runtime::k##base_name##SymbolName, \
|
||||
function_address); \
|
||||
CHECK_EQ( \
|
||||
tensorflow::StringPiece(xla::cpu::runtime::k##base_name##SymbolName), \
|
||||
"__xla_cpu_runtime_" #base_name); \
|
||||
#define REGISTER_CPU_RUNTIME_SYMBOL(base_name) \
|
||||
do { \
|
||||
auto* function_address = \
|
||||
reinterpret_cast<void*>(__xla_cpu_runtime_##base_name); \
|
||||
registry->Register(xla::cpu::runtime::k##base_name##SymbolName, \
|
||||
function_address); \
|
||||
CHECK_EQ(absl::string_view(xla::cpu::runtime::k##base_name##SymbolName), \
|
||||
"__xla_cpu_runtime_" #base_name); \
|
||||
} while (false)
|
||||
|
||||
REGISTER_CPU_RUNTIME_SYMBOL(AcquireInfeedBufferForDequeue);
|
||||
|
@ -110,6 +110,7 @@ tf_cc_test(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:test",
|
||||
"//tensorflow/core:test_main",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -123,6 +124,7 @@ tf_cc_test(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:test",
|
||||
"//tensorflow/core:test_main",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -19,10 +19,10 @@ limitations under the License.
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/cpu_compiler.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/tests/cpu_codegen_test.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_computation.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/test.h"
|
||||
|
||||
namespace xla {
|
||||
|
@ -17,10 +17,10 @@ limitations under the License.
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/cpu_compiler.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/tests/cpu_codegen_test.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_computation.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/test.h"
|
||||
|
||||
namespace xla {
|
||||
@ -32,9 +32,9 @@ const char* const kTriple_android_arm = "armv7-none-android";
|
||||
|
||||
struct IntrinsicTestSpec {
|
||||
HloOpcode opcode;
|
||||
tensorflow::StringPiece triple;
|
||||
tensorflow::StringPiece features;
|
||||
tensorflow::StringPiece check_lines;
|
||||
absl::string_view triple;
|
||||
absl::string_view features;
|
||||
absl::string_view check_lines;
|
||||
};
|
||||
|
||||
// Tests that unary functions get lowered using intrinsic calls.
|
||||
@ -65,9 +65,8 @@ class CpuUnaryIntrinsicTest
|
||||
features = "";
|
||||
}
|
||||
|
||||
return tensorflow::strings::StrCat(opcode.c_str(), "_On_", triple.c_str(),
|
||||
features.empty() ? "" : "_With",
|
||||
features.c_str());
|
||||
return absl::StrCat(opcode.c_str(), "_On_", triple.c_str(),
|
||||
features.empty() ? "" : "_With", features.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@ class Defuser : public HloPassInterface {
|
||||
public:
|
||||
Defuser() {}
|
||||
~Defuser() override {}
|
||||
tensorflow::StringPiece name() const override { return "defuser"; }
|
||||
absl::string_view name() const override { return "defuser"; }
|
||||
|
||||
// Run defusion on the given module. Returns whether the module was
|
||||
// changed.
|
||||
|
@ -27,9 +27,7 @@ namespace {
|
||||
class ControlDepRemover : public HloPassInterface {
|
||||
public:
|
||||
ControlDepRemover() = default;
|
||||
tensorflow::StringPiece name() const override {
|
||||
return "control-dep-remover";
|
||||
}
|
||||
absl::string_view name() const override { return "control-dep-remover"; }
|
||||
|
||||
StatusOr<bool> Run(HloModule* module) override {
|
||||
bool changed = false;
|
||||
|
@ -33,7 +33,7 @@ namespace xla {
|
||||
class Despecializer : public HloPassInterface {
|
||||
public:
|
||||
Despecializer();
|
||||
tensorflow::StringPiece name() const override { return "despecializer"; }
|
||||
absl::string_view name() const override { return "despecializer"; }
|
||||
StatusOr<bool> Run(HloModule* module) override;
|
||||
|
||||
private:
|
||||
|
@ -19,13 +19,13 @@ limitations under the License.
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/compiler/xla/literal.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_opcode.h"
|
||||
#include "tensorflow/compiler/xla/status.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/gtl/array_slice.h"
|
||||
#include "tensorflow/core/lib/gtl/flatmap.h"
|
||||
#include "tensorflow/core/platform/macros.h"
|
||||
|
@ -16,13 +16,13 @@ limitations under the License.
|
||||
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_DFS_HLO_VISITOR_WITH_DEFAULT_H_
|
||||
#define TENSORFLOW_COMPILER_XLA_SERVICE_DFS_HLO_VISITOR_WITH_DEFAULT_H_
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/compiler/xla/literal.h"
|
||||
#include "tensorflow/compiler/xla/service/dfs_hlo_visitor.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_opcode.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/gtl/array_slice.h"
|
||||
#include "tensorflow/core/platform/macros.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
@ -29,7 +29,7 @@ class DotDecomposer : public HloPassInterface {
|
||||
DotDecomposer(bool decompose_batch_dot = true)
|
||||
: decompose_batch_dot_(decompose_batch_dot) {}
|
||||
~DotDecomposer() = default;
|
||||
tensorflow::StringPiece name() const override { return "dot_decomposer"; }
|
||||
absl::string_view name() const override { return "dot_decomposer"; }
|
||||
|
||||
// Run DotDecomposer pass on computations in 'module'.
|
||||
// Returns whether the 'module' was changed.
|
||||
|
@ -22,6 +22,7 @@ limitations under the License.
|
||||
|
||||
// IWYU pragma: no_include "llvm/IR/Intrinsics.gen.inc"
|
||||
#include "absl/algorithm/container.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
@ -39,17 +40,16 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
#include "tensorflow/core/lib/random/random.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
namespace xla {
|
||||
|
||||
using absl::StrCat;
|
||||
using llvm_ir::AsStringRef;
|
||||
using llvm_ir::IrArray;
|
||||
using llvm_ir::IrName;
|
||||
using llvm_ir::SetToFirstInsertPoint;
|
||||
using tensorflow::strings::StrCat;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace xla {
|
||||
// points-to analysis (see b/36865746 for details).
|
||||
class FlattenCallGraph : public HloPassInterface {
|
||||
public:
|
||||
tensorflow::StringPiece name() const override { return "flatten-call-graph"; }
|
||||
absl::string_view name() const override { return "flatten-call-graph"; }
|
||||
|
||||
// Duplicates computations called from multiple call- or while-nodes to
|
||||
// flatten the call graph.
|
||||
|
@ -25,7 +25,7 @@ namespace xla {
|
||||
// nevertheless have a minimum level of support.
|
||||
class GatherExpander : public HloPassInterface {
|
||||
public:
|
||||
tensorflow::StringPiece name() const override { return "gather_expander"; }
|
||||
absl::string_view name() const override { return "gather_expander"; }
|
||||
StatusOr<bool> Run(HloModule* module) override;
|
||||
|
||||
private:
|
||||
|
@ -129,6 +129,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/service/llvm_ir:llvm_util",
|
||||
"//tensorflow/compiler/xla/service/llvm_ir:tuple_ops",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@llvm//:core",
|
||||
],
|
||||
)
|
||||
@ -186,6 +187,7 @@ cc_library(
|
||||
"@com_google_absl//absl/algorithm:container",
|
||||
"@com_google_absl//absl/container:inlined_vector",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
"@llvm//:core",
|
||||
"@llvm//:support",
|
||||
@ -231,6 +233,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/service/llvm_ir:loop_emitter",
|
||||
"//tensorflow/compiler/xla/service/llvm_ir:math_ops",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@llvm//:core",
|
||||
"@llvm//:support",
|
||||
],
|
||||
@ -347,6 +350,7 @@ cc_library(
|
||||
"//tensorflow/core/platform/default/build_config:stream_executor_cuda", # build_cleaner: keep
|
||||
"//tensorflow/stream_executor",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
)
|
||||
@ -384,6 +388,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/service:hlo_pass",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
)
|
||||
@ -402,6 +407,7 @@ cc_library(
|
||||
"//tensorflow/compiler/xla:util",
|
||||
"//tensorflow/compiler/xla:xla_data_proto",
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -496,6 +502,7 @@ tf_cc_test(
|
||||
"//tensorflow/compiler/xla/tests:hlo_test_base",
|
||||
"//tensorflow/compiler/xla/tests:xla_internal_test_main",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -687,6 +694,7 @@ cc_library(
|
||||
"//tensorflow/core:regexp_internal",
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
"@llvm//:core",
|
||||
],
|
||||
@ -775,6 +783,7 @@ tf_cc_test(
|
||||
"//tensorflow/compiler/xla/service:hlo_parser",
|
||||
"//tensorflow/compiler/xla/tests:hlo_test_base",
|
||||
"//tensorflow/compiler/xla/tests:xla_internal_test_main", # build_cleaner: keep
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -888,9 +897,9 @@ cc_library(
|
||||
"//tensorflow/compiler/xla/service:compiler",
|
||||
"//tensorflow/compiler/xla/service:device_memory_allocator",
|
||||
"//tensorflow/compiler/xla/service:hlo_parser",
|
||||
"//tensorflow/compiler/xla/service:hlo_runner",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:stream_executor_no_cuda",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/service/gpu/buffer_comparator.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "absl/strings/str_replace.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_parser.h"
|
||||
#include "tensorflow/compiler/xla/status_macros.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
@ -74,9 +75,8 @@ ENTRY MaxDifference {
|
||||
%error = f32[SIZE] divide(%sub_abs, %denominator)
|
||||
ROOT %max_diff = f32[] reduce(%error, %zero_constant), dimensions={0}, to_apply=MaxF32
|
||||
})";
|
||||
auto size_string = std::to_string(num_elements);
|
||||
return tensorflow::str_util::StringReplace(
|
||||
kF16CompHloText, "SIZE", {size_string.data(), size_string.size()}, true);
|
||||
return absl::StrReplaceAll(kF16CompHloText,
|
||||
{{"SIZE", absl::StrCat(num_elements)}});
|
||||
}
|
||||
|
||||
StatusOr<F16BufferComparator> F16BufferComparator::Create(
|
||||
|
@ -17,11 +17,11 @@ limitations under the License.
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/service/gpu/cudnn_convolution_runner.h"
|
||||
#include "tensorflow/compiler/xla/service/gpu/hlo_execution_profiler.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/lib/strings/stringprintf.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/stream_executor_no_cuda.h"
|
||||
|
@ -54,9 +54,7 @@ namespace gpu {
|
||||
// BatchNormRewriter.
|
||||
class CudnnBatchNormRewriter : public HloPassInterface {
|
||||
public:
|
||||
tensorflow::StringPiece name() const override {
|
||||
return "cudnn_batchnorm_rewriter";
|
||||
}
|
||||
absl::string_view name() const override { return "cudnn_batchnorm_rewriter"; }
|
||||
StatusOr<bool> Run(HloModule* module) override;
|
||||
};
|
||||
|
||||
|
@ -17,11 +17,11 @@ limitations under the License.
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/service/gpu/hlo_execution_profiler.h"
|
||||
#include "tensorflow/compiler/xla/service/gpu/ir_emission_utils.h"
|
||||
#include "tensorflow/compiler/xla/types.h"
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/lib/strings/stringprintf.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/stream_executor_no_cuda.h"
|
||||
|
@ -14,6 +14,7 @@ limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "tensorflow/compiler/xla/service/gpu/cudnn_convolution_algorithm_picker.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "tensorflow/compiler/xla/literal_util.h"
|
||||
#include "tensorflow/compiler/xla/service/gpu/backend_configs.pb.h"
|
||||
@ -21,7 +22,6 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/service/gpu/convolution_thunk.h"
|
||||
#include "tensorflow/compiler/xla/service/gpu/ir_emission_utils.h"
|
||||
#include "tensorflow/core/lib/strings/numbers.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
#include "tensorflow/core/platform/mutex.h"
|
||||
|
||||
namespace xla {
|
||||
@ -128,14 +128,14 @@ std::vector<AlgorithmDesc> GetAlgorithms(CudnnConvKind kind,
|
||||
|
||||
string AlgorithmToString(const AlgorithmDesc& algo) {
|
||||
if (algo.tensor_ops_enabled()) {
|
||||
return tensorflow::strings::StrCat(algo.algo_id(), "+TC");
|
||||
return absl::StrCat(algo.algo_id(), "+TC");
|
||||
}
|
||||
return tensorflow::strings::StrCat(algo.algo_id());
|
||||
return absl::StrCat(algo.algo_id());
|
||||
}
|
||||
|
||||
string NumBytesToString(int64 bytes) {
|
||||
return tensorflow::strings::StrCat(
|
||||
tensorflow::strings::HumanReadableNumBytes(bytes), " (", bytes, "B)");
|
||||
return absl::StrCat(tensorflow::strings::HumanReadableNumBytes(bytes), " (",
|
||||
bytes, "B)");
|
||||
}
|
||||
|
||||
// Acquires a process-global lock on the device pointed to by the given
|
||||
|
@ -39,7 +39,7 @@ class CudnnConvolutionAlgorithmPicker : public HloPassInterface {
|
||||
Compiler* compiler)
|
||||
: stream_exec_(stream_exec), allocator_(allocator), compiler_(compiler) {}
|
||||
|
||||
tensorflow::StringPiece name() const override {
|
||||
absl::string_view name() const override {
|
||||
return "cudnn-convolution-algorithm-picker";
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace gpu {
|
||||
// backwards-input convolutions into CustomCall HLOs that call into cuDNN.
|
||||
class CudnnConvolutionRewriter : public HloPassInterface {
|
||||
public:
|
||||
tensorflow::StringPiece name() const override {
|
||||
absl::string_view name() const override {
|
||||
return "cudnn-convolution-rewriter";
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user