From 2323473cd9c4bfbeb28e03e68c0b17038789507a Mon Sep 17 00:00:00 2001 From: Adrian Kuegel Date: Fri, 17 Jan 2020 07:42:53 -0800 Subject: [PATCH] Use mlir specific gpu plugin when --define=with_mlir_gpu_support=true is specified. PiperOrigin-RevId: 290268457 Change-Id: I35d5230d3d8f979569bae9df2576fb8a1779662e --- tensorflow/compiler/jit/BUILD | 13 ------------- tensorflow/compiler/xla/service/BUILD | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/tensorflow/compiler/jit/BUILD b/tensorflow/compiler/jit/BUILD index 618165d4b64..04d0168638b 100644 --- a/tensorflow/compiler/jit/BUILD +++ b/tensorflow/compiler/jit/BUILD @@ -77,19 +77,6 @@ cc_library( alwayslink = 1, ) -cc_library( - name = "xla_mlir_gpu_jit", - visibility = ["//visibility:public"], - deps = if_cuda_or_rocm([ - ":jit_compilation_passes", - "//tensorflow/compiler/jit/kernels:xla_ops", - "//tensorflow/compiler/tf2xla/kernels:xla_ops", - "//tensorflow/compiler/tf2xla/kernels:xla_dummy_ops", - "//tensorflow/compiler/xla/service:mlir_gpu_plugin", - ]), - alwayslink = 1, -) - cc_library( name = "xla_cpu_device", srcs = ["xla_cpu_device.cc"], diff --git a/tensorflow/compiler/xla/service/BUILD b/tensorflow/compiler/xla/service/BUILD index 01f0016bddd..1cc8d24dbde 100755 --- a/tensorflow/compiler/xla/service/BUILD +++ b/tensorflow/compiler/xla/service/BUILD @@ -931,8 +931,31 @@ cc_library( ], ) +# This flag enables experimental MLIR GPU support. +config_setting( + name = "with_mlir_gpu_support", + values = {"define": "with_mlir_gpu_support=true"}, + visibility = ["//visibility:public"], +) + +# Lets us choose the right GPU plugin depending on whether the experimental MLIR +# GPU plugin should be used or not. cc_library( name = "gpu_plugin", + deps = select( + { + ":with_mlir_gpu_support": [ + ":mlir_gpu_plugin", + ], + "//conditions:default": [ + ":gpu_plugin_no_mlir", + ], + }, + ), +) + +cc_library( + name = "gpu_plugin_no_mlir", deps = [ ":service", "//tensorflow/compiler/xla/service/gpu:gpu_compiler",