Add metric for auto outside compilation & dynamic padder.
PiperOrigin-RevId: 337399711 Change-Id: I5c3b910d5a0c2ab1a4b827e717a3d94bdeb90ffd
This commit is contained in:
parent
75d8ae4e7e
commit
3333f3bdb1
tensorflow/compiler
@ -28,6 +28,7 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/mlir/tensorflow/transforms/lower_tf.h"
|
||||
#include "tensorflow/compiler/mlir/tensorflow/transforms/passes.h"
|
||||
#include "tensorflow/compiler/mlir/xla/transforms/passes.h"
|
||||
#include "tensorflow/core/lib/monitoring/gauge.h"
|
||||
|
||||
namespace mlir {
|
||||
namespace TFDevice {
|
||||
@ -37,6 +38,11 @@ namespace {
|
||||
constexpr char kXlaOutsideCompilationAttr[] = "_xla_outside_compilation";
|
||||
constexpr char kAllowSoftPlacementAttr[] = "allow_soft_placement";
|
||||
|
||||
auto* auto_outside_compilation_gauge =
|
||||
tensorflow::monitoring::Gauge<bool, 0>::New(
|
||||
"/tensorflow/core/use_auto_outside_compilation",
|
||||
"Tracks if auto outside compilation is enabled");
|
||||
|
||||
// This pass marks unsupported ops in a device cluster with
|
||||
// `_xla_outside_compilation` attribute so the operations will run on the host
|
||||
// instead of the device. Unsupported ops are ops that can not be code
|
||||
@ -200,6 +206,9 @@ LogicalResult MarkUncompilableOps(
|
||||
outside_compiled_cluster_counter++;
|
||||
}
|
||||
});
|
||||
if (outside_compiled_cluster_counter > 0) {
|
||||
auto_outside_compilation_gauge->GetCell()->Set(true);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
|
@ -39,12 +39,17 @@ limitations under the License.
|
||||
#include "tensorflow/compiler/xla/util.h"
|
||||
#include "tensorflow/compiler/xla/xla_data.pb.h"
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/monitoring/gauge.h"
|
||||
#include "tensorflow/core/platform/errors.h"
|
||||
|
||||
namespace xla {
|
||||
|
||||
namespace {
|
||||
|
||||
auto* dynamic_padding_gauge = tensorflow::monitoring::Gauge<bool, 0>::New(
|
||||
"/tensorflow/core/use_dynamic_padding_gauge",
|
||||
"Tracks if dynamic padder is used.");
|
||||
|
||||
// ChooseIdentityValue looks at the instruction's operand, returns a
|
||||
// identity value which, when padded, doesn't change the result of the
|
||||
// instruction.
|
||||
@ -1351,6 +1356,7 @@ StatusOr<bool> DynamicPadder::Run(HloModule* module) {
|
||||
operand, input_dim, operand_dynamic_size, identity_value);
|
||||
TF_RETURN_IF_ERROR(inst->ReplaceOperandWith(operand_num, padded));
|
||||
operand = inst->mutable_operand(operand_num);
|
||||
dynamic_padding_gauge->GetCell()->Set(true);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@ -1397,6 +1403,7 @@ StatusOr<bool> DynamicPadder::Run(HloModule* module) {
|
||||
TF_ASSIGN_OR_RETURN(changed, dce.Run(module));
|
||||
VLOG(2) << "Post DynamicPadder HLO:";
|
||||
XLA_VLOG_LINES(2, module->ToString());
|
||||
dynamic_padding_gauge->GetCell()->Set(changed);
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user