Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 issue #1956] use 64bit index in im2col3d.cl #1966
[Fix issue #1956] use 64bit index in im2col3d.cl #1966
Changes from 5 commits
6e825a6
5d67548
9029877
7093e53
fd03a75
2cc4bf4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
[Performance]
* sizeof(ConstData_t)
, which issizeof(void*) == 8
for HIP backend? In the shader,where max value of im_ch is in_c, right?
Multiplying this to 8 looks like an overkill.
0xffffffffULL
(4 GiB - 1). In the kernel, computations are performed asint
, which has max value of0x7fffffffULL
(2 GiB - 1).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.
@zjing14 please comment. Thanks!
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.
@zjing14 WRT question 1.
AFAICSsizeof(ConstData_t)
it should beGetTypeSize(type)
, which matchessizeof(_FLOAT)
in the kernel, right? It should be either 4 (fp32) or 2 (fp16), I think.UPDATE: Please ignore point 1. We do not need to take the size of element into account because
col_off
is actually not an offset but an index in the arraycol
. Index is multiplied by thesizeof(col[0])
automatically.Question 2 remains the same.
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.
Yes, it should be
sizeof(ConstData_t)
.Yes,
0x7fffffffULL
(2 GiB - 1) makes sense or we change it tounsigned int
.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.
@zjing14 Thanks for answering!
Excuse me, but I do not understand why. AFAIU the goal is to prevent overflows in the following computations in the shader:
https://github.com/ROCmSoftwarePlatform/MIOpen/blob/7ad167d2ecdc29ccebdf965055e1b1a8b9a835a8/src/kernels/MIOpenCol2Im3d.cl#L87-L91
and
https://github.com/ROCmSoftwarePlatform/MIOpen/blob/7ad167d2ecdc29ccebdf965055e1b1a8b9a835a8/src/kernels/MIOpenCol2Im3d.cl#L111-L119
For computation of
ch_offset
we do not need the* sizeof(ConstData_t)
multiplier at all.Is this multiplier necessary to prevent overflow during computation of
col_off
?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.
Yes. You are right, the goal of
int64_t
is to prevent index overflow. We need to make sure all indicesch_offset
andcol_off
do not overflow.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.
We may change indices in the kernel to
unsigned int
for 32bit. It may improve performance for some cases where indices > 16bit but < 32bit.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.
@zjing14 Thanks for feedback. And yes, I'll change to unsigned. But what about removal of
* sizeof(ConstData_t)
from the computation of index_size? Is it Ok to do that or I am missing something?