[XLA]: Enable Memory sanitizer for compilation_passes_test.
authorBixia Zheng <bixia@google.com>
Thu, 5 Apr 2018 00:14:11 +0000 (17:14 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Thu, 5 Apr 2018 00:16:47 +0000 (17:16 -0700)
Initialize the buffer for a scalar tensor to avoid uninitialized
accesses.

PiperOrigin-RevId: 191672257

tensorflow/compiler/jit/BUILD
tensorflow/compiler/jit/mark_for_compilation_pass_test.cc

index e7d18e8..24aa203 100644 (file)
@@ -347,7 +347,6 @@ tf_cc_test(
         "encapsulate_subgraphs_pass_test.cc",
         "mark_for_compilation_pass_test.cc",
     ],
-    tags = ["nomsan"],  # TODO: b/77543571
     deps = [
         ":common",
         ":compilation_passes",
index af19192..2e362e0 100644 (file)
@@ -163,11 +163,12 @@ TEST(XlaCompilationTest, HalfSupported) {
   GraphDef graphdef;
   {
     GraphDefBuilder builder(GraphDefBuilder::kFailImmediately);
-    Node* a = ops::SourceOp(
-        "Const", builder.opts()
-                     .WithName("A")
-                     .WithAttr("dtype", DT_HALF)
-                     .WithAttr("value", Tensor(DT_HALF, TensorShape())));
+    Tensor t(DT_HALF, TensorShape());
+    t.scalar<Eigen::half>()() = static_cast<Eigen::half>(0.0f);
+    Node* a = ops::SourceOp("Const", builder.opts()
+                                         .WithName("A")
+                                         .WithAttr("dtype", DT_HALF)
+                                         .WithAttr("value", t));
     Node* b = ops::UnaryOp("Neg", a, builder.opts().WithName("B"));
     ops::BinaryOp("MatMul", a, b, builder.opts().WithName("C"));
     TF_EXPECT_OK(GraphDefBuilderToGraph(builder, graph.get()));