Merge pull request #38980 from npanpaliya:tf-cpu-xla-test-fixes
PiperOrigin-RevId: 317063007 Change-Id: Ic11ae94c2e409207658e2dc9558e0f8cbbdee984
This commit is contained in:
commit
d230ccaa55
@ -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",
|
||||
|
@ -0,0 +1,28 @@
|
||||
/* Copyright 2020 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 char kTargetCpuForHost[] = "ppc";
|
||||
static const char kTargetTripleForHost[] = "ppc64le-ibm-linux-gnu";
|
||||
#else
|
||||
static const char kTargetCpuForHost[] = "";
|
||||
static const char kTargetTripleForHost[] = "x86_64-pc-linux";
|
||||
#endif
|
||||
|
||||
#endif
|
@ -41,6 +41,7 @@ tf_cc_test(
|
||||
deps = [
|
||||
"//tensorflow/compiler/xla/service:hlo",
|
||||
"//tensorflow/compiler/xla/service/cpu:cpu_compiler",
|
||||
"//tensorflow/compiler/xla/service/cpu:test_header_helper",
|
||||
"//tensorflow/compiler/xla/service/cpu/tests:cpu_codegen_test",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:test",
|
||||
@ -135,6 +136,7 @@ tf_cc_test(
|
||||
deps = [
|
||||
"//tensorflow/compiler/xla/service:hlo",
|
||||
"//tensorflow/compiler/xla/service/cpu:cpu_compiler",
|
||||
"//tensorflow/compiler/xla/service/cpu:test_header_helper",
|
||||
"//tensorflow/compiler/xla/service/cpu/tests:cpu_codegen_test",
|
||||
"//tensorflow/compiler/xla/tests:test_utils",
|
||||
"//tensorflow/core:lib",
|
||||
@ -215,6 +217,7 @@ tf_cc_test(
|
||||
"//tensorflow/compiler/xla/service:hlo",
|
||||
"//tensorflow/compiler/xla/service:hlo_parser",
|
||||
"//tensorflow/compiler/xla/service/cpu:cpu_compiler",
|
||||
"//tensorflow/compiler/xla/service/cpu:test_header_helper",
|
||||
"//tensorflow/compiler/xla/service/cpu/tests:cpu_codegen_test",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:test",
|
||||
@ -228,6 +231,7 @@ tf_cc_test(
|
||||
deps = [
|
||||
"//tensorflow/compiler/xla/service:hlo",
|
||||
"//tensorflow/compiler/xla/service/cpu:cpu_compiler",
|
||||
"//tensorflow/compiler/xla/service/cpu:test_header_helper",
|
||||
"//tensorflow/compiler/xla/service/cpu/tests:cpu_codegen_test",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:test",
|
||||
@ -241,6 +245,7 @@ tf_cc_test(
|
||||
deps = [
|
||||
"//tensorflow/compiler/xla/service:hlo",
|
||||
"//tensorflow/compiler/xla/service/cpu:cpu_compiler",
|
||||
"//tensorflow/compiler/xla/service/cpu:test_header_helper",
|
||||
"//tensorflow/compiler/xla/service/cpu/tests:cpu_codegen_test",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:test",
|
||||
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||
#include <memory>
|
||||
|
||||
#include "tensorflow/compiler/xla/service/cpu/cpu_compiler.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/tests/cpu_codegen_test.h"
|
||||
|
||||
namespace xla {
|
||||
@ -46,7 +47,8 @@ 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};
|
||||
|
||||
|
@ -20,6 +20,7 @@ limitations under the License.
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/cpu_compiler.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h"
|
||||
#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"
|
||||
@ -45,7 +46,8 @@ 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};
|
||||
|
||||
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||
#include <memory>
|
||||
|
||||
#include "tensorflow/compiler/xla/service/cpu/cpu_compiler.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/tests/cpu_codegen_test.h"
|
||||
|
||||
namespace xla {
|
||||
@ -48,7 +49,8 @@ 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};
|
||||
|
||||
|
@ -14,6 +14,7 @@ limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "tensorflow/compiler/xla/service/cpu/cpu_compiler.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/tests/cpu_codegen_test.h"
|
||||
#include "tensorflow/compiler/xla/service/hlo_parser.h"
|
||||
|
||||
@ -64,7 +65,8 @@ 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 +114,8 @@ 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};
|
||||
|
||||
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||
#include <memory>
|
||||
|
||||
#include "tensorflow/compiler/xla/service/cpu/cpu_compiler.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/tests/cpu_codegen_test.h"
|
||||
|
||||
namespace xla {
|
||||
@ -46,7 +47,8 @@ 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 +75,8 @@ 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};
|
||||
|
||||
|
@ -18,6 +18,7 @@ limitations under the License.
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/cpu_compiler.h"
|
||||
#include "tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h"
|
||||
#include "tensorflow/compiler/xla/test.h"
|
||||
#include "tensorflow/compiler/xla/tests/hlo_test_base.h"
|
||||
|
||||
@ -74,8 +75,9 @@ ENTRY main {
|
||||
module_group->push_back(std::move(hlo_module));
|
||||
|
||||
// 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"));
|
||||
TF_ASSERT_OK_AND_ASSIGN(
|
||||
unsigned vector_register_byte_size_for_x86_64,
|
||||
GetTargetVectorRegisterByteSize(kTargetTripleForHost));
|
||||
ASSERT_EQ(vector_register_byte_size_for_x86_64, 16);
|
||||
|
||||
std::string triple = "i686-none-android";
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user