-
Notifications
You must be signed in to change notification settings - Fork 226
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
miopenGetRNNTrainingReserveSize is not rounded to a convenient boundary #2529
Comments
No, miopenGetRNNTrainingReserveSize returns number of bytes not floats, it may not be a multiple of 4. This is problem of testing file to correctly match API limitations. |
I'm asking us to round up to a multiple of 4 or 8 to be safe so that it's not needed in the tests that use |
This is not correct to work with this buffer as float or double. It contains not only one type. Bigger allocation is not more safe, it will just miss out-of-bounds array errors more often. |
I don't understand. The code (for example |
This is incorrect allocation in GRU test. |
the authors decided to allocate float to simplify their work, but this does not mean that this is the correct solution. |
That little rounding up seems crucial because the tests failed when I took it out. Regardless, the library should return a workspace size that is a multiple of 8 (or 4 at least). The expectation is that the user will allocate memory for that size and almost all allocators already align allocations to 8 byte boundary at least. |
nobody expects that. This is not correct, user can make bigger allocation, but this is not expected or required. |
I disagree but let's leave it at that. |
@shurale-nkn Is the size returned from the API usable directly or does it need to updated for the resulting buffer to be correct ? |
@JehandadKhan User can directly use byte size returned from API. This is a correct and valid value, it does not require modification. |
@JehandadKhan : here's one of many examples where the user code doesn't work if we take out this "round up to next multiple of sizeof(T)" : https://github.com/ROCmSoftwarePlatform/MIOpen/blob/60cf9c095356a58d9ef369856b585ac1f4d39946/test/lstm_common.hpp#L918 |
@amberhassaan This is not example how it doesn't work. This is example how it used in our test, this does not mean that the user cannot use this value directly or computation fails without modification. Please do not mislead others. In PR#2493 you can discover how the test and the user can perfectly use this value without any modifications and everything works correctly. |
All I know is that 1) our tests fail when the size is not rounded up 2) I fail to understand how we return a size that's not multiple of floats when we work with floats. |
As far as I can see 1) the test should be fixed and 2) |
@amberhassaan That's exactly the case for this ticket - the library which allocates the memory (test wrapper) started to demand specific allocation size from the user (MIOpen algorithm) who knows exact amount of memory what he needs and don't care about any sort of internals of allocation routines. |
Test code is having to round up the reserve space size obtained from
miopenGetRNNWorkspaceSize
to the next multiple of 4. This should be done inside the library call. See for exampletest/gru_common.hpp
and search for the above api call. This is also applicable tolstm_common.hpp
andrnn_vanilla_common.hpp
.CC: @JehandadKhan , @junliume
The text was updated successfully, but these errors were encountered: