Skip to content

Conversation

@peri044
Copy link
Collaborator

@peri044 peri044 commented Feb 2, 2022

Description

Implement a patch for gelu schema change in older NGC containers

Fixes #776

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes

@github-actions github-actions bot added component: core Issues re: The core compiler component: lowering Issues re: The lowering / preprocessing passes component: tests Issues re: Tests labels Feb 2, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some changes that do not conform to C++ style guidelines:

diff --git a/workspace/core/lowering/passes/reduce_gelu.cpp b/tmp/changes.txt
index 15315ba..946df75 100644
--- a/workspace/core/lowering/passes/reduce_gelu.cpp
+++ b/tmp/changes.txt
@@ -12,8 +12,8 @@ void ReduceGelu(std::shared_ptr<torch::jit::Graph>& graph) {
            %out : Tensor = aten::gelu(%x)
            return (%out))IR";

-  // This gelu_approximate_pattern schema exists in 21.11, 21.12, 22.01 containers of pytorch. These container versions use
-  // an unmerged PR in pytorch : https://github.com/pytorch/pytorch/pull/61439. We reduce this to regular Gelu.
+  // This gelu_approximate_pattern schema exists in 21.11, 21.12, 22.01 containers of pytorch. These container versions
+  // use an unmerged PR in pytorch : https://github.com/pytorch/pytorch/pull/61439. We reduce this to regular Gelu.
  std::string gelu_approximate_pattern = R"IR(
        graph(%x : Tensor, %approx):
            %out : Tensor = aten::gelu(%x, %approx)
@@ -64,7 +64,8 @@ void ReduceGelu(std::shared_ptr<torch::jit::Graph>& graph) {
  map_gelu_to_pointwise_ops.runOnGraph(graph);

  torch::jit::SubgraphRewriter map_gelu_approximate_to_pointwise_ops;
-  map_gelu_approximate_to_pointwise_ops.RegisterRewritePattern(gelu_approximate_pattern, gelu_reduce_multi_input_pattern);
+  map_gelu_approximate_to_pointwise_ops.RegisterRewritePattern(
+      gelu_approximate_pattern, gelu_reduce_multi_input_pattern);
  map_gelu_approximate_to_pointwise_ops.runOnGraph(graph);

  LOG_GRAPH("Post lowering of [aten::gelu] -> " << *graph);
ERROR: Some files do not conform to style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

@narendasan narendasan added the Upstreaming PR Upstreaming changes from an NGC release branch label Feb 4, 2022
@narendasan narendasan merged commit e752601 into master Apr 9, 2022
@narendasan narendasan deleted the gelu_fixes branch April 9, 2022 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: core Issues re: The core compiler component: lowering Issues re: The lowering / preprocessing passes component: tests Issues re: Tests Upstreaming PR Upstreaming changes from an NGC release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

could not support gelu?

3 participants