[cl] Permit size 0 in clEnqueue(Read|Write|Copy|Fill)Buffer#387
Open
frasercrmck wants to merge 1 commit intouxlfoundation:mainfrom
Open
[cl] Permit size 0 in clEnqueue(Read|Write|Copy|Fill)Buffer#387frasercrmck wants to merge 1 commit intouxlfoundation:mainfrom
frasercrmck wants to merge 1 commit intouxlfoundation:mainfrom
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
hvdijk
reviewed
Mar 4, 2024
| 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})) { |
Collaborator
There was a problem hiding this comment.
Do we test OpenCL <3.0 anywhere?
hvdijk
reviewed
Mar 4, 2024
| } | ||
| if (!mem_write(dst, temp.data(), size, locker)) { | ||
| return false; | ||
| if (size) { |
Collaborator
There was a problem hiding this comment.
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?
Collaborator
|
Hi @frasercrmck, do you think we should just close this one now? |
Contributor
Author
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.