Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add buffer location enum #34

Merged
merged 1 commit into from
Jan 24, 2022
Merged

Conversation

sherry-yuan
Copy link
Contributor

@sherry-yuan sherry-yuan commented Dec 3, 2021

Sycl runtime calls clEnqueueWriteBuffer before clSetKernelArgs, this cause the buffer to be allocated on the device before knowing the right place of allocating the memory. As a result, later when kernel get invoked, the memory has to be copied from device's default global memory to the buffer location specified in kernel. This is an additional memory copy operation.

This extension does not interfer with the other way of setting buffer location (i.e through clSetKernelArgs). This property exist for integration with sycl runtime, not for pure opencl user to use. If opencl user wish to use this property, they have to make sure the buffer location passed into clCreateBufferWithPropertyINTEL has to match the one defined in kernel function interface, otherwise the extra memory copy issue will remain.

When resizing reserved allocation, we now have the information to allocate minimum amount of space required according to the property passed in.

@pcolberg pcolberg added this to the 2022.2 milestone Dec 7, 2021
@sherry-yuan sherry-yuan force-pushed the buffer_location branch 3 times, most recently from 630349d to 6b013eb Compare December 13, 2021 22:48
@sherry-yuan sherry-yuan marked this pull request as ready for review December 13, 2021 22:57
@pcolberg pcolberg marked this pull request as draft December 13, 2021 23:18
@sherry-yuan
Copy link
Contributor Author

sherry-yuan commented Jan 19, 2022

This change is almost ready to go, the enum made into public khronos repo. I will make a separate PR to sync upstream headers, and then polish this a little.

PR that sync Khronos header is here

@sherry-yuan
Copy link
Contributor Author

This change is ready to go.

@pcolberg pcolberg marked this pull request as ready for review January 21, 2022 20:06
Copy link
Contributor

@pcolberg pcolberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sherry-yuan, great work!

Could you amend the commit message with links to the corresponding PRs in the OpenCL specification and header repositories?

src/acl_mem.cpp Outdated Show resolved Hide resolved
test/acl_mem_test.cpp Show resolved Hide resolved
Copy link
Contributor

@pcolberg pcolberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Sherry for the testing! One minor change for Klocwork and it is ready to be merged.

test/acl_mem_test.cpp Outdated Show resolved Hide resolved
Sycl runtime calls clEnqueueWriteBuffer before clSetKernelArgs, this cause the buffer to be allocated on the device before knowing the right place of allocating the memory. As a result, later when kernel get invoked, the memory has to be copied from device's default global memory to the buffer location specified in kernel. This is an additional memory copy operation.

This extension does not interfer with the other way of setting buffer location (i.e through clSetKernelArgs). This property exist for integration with sycl runtime, not for pure opencl user to use. If opencl user wish to use this property, they have to make sure the buffer location passed into clCreateBufferWithPropertyINTEL has to match the one defined in kernel function interface, otherwise the extra memory copy issue will remain.

When resizing reserved allocation, we now have the information to allocate minimum amount of space required according to the property passed in.

This is done to align with opencl docs and header in;

KhronosGroup/OpenCL-Headers#193

KhronosGroup/OpenCL-Docs#746
@pcolberg pcolberg merged commit b08e0af into intel:main Jan 24, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants