Review comments addressed

This commit is contained in:
Nishidha Panpaliya 2020-06-04 14:52:03 +00:00
parent 0ca0c442c0
commit bdf6adfc0e
10 changed files with 57 additions and 8 deletions

View File

@ -30,6 +30,15 @@ filegroup(
]),
)
cc_library(
name = "test_header_helper",
testonly = True,
hdrs = ["test_target_triple_helper.h"],
deps = [
"//tensorflow/core:test",
],
)
filegroup(
name = "single_threaded_runtime_srcs",
srcs = [
@ -1071,6 +1080,7 @@ tf_cc_test(
deps = [
":cpu_compiler",
":cpu_transfer_manager",
":test_header_helper",
"//tensorflow/compiler/xla:test",
"//tensorflow/compiler/xla/tests:hlo_test_base",
"//tensorflow/compiler/xla/tests:xla_internal_test_main",

View File

@ -0,0 +1,27 @@
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_TEST_TARGET_TRIPLE_HELPER_H_
#define TENSORFLOW_TEST_TARGET_TRIPLE_HELPER_H_
#if (defined(__powerpc__) || defined(__ppc__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
static const std::string kTargetCpuForHost="ppc";
static const std::string kTargetTripleForHost="ppc64le-ibm-linux-gnu";
#else
static const std::string kTargetCpuForHost="";
static const std::string kTargetTripleForHost="x86_64-pc-linux";
#endif
#endif

View File

@ -42,6 +42,7 @@ tf_cc_test(
"//tensorflow/compiler/xla/service:hlo",
"//tensorflow/compiler/xla/service/cpu:cpu_compiler",
"//tensorflow/compiler/xla/service/cpu/tests:cpu_codegen_test",
"//tensorflow/compiler/xla/service/cpu:test_header_helper",
"//tensorflow/core:lib",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
@ -216,6 +217,7 @@ tf_cc_test(
"//tensorflow/compiler/xla/service:hlo_parser",
"//tensorflow/compiler/xla/service/cpu:cpu_compiler",
"//tensorflow/compiler/xla/service/cpu/tests:cpu_codegen_test",
"//tensorflow/compiler/xla/service/cpu:test_header_helper",
"//tensorflow/core:lib",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
@ -229,6 +231,7 @@ tf_cc_test(
"//tensorflow/compiler/xla/service:hlo",
"//tensorflow/compiler/xla/service/cpu:cpu_compiler",
"//tensorflow/compiler/xla/service/cpu/tests:cpu_codegen_test",
"//tensorflow/compiler/xla/service/cpu:test_header_helper",
"//tensorflow/core:lib",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
@ -242,6 +245,7 @@ tf_cc_test(
"//tensorflow/compiler/xla/service:hlo",
"//tensorflow/compiler/xla/service/cpu:cpu_compiler",
"//tensorflow/compiler/xla/service/cpu/tests:cpu_codegen_test",
"//tensorflow/compiler/xla/service/cpu:test_header_helper",
"//tensorflow/core:lib",
"//tensorflow/core:test",
"//tensorflow/core:test_main",

View File

@ -17,6 +17,7 @@ limitations under the License.
#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/cpu/test_target_triple_helper.h"
namespace xla {
namespace cpu {
@ -46,7 +47,7 @@ TEST_F(CpuDynamicShapeTest, DynamicShapeR2) {
)";
CpuAotCompilationOptions options{
/*triple=*/"x86_64", /*cpu_name=*/"", /*features=*/"",
/*triple=*/kTargetTripleForHost, /*cpu_name=*/kTargetCpuForHost, /*features=*/"",
/*entry_point_name=*/"entry",
/*relocation_model=*/CpuAotCompilationOptions::RelocationModel::Static};

View File

@ -23,6 +23,7 @@ limitations under the License.
#include "tensorflow/compiler/xla/service/cpu/tests/cpu_codegen_test.h"
#include "tensorflow/compiler/xla/service/hlo_computation.h"
#include "tensorflow/compiler/xla/tests/test_utils.h"
#include "tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h"
#include "tensorflow/core/platform/test.h"
namespace xla {
@ -45,7 +46,7 @@ class CpuEigenDotOperationTest
void CompileAndCheck(std::unique_ptr<HloComputation> entry_computation,
const string& filecheck_lines) {
CpuAotCompilationOptions options{
/*triple=*/"x86_64", /*cpu_name=*/"", /*features=*/"",
/*triple=*/kTargetTripleForHost, /*cpu_name=*/kTargetCpuForHost, /*features=*/"",
/*entry_point_name=*/"entry",
/*relocation_model=*/CpuAotCompilationOptions::RelocationModel::Static};

View File

@ -17,6 +17,7 @@ limitations under the License.
#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/cpu/test_target_triple_helper.h"
namespace xla {
namespace cpu {
@ -48,7 +49,7 @@ CHECK: call void @__xla_cpu_runtime_KeyValueSort
TF_ASSERT_OK_AND_ASSIGN(auto module, ParseAndReturnVerifiedModule(hlo_text));
CpuAotCompilationOptions options{
/*triple=*/"x86_64", /*cpu_name=*/"", /*features=*/"",
/*triple=*/kTargetTripleForHost, /*cpu_name=*/kTargetCpuForHost, /*features=*/"",
/*entry_point_name=*/"entry",
/*relocation_model=*/CpuAotCompilationOptions::RelocationModel::Static};

View File

@ -16,6 +16,7 @@ limitations under the License.
#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_parser.h"
#include "tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h"
namespace xla {
namespace cpu {
@ -64,7 +65,7 @@ CHECK-NOT: private unnamed_addr constant [48 x i8]
ParseAndReturnVerifiedModule(hlo_text));
CpuAotCompilationOptions options{
/*triple=*/"x86_64-pc-linux", /*cpu_name=*/"", /*features=*/"",
/*triple=*/kTargetTripleForHost, /*cpu_name=*/kTargetCpuForHost, /*features=*/"",
/*entry_point_name=*/"entry",
/*relocation_model=*/CpuAotCompilationOptions::RelocationModel::Static};
@ -112,7 +113,7 @@ CHECK-NOT: private unnamed_addr constant [8 x i8]
ParseAndReturnVerifiedModule(hlo_text));
CpuAotCompilationOptions options{
/*triple=*/"x86_64-pc-linux", /*cpu_name=*/"", /*features=*/"",
/*triple=*/kTargetTripleForHost, /*cpu_name=*/kTargetCpuForHost, /*features=*/"",
/*entry_point_name=*/"entry",
/*relocation_model=*/CpuAotCompilationOptions::RelocationModel::Static};

View File

@ -17,6 +17,7 @@ limitations under the License.
#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/cpu/test_target_triple_helper.h"
namespace xla {
namespace cpu {
@ -46,7 +47,7 @@ CHECK: private unnamed_addr constant [48 x i8]
TF_ASSERT_OK_AND_ASSIGN(auto module, ParseAndReturnVerifiedModule(hlo_text));
CpuAotCompilationOptions options{
/*triple=*/"x86_64-pc-linux", /*cpu_name=*/"", /*features=*/"",
/*triple=*/kTargetTripleForHost, /*cpu_name=*/kTargetCpuForHost, /*features=*/"",
/*entry_point_name=*/"entry",
/*relocation_model=*/CpuAotCompilationOptions::RelocationModel::Static};
@ -73,7 +74,7 @@ CHECK: Outfeed
TF_ASSERT_OK_AND_ASSIGN(auto module, ParseAndReturnVerifiedModule(hlo_text));
CpuAotCompilationOptions options{
/*triple=*/"x86_64-pc-linux", /*cpu_name=*/"", /*features=*/"",
/*triple=*/kTargetTripleForHost, /*cpu_name=*/kTargetCpuForHost, /*features=*/"",
/*entry_point_name=*/"entry",
/*relocation_model=*/CpuAotCompilationOptions::RelocationModel::Static};

View File

@ -20,6 +20,7 @@ limitations under the License.
#include "tensorflow/compiler/xla/service/cpu/cpu_compiler.h"
#include "tensorflow/compiler/xla/test.h"
#include "tensorflow/compiler/xla/tests/hlo_test_base.h"
#include "tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h"
namespace xla {
namespace {
@ -75,7 +76,7 @@ ENTRY main {
// Check that the GetTargetVectorRegisterByteSize is itself working.
TF_ASSERT_OK_AND_ASSIGN(unsigned vector_register_byte_size_for_x86_64,
GetTargetVectorRegisterByteSize("x86_64-pc-linux"));
GetTargetVectorRegisterByteSize(kTargetTripleForHost));
ASSERT_EQ(vector_register_byte_size_for_x86_64, 16);
std::string triple = "i686-none-android";

View File

@ -71,6 +71,8 @@ int main(int argc, char** argv) {
triple_string = "aarch64-none-linux-gnu";
} else if (target_cpu == "x64_windows") {
triple_string = "x86_64-pc-windows-msvc19";
} else if (target_cpu == "ppc") {
triple_string = "ppc64le-ibm-linux-gnu";
} else if (target_cpu == "local") {
triple_string = llvm::sys::getDefaultTargetTriple();
} else {