-
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
fix out_of_range bug of multinomial op's cuda kernel #36511
Conversation
✅ This PR's description meets the template requirements! |
Thanks for your contribution! |
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
Sorry to inform you that 0641bbc's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
… fix-multinomial-op
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 for PADDLE_ENFORCE
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 for PR-CI-OP-benchmark
PR types
Bug fixes
PR changes
OPs
Describe
A bug in
sample
method (multinomial
op) ofCategorical
API is mentioned in issue #36401.issue
Reason for error
In the cuda kernel implementation, the number of threads exceeding the size of the input array will be used to perform calculations (the reason is that the
block
size is limited, when setting thegrid
size, more threads will be set forrounding
).However, when the cuda kernel calculates, it does not limit the array subscripts. As a result, when calculating in the thread, the space exceeding the size of the array is accessed, causing an error.
bug fix
Restrictions on the subscripts of the accessed arrays.