-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dygraph Prim code gen (node.cc) #33
dygraph Prim code gen (node.cc) #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments
@@ -2328,6 +2354,9 @@ def GenerateNodeDefinition( | |||
var_str += f"\n{indent} output_str += output_{new_name}_str; " | |||
|
|||
log_str = AFTER_LOG_PRINT_TEMPLATE.format(var_str) | |||
# TODO Ruting modify in the future |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO with wrong format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modified
@@ -1826,16 +1833,19 @@ def GenerateHigherOrderNodeCreationCode(self): | |||
is_invoke_forward_api = IsInvokeForwardApi( | |||
self.grad_api_contents, self.forward_apis_dict | |||
) | |||
is_composite_forward_api = False if self.composite_func_info == [] else True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why composite forward api?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace by composite grad api
next_grad_node_creation_str, | ||
next_grad_node_out_list, | ||
next_node_generator.backward_forward_inputs_map, | ||
) | ||
elif not is_invoke_forward_api: | ||
elif not is_invoke_forward_api and not is_composite_forward_api: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if it hits else branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if is_invoke_farward_api or is_composite_grad_api next_grad_node_creation_str should be none, we will add this when delete Flags_prim_enabled
add TODO here
@@ -2225,6 +2241,16 @@ def GenerateNodeDefinition( | |||
{out_assign_str}}} else {{ | |||
{indent}{autograd_api_out} api_output = paddle::experimental::{self.namespace}{self.grad_api_contents['invoke']}; | |||
{out_assign_str}{indent}}} | |||
""" | |||
elif is_composite_grad_api: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave TODO here to indicate strategy which will be used later, such as using composite only when we don't have backward kernel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be statically generated here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one comment
@@ -2,3 +2,8 @@ cc_library( | |||
static_utils | |||
SRCS static_utils.cc | |||
DEPS proto_desc operator static_global_utils) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid this ON INFER and NO PYTHON
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments
dygraph_function dygraph_node) | ||
|
||
cc_test_old( | ||
set(prim_generated_deps final_dygraph_function final_dygraph_node dygraph_function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change this?
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe no need to push these code in this pr?
@@ -47,8 +47,8 @@ add_custom_target( | |||
${forwards_cc_path} | |||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${tmp_forwards_h_path} | |||
${forwards_h_path} | |||
# COMMAND ${CMAKE_COMMAND} -E copy_if_different ${tmp_nodes_cc_path} | |||
# ${nodes_cc_path} | |||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${tmp_nodes_cc_path} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove additional generated files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types