Skip to content
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

Fix the problem when rnns compatible with cudnn's parameters are created again #31800

Merged
merged 2 commits into from
Mar 23, 2021

Conversation

iclementine
Copy link

PR types

Bug fixes

PR changes

Others

Describe

Test a typical case in static graph usage: create two nearly identical program with a shared startup program to share their parameters.

When creating a parameter, the name is checked. If there is already a parameter with the same name, which is the output of a operator(i.e. its creator), its re-creation is skipped.

But if that parameter has been the output of more than one operators, an exception is raised. For special cases, white list is added. Flattening rnn's parameters for the need to call cudnn kernel is such a case. When a SimpleRNN/GRU/LSTM is compatible with cudnn kernel, the parameters are packed together for the need of cudnn kernel. These parameters are first created by their creators, then they are also the ouput of the packing operator (a.k.a coalesce_tensor).

The parameters' data are possibly copied to a new memory block(packed together), a new tensor pointing to the memory block is created. Also the original parameters' data pointer is pointed to the new address.

So we need to add a white list when creating parameter with the same name twice.

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@iclementine iclementine changed the title Fix rnn Fix the problem when rnns compatible with cudnn's parameters are created again Mar 23, 2021
Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@guoshengCS guoshengCS left a comment

Choose a reason for hiding this comment

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

LGTM

@iclementine iclementine merged commit 4046f13 into PaddlePaddle:develop Mar 23, 2021
@iclementine iclementine deleted the fix_rnn branch March 23, 2021 08:30
iclementine pushed a commit to iclementine/Paddle that referenced this pull request Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants