-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Move Dygraph Indexing Parsing to Pybind #58643
Move Dygraph Indexing Parsing to Pybind #58643
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
33bfca4
to
69667ba
Compare
…th from stack to unsqueeze
1b68a46
to
5978d2d
Compare
5978d2d
to
3e239fd
Compare
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
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
* start down to pybind * basic-getitem down * fix compile error; basic-getitem seems work fine * finish advanced-getitem, runs well but still has bug to fix * fix parsing bug; getitem seems ok * finish setitem, still has bug to fix * fix some bug in advanced setitem * fix CI error about bool-tensor indexing * fix advance-indexing ci error * remove transpose if there is no need * support single py_boolean in index * add assert densetensor to avoid error in auto-parallel mode * add fast path for case single int tensor in getitem * change set_value_dygraph_function to ad_func * change vector type and fix the set_value_grad ut * fix inplace version error in backward by assign * remove any-check in bool tensor to boost getitem * remove no-used python code, keep xpu code to fix; py-code add fast path from stack to unsqueeze * fix py_bool cuda error * fix cuda config error when gpu_memory_available after all-false bool-tensor indexing * fix ci in 0-size gather_nd indexing * add dist tensor check
PR types
Performance optimization
PR changes
Others
Description
Pcard-66985
For now, although there there is already complete indexing (i.e.
__getitem__
/__setitem__
) functional support, almost all the indexing parsing parts are running in Python, which brings much performance overhead.In this PR, we move indexing parsing of dygraph from Python to Pybind, aiming to optimize the performance (For static mode, still in Python).
some other things in this pr:
x[tensor[1,2]]
): by replace thestack
tounsqueeze
.transpose
in advanced getting.any
check in bool-mask indexing, since the any kernel and gpu->cpu memcpy is quite slow.cond
in bool-mask indexing, since currently this conditional block cannot be parsed in PIRFor convenience of review, the old indexing-parsing code will be deleted later.