-
Notifications
You must be signed in to change notification settings - Fork 48
[cl] Permit size 0 in clEnqueue(Read|Write|Copy|Fill)Buffer #387
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
base: main
Are you sure you want to change the base?
[cl] Permit size 0 in clEnqueue(Read|Write|Copy|Fill)Buffer #387
Conversation
d427afc to
679de07
Compare
This is not explicitly forbidden by the current unified OpenCL specification for clEnqueueReadBuffer, clEnqueueWriteBuffer, or clEnqueueCopyBuffer; though it *was* forbidden up to and including OpenCL 2.0. Therefore, make the checks for size 0 dependent on the OpenCL version being built. A size of zero for clEnqueueFillBuffer has always been valid, so explicitly test that. The muxCommandFillBuffer function forbids a size of 0, so it was a bug to call that function when size was 0. This requires updating the mux specification to allow sizes of 0 in all of these functions. It also implicitly allows the same in the HAL, though this is not as tightly specified.
679de07 to
677b9bb
Compare
| inBuffer, 0, nullptr, nullptr)); | ||
| TEST_F(clEnqueueReadBufferTest, SizeZero) { | ||
| // An error when size == 0 was removed starting with OpenCL 2.1. | ||
| if (UCL::isDeviceVersionAtLeast({2, 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.
Do we test OpenCL <3.0 anywhere?
| } | ||
| if (!mem_write(dst, temp.data(), size, locker)) { | ||
| return false; | ||
| if (size) { |
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.
I'm assuming this is because mem_read and mem_write still require size to be greater than zero? Are they used anywhere directly where a size of zero should be allowed?
|
Hi @frasercrmck, do you think we should just close this one now? |
Blast from the past. I've personally no drive to get this over the line - I can't even remember why it was required/desired? I'm happy if you want to close it. Presumably it can't be that important if you hadn't needed it in over a year. |
This is not explicitly forbidden by the current unified OpenCL specification for
clEnqueueReadBuffer,clEnqueueWriteBuffer, orclEnqueueCopyBuffer; though it was forbidden up to and including OpenCL 2.0.Therefore, make the checks for size 0 dependent on the OpenCL version being built.
A size of zero for
clEnqueueFillBufferhas always been valid, so explicitly test that. ThemuxCommandFillBufferfunction forbids a size of 0, so it was a bug to call that function when size was 0.