profile
viewpoint

andyly/bib-publication-list 0

Interactive publications lists with JavaScript + Bibtex

andyly/bibtex-js 0

BibTeX-js can parse a BibTeX-file and render it as part of an HTML file. This way, you can easily add a list of publications to your private homepage or display a list of recommended publications for a seminar. The way the entries are display can be customized using a simple template system and CSS.

andyly/DOOM-FX 0

Doom/FX for Super Nintendo with SuperFX GSU2A

andyly/flatbuffers 0

Memory Efficient Serialization Library

andyly/grayscale-theme 0

Jekyll theme based on Grayscale Start Bootstrap theme

andyly/grpc 0

The C based gRPC (C++, Node.js, Python, Ruby, Objective-C, PHP, C#)

andyly/hubpress.io 0

A web application to build your blog on GitHub

andyly/llvm-project 0

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org.

andyly/mono 0

Mono open source ECMA CLI, C# and .NET implementation.

PullRequestReviewEvent

Pull request review commenttensorflow/tensorflow

DataFormatDimMap supports 5D tensors and grappler layout optimizer supports ReduceOps for 5D tensors

 bool ReduceTransposer::IsReduceAxisSupported( Status ReduceTransposer::TransposeNode(TransposeContext* context,                                        utils::MutableNodeView* node) {   DCHECK(IsReduceOp(*node->node()));-  if (!ShouldProcess(*context, *node) || !IsFaninPortRankN(*node, 0, 4) ||+  const auto& regular_fanin = node->GetRegularFanin(0);+  const auto* output_shape_attr =+      regular_fanin.node_view()->GetAttr(kAttrOutputShape);+  const auto& shape = output_shape_attr->list().shape(0);+  const int rank = shape.dim_size();+  std::string src_format = context->src_format;+  std::string dst_format = context->dst_format;+  // Update the format from 4D to 5D layout if necessary.+  bool allow_5d = rank == 5 && (src_format == "NHWC" || src_format == "NCHW");

Can we also check if dst_format are of "NHWC" and "NCHW" also?

kaixih

comment created time in 2 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commenttensorflow/tensorflow

DataFormatDimMap supports 5D tensors and grappler layout optimizer supports ReduceOps for 5D tensors

 def testLeakyReluGrad(self):       self._assert_trans_nchw_to_nhwc('LeakyReluGrad-0-0', nodes)       self.assertAllClose(output_val_ref, output_val, atol=1e-3) +  @test_util.deprecated_graph_mode_only+  def testReduceOpsFor5DTensors(self):+    if test.is_gpu_available(cuda_only=True):+      random_seed.set_random_seed(0)+      x = random_ops.truncated_normal([1, 4, 2, 3, 3], seed=0)+      w = random_ops.truncated_normal([2, 2, 2, 3, 3], seed=0)+      gamma = random_ops.truncated_normal([1, 1, 1, 1, 3], seed=0)+      beta = random_ops.truncated_normal([1, 1, 1, 1, 3], seed=0)

I believe gamma and beta are unused? Can they be removed?

kaixih

comment created time in 2 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commenttensorflow/tensorflow

DataFormatDimMap supports 5D tensors and grappler layout optimizer supports ReduceOps for 5D tensors

The tests between tf2xla and TF are shared, and the new test cases added for DataFormatDimMap are failing for the tf2xla kernel https://github.com/tensorflow/tensorflow/blob/master/tensorflow/compiler/tf2xla/kernels/data_format_ops.cc. Can this kernel also be updated?

kaixih

comment created time in 2 days

PullRequestReviewEvent

Pull request review commenttensorflow/tensorflow

[MLIR] Add involution based folding to TF

+// RUN: tf-opt %s -tf-interface-optimize-pass | FileCheck %s++// CHECK-LABEL: testSingleConj+func @testSingleConj(%arg0: tensor<8x16x32x64xcomplex<f32>>) -> tensor<8x16x32x64xcomplex<f32>> {+  %0 = "tf.Conj"(%arg0) : (tensor<8x16x32x64xcomplex<f32>>) -> tensor<8x16x32x64xcomplex<f32>>

https://llvm.org/docs/CommandGuide/FileCheck.html#filecheck-regex-matching-syntax has some documentation on FileCheck string regex and substitution.

ahmedsabie

comment created time in 3 days

PullRequestReviewEvent

Pull request review commenttensorflow/tensorflow

[MLIR] Add involution based folding to TF

+/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.

nit: 2020

ahmedsabie

comment created time in 3 days

Pull request review commenttensorflow/tensorflow

[MLIR] Add involution based folding to TF

+// RUN: tf-opt %s -tf-interface-optimize-pass | FileCheck %s++// CHECK-LABEL: testSingleConj+func @testSingleConj(%arg0: tensor<8x16x32x64xcomplex<f32>>) -> tensor<8x16x32x64xcomplex<f32>> {+  %0 = "tf.Conj"(%arg0) : (tensor<8x16x32x64xcomplex<f32>>) -> tensor<8x16x32x64xcomplex<f32>>

Can values be captured with regex and used instead of relying on the printer printing a certain value? For this case, it can be something like

// CHECK-LABEL: testSingleConj
// CHECK-SAME:  ([[ARG0:%.+]]: tensor<8x16x32x64xcomplex<f32>>)
func @testSingleConj(%arg0: tensor<8x16x32x64xcomplex<f32>>) -> tensor<8x16x32x64xcomplex<f32>> {
  // CHECK: [[CONJ:%.+]] = "tf.Conj"([[ARG0]])
  %0 = "tf.Conj"(%arg0) : (tensor<8x16x32x64xcomplex<f32>>) -> tensor<8x16x32x64xcomplex<f32>>
  // CHECK: return [[CONJ]]
  return %0: tensor<8x16x32x64xcomplex<f32>>
}

Same with other tests below.

ahmedsabie

comment created time in 3 days

Pull request review commenttensorflow/tensorflow

[MLIR] Add involution based folding to TF

+// RUN: tf-opt %s -tf-interface-optimize-pass | FileCheck %s++// CHECK-LABEL: testSingleConj+func @testSingleConj(%arg0: tensor<8x16x32x64xcomplex<f32>>) -> tensor<8x16x32x64xcomplex<f32>> {

nit: I believe this test can be simplified by using a scalar tensor tensor<complex<f32>>

ahmedsabie

comment created time in 3 days

Pull request review commenttensorflow/tensorflow

[MLIR] Add involution based folding to TF

 class CwiseBinary : public TraitBase<ConcreteType, CwiseBinary> {}; template <typename ConcreteType> class CwiseUnary : public TraitBase<ConcreteType, CwiseUnary> {}; +// Unary element wise function that is a self inverse, example tf.Negate operation+template <typename ConcreteType>+class Involution : public TraitBase<ConcreteType, Involution> {};

Can verifyTrait be implemented, checking if the op has one operand and one result?

ahmedsabie

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commenttensorflow/tensorflow

Enable FusedBatchNormV3 ops to support 5D tensors

 Status LayoutSensitiveOpTransposer::UpdateNode(TransposeContext* context, Status DefaultLayoutSensitiveOpTransposer::TransposeNode(     TransposeContext* context, utils::MutableNodeView* node) {   DCHECK(IsDefaultLayoutSensitiveOp(*node->node()));-  if (!ShouldProcess(*context, *node) || !IsFanoutPortRankN(*node, 0, 4)) {+  const auto* output_shape_attr = node->GetAttr(kAttrOutputShape);+  const auto& shape = output_shape_attr->list().shape(0);+  const int rank = shape.dim_size();+  std::string src_format = context->src_format;+  std::string dst_format = context->dst_format;+  // Update the format from 4D to 5D layout if necessary.+  if (rank == 5) {+    std::string src_format_3d = src_format == "NHWC" ? "NDHWC" : "NCDHW";

Can this and the change below related to checking 4D data formats and upgrading to 5D data formats be updated to match https://github.com/tensorflow/tensorflow/pull/43226?

kaixih

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commenttensorflow/tensorflow

DataFormatDimMap supports 5D tensors and grappler layout optimizer supports ReduceOps for 5D tensors

 def testLeakyReluGrad(self):       self._assert_trans_nchw_to_nhwc('LeakyReluGrad-0-0', nodes)       self.assertAllClose(output_val_ref, output_val, atol=1e-3) +  @test_util.deprecated_graph_mode_only+  def testReduceOpsFor5DTensors(self):+    if test.is_gpu_available(cuda_only=True):+      random_seed.set_random_seed(0)+      x = random_ops.truncated_normal([1, 4, 2, 3, 3], seed=0)+      w = random_ops.truncated_normal([2, 2, 2, 3, 3], seed=0)+      gamma = random_ops.truncated_normal([1, 1, 1, 1, 3], seed=0)+      beta = random_ops.truncated_normal([1, 1, 1, 1, 3], seed=0)+      conv3d = gen_nn_ops.conv3d(x, w, [1, 1, 1, 1, 1], 'SAME')+      y = math_ops.reduce_mean(conv3d, [0, 1, 2, 3], keepdims=True)+      output = array_ops.identity(y)++      with session.Session(config=_get_config(False)) as sess:+        output_val_ref = sess.run(output)++      with session.Session(config=_get_config()) as sess:+        metadata = config_pb2.RunMetadata()+        output_val = sess.run(output, run_metadata=metadata)++      nodes = []+      num_transposes = 0+      for node in metadata.cost_graph.node:+        if _is_transpose(node.name):+          num_transposes += 1+        nodes.append(node.name)+        print(node.name)

Can this line be removed? This is triggering one of the format presubmits.

kaixih

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commenttensorflow/tensorflow

DataFormatDimMap supports 5D tensors and grappler layout optimizer supports ReduceOps for 5D tensors

 bool ReduceTransposer::IsReduceAxisSupported( Status ReduceTransposer::TransposeNode(TransposeContext* context,                                        utils::MutableNodeView* node) {   DCHECK(IsReduceOp(*node->node()));-  if (!ShouldProcess(*context, *node) || !IsFaninPortRankN(*node, 0, 4) ||+  const auto& regular_fanin = node->GetRegularFanin(0);+  const auto* output_shape_attr =+      regular_fanin.node_view()->GetAttr(kAttrOutputShape);+  const auto& shape = output_shape_attr->list().shape(0);+  const int rank = shape.dim_size();+  std::string src_format = context->src_format;+  std::string dst_format = context->dst_format;+  // Update the format from 4D to 5D layout if necessary.+  if (rank == 5) {+    std::string src_format_3d = src_format == "NHWC" ? "NDHWC" : "NCDHW";

If I remembered correctly the actual transposers can support other layouts. The optimizer though restricts the layouts, along with some GPU specific bits. I think it is a bit safer to only allow the 5d upgrade in the transposers if the layouts are of NHWC and NCHW for now (if the optimizer is updated to support other layouts).

kaixih

comment created time in 7 days

PullRequestReviewEvent

Pull request review commenttensorflow/tensorflow

DataFormatDimMap supports 5D tensors and grappler layout optimizer supports ReduceOps for 5D tensors

 bool ReduceTransposer::IsReduceAxisSupported( Status ReduceTransposer::TransposeNode(TransposeContext* context,                                        utils::MutableNodeView* node) {   DCHECK(IsReduceOp(*node->node()));-  if (!ShouldProcess(*context, *node) || !IsFaninPortRankN(*node, 0, 4) ||+  const auto& regular_fanin = node->GetRegularFanin(0);+  const auto* output_shape_attr =+      regular_fanin.node_view()->GetAttr(kAttrOutputShape);+  const auto& shape = output_shape_attr->list().shape(0);+  const int rank = shape.dim_size();+  std::string src_format = context->src_format;+  std::string dst_format = context->dst_format;+  // Update the format from 4D to 5D layout if necessary.+  if (rank == 5) {+    std::string src_format_3d = src_format == "NHWC" ? "NDHWC" : "NCDHW";

This seems very specific to CPU to GPU in regards to data formats. Can we check if the original src_formats and dst_formats are NHWC and NCHW only before applying this?

kaixih

comment created time in 7 days

PullRequestReviewEvent
PullRequestReviewEvent

push eventllvm/llvm-project

Andy Ly

commit sha 3c2e2df8d03e8ac8e7be1733950993090f2b4710

[MLIR][ODS] Add constBuilderCall for TypeArrayAttr constBuilderCall was not defined for TypeArrayAttr, resulting in tblgen not emitting the correct code when TypeArrayAttr is used with a default valued attribute. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D87907

view details

push time in 7 days

Pull request review commenttensorflow/tensorflow

[TF:MLIR] Legalize tf.diag with tf2xla

 this op runs. The length of the list is returned in two cases:   ); } +def TF_DiagOp : TF_Op<"Diag", [NoSideEffect]> {

Can you add SameOperandsAndResultElementType trait to this op?

WindQAQ

comment created time in 2 months

fork andyly/DOOM-FX

Doom/FX for Super Nintendo with SuperFX GSU2A

fork in 2 months

startedRandalLinden/DOOM-FX

started time in 2 months

startedgoogle/iree

started time in 3 months

startedtensorflow/mlir

started time in 3 months

startedtensorflow/tensorflow

started time in 3 months

startedllvm/llvm-project

started time in 3 months

more