From 4db7ec52010ef737300a00e669973fecea5c0603 Mon Sep 17 00:00:00 2001 From: Andy Ly Date: Tue, 16 Jun 2020 13:35:30 -0700 Subject: [PATCH] Replace const llvm::SmallVector<>& with llvm::ArrayRef and const std::string& with llvm::StringRef in TPUExtractOutsideCompilation. (NFC) PiperOrigin-RevId: 316748196 Change-Id: Icdfcaa5a808ae69e5a6286d5bd7c6a988dbbe616 --- .../tpu_extract_outside_compilation.cc | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tensorflow/compiler/mlir/tensorflow/transforms/tpu_extract_outside_compilation.cc b/tensorflow/compiler/mlir/tensorflow/transforms/tpu_extract_outside_compilation.cc index 93e5cc22c30..54600faca4b 100644 --- a/tensorflow/compiler/mlir/tensorflow/transforms/tpu_extract_outside_compilation.cc +++ b/tensorflow/compiler/mlir/tensorflow/transforms/tpu_extract_outside_compilation.cc @@ -73,9 +73,8 @@ LogicalResult CollectAndGroupOutsideClusterOps(Block* block, } // Moves `cluster_ops` to associated `launch_op` body. -void MoveOutsideClusterOpsToLaunchOp( - tf_device::LaunchOp launch_op, - const llvm::SmallVector& cluster_ops) { +void MoveOutsideClusterOpsToLaunchOp(tf_device::LaunchOp launch_op, + llvm::ArrayRef cluster_ops) { MLIRContext* context = launch_op.getContext(); Operation* terminator = launch_op.GetBody().getTerminator(); @@ -123,7 +122,7 @@ void PropagateParallelExecuteReturnToReplicate( // Extracts all externally provided operands of `cluster_ops`. llvm::SmallSetVector GetExternalOperands( - const llvm::SmallVector& cluster_ops) { + llvm::ArrayRef cluster_ops) { llvm::SmallSetVector external_values; for (Operation* op : cluster_ops) { @@ -143,7 +142,7 @@ llvm::SmallSetVector GetExternalOperands( // Extracts all externally used outputs of `cluster_ops`. llvm::SmallVector GetExternalOutputs( - const llvm::SmallVector& cluster_ops) { + llvm::ArrayRef cluster_ops) { llvm::SmallSetVector external_outputs; for (Operation* op : cluster_ops) { @@ -166,7 +165,7 @@ llvm::SmallVector GetExternalOutputs( // as an operand. If there are no external_inputs, set insertion point to first // cluster_op. void SetHostComputeInsertion( - OpBuilder* builder, const llvm::SmallVector& cluster_ops, + OpBuilder* builder, llvm::ArrayRef cluster_ops, const llvm::SmallSetVector& external_inputs) { if (external_inputs.empty()) builder->setInsertionPoint(cluster_ops.front()); for (const auto& cluster_op : cluster_ops) { @@ -183,9 +182,9 @@ void SetHostComputeInsertion( // using `communication_key`. TF::_HostComputeMlirOp CreateHostCompute( OpBuilder* builder, tf_device::ClusterOp tpu_cluster, - const llvm::SmallVector& cluster_ops, + llvm::ArrayRef cluster_ops, const llvm::SmallSetVector& inputs, llvm::ArrayRef outputs, - const std::string& communication_key) { + llvm::StringRef communication_key) { llvm::SmallVector device_output_types; for (const auto& output : outputs) device_output_types.push_back(output.getType()); @@ -201,10 +200,9 @@ TF::_HostComputeMlirOp CreateHostCompute( void MoveOutsideCompiledOps( tf_device::ClusterOp tpu_cluster, llvm::StringRef outside_cluster_name, - tf_device::LaunchOp host_launch_op, - const llvm::SmallVector& cluster_ops, + tf_device::LaunchOp host_launch_op, llvm::ArrayRef cluster_ops, const llvm::SmallSetVector& external_inputs, - const llvm::SmallVector& external_outputs) { + llvm::ArrayRef external_outputs) { if (external_inputs.empty() && external_outputs.empty()) { MoveOutsideClusterOpsToLaunchOp(host_launch_op, cluster_ops); return;