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

Size of buffer is over maxAllocSize #76

Closed
MichalMrozek opened this issue Apr 13, 2021 · 2 comments
Closed

Size of buffer is over maxAllocSize #76

MichalMrozek opened this issue Apr 13, 2021 · 2 comments

Comments

@MichalMrozek
Copy link

In compute tests, following pattern is used:

globalWIs = roundToMultipleOf(t, devInfo.maxWGSize);

uint64_t globalWIs = (devInfo.numCUs) * (devInfo.computeWgsPerCU) * (devInfo.maxWGSize);
uint64_t t = MIN((globalWIs * sizeof(cl_float)), devInfo.maxAllocSize) / sizeof(cl_float);
globalWIs = roundToMultipleOf(t, devInfo.maxWGSize);

cl::Buffer outputBuf = cl::Buffer(ctx, CL_MEM_WRITE_ONLY, (globalWIs * sizeof(cl_float)));

t is computed as minimal of globalWIs * sizeof(cl_float) and maxAllocSize, let's assume that maxAllocSize is smaller.

in next line globalWIs is rounded to the next multiple of maxWGSize, it means it may be larger then t which is computed using maxAllocSize.

That will cause the buffer creation to fail, as it will be above maxAllocSize.

@krrishnarraj
Copy link
Owner

roundToMultipleOf() doesn't round to next multiple, it rounds to an exact or previous multiple.
say if t=100 & devInfo.maxWGSize=64, roundToMultipleOf(t, devInfo.maxWGSize) would be 64

@MichalMrozek
Copy link
Author

ok thanks for confirmation

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

No branches or pull requests

2 participants