-
Notifications
You must be signed in to change notification settings - Fork 797
[SYCL] Pass buffer_location property to buffer #5604
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
Conversation
This reverts commit 34a4689.
This reverts commit a68ee9cf2bd421fb67fdf6e6e9be0a18b0d43f6b.
sycl/test/abi/vtable.cpp
Outdated
// CHECK-NEXT: 11 | void sycl::detail::SYCLMemObjI::addOrReplaceAccessorProperties(const sycl::property_list &) [pure] | ||
// CHECK-NEXT: 12 | void sycl::detail::SYCLMemObjI::deleteAccessorProperty(const sycl::detail::PropWithDataKind &) [pure] |
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.
Isn't this an ABI break?
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.
Remove virtual functions
/summary:run |
The test
|
I suggest filing a bug report on the spec and ask for fix ETA. Please, update the link to the spec and fix punctuation in the description. |
Just confirming that this the issue in the spec and it's going to be fixed by adding a new device aspect might be enough to implement a proper test fix. |
.wait(); | ||
std::shared_ptr<sycl::detail::buffer_impl> BufImpl = | ||
sycl::detail::getSyclObjImpl(Buf); | ||
EXPECT_EQ( |
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.
Why buffer impl is used here instead of PassedLocation
?
If the property shouldn't be there in call to piMemBufferCreate
then it should be checked.
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.
There is no kernel in the command group above, so piMemBufferCreate
will not be called. This check verifies that new buffer_location is passed to the buffer properties. Check that this value is passed correctly is placed above
https://github.com/intel/llvm/pull/5604/files/4d548846221b21799da61a62f7755bc33b59f829#diff-8e8ed34037520ee5405a46f25d39b96ff066f684a71560371fd3258ac46be9f8R146
.wait(); | ||
|
||
EXPECT_EQ( | ||
BufImpl->has_property<sycl::property::buffer::detail::buffer_location>(), |
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.
Same.
Co-authored-by: sergei <[email protected]>
sycl/source/detail/context_impl.cpp
Outdated
auto Plugin = getPlugin(); | ||
for (auto &Device : MDevices) { | ||
const RT::PiDevice PiDevice = getSyclObjImpl(Device)->getHandleRef(); | ||
if (Plugin.call_nocheck<detail::PiApiKind::piDeviceGetInfo>( | ||
PiDevice, (pi_device_info)PI_MEM_PROPERTIES_ALLOC_BUFFER_LOCATION, | ||
sizeof(pi_device_info), &device_info, &return_size) != PI_SUCCESS) { | ||
SupportBufferLocationByDevices = NotSupported; | ||
break; | ||
} | ||
} |
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 think this specific way of calling get device info will always return false since the lower level runtime currently does not support passing PI_MEM_PROPERTIES_ALLOC_BUFFER_LOCATION
into the get device info API. Is there no other way of determining whether the target is an FPGA that does not rely on lower level runtime?
If we do this, then the OpenCL Spec has to be changed.
P.S refer to the opencl spec for what can be done with the property
https://github.com/KhronosGroup/OpenCL-Docs/blob/main/extensions/cl_intel_mem_alloc_buffer_location.asciidoc
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.
Although technically the opencl spec is written in a way that enforces all vendor's runtime to accept this property, so technically it should be fine to directly pass it into other runtime (although they may do nothing with the property).
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.
Is there no other way of determining whether the target is an FPGA that does not rely on lower level runtime?
We can determine if the device is FPGA or not in runtime. I tried to do this in ccf73a6
Do you think it would be better to just check if a device is FPGA or not?
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.
Yes I do think it is better to check if a device is FPGA directly, because even if it error out on FPGA device, it will prompt the other vendor to support passing in of buffer location feature in their runtime API. (Technically all vendor should support this property anyways)
------------------------------------------------------ Currently sycl runtime is trying to distinguish whether buffer location is supported on the target device using lower level runtime getDeviceInfo call to determine it. However current runtime get device info does not yet support accepting the buffer location property yet, this change addes it. The referenced sycl runtime PR: intel/llvm#5604
------------------------------------------------------ Currently sycl runtime is trying to distinguish whether buffer location is supported on the target device using lower level runtime getDeviceInfo call to determine it. However current runtime get device info does not yet support accepting the buffer location property yet, this change addes it. The referenced sycl runtime PR: intel/llvm#5604
/summary:run |
PropWithDataKindSize = 5 | ||
AccPropBufferLocation = 5, | ||
PropWithDataKindSize = 6, |
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.
Is there any reason why new enum is not added at the end?
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.
Feel free to ignore, I found the reason: there is a comparison somewhere where all other enum of the same type cannot exceed this last enum.
if (PropKind >= PropWithDataKind::PropWithDataKindSize) |
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.
Is this an ABI breaking change given that PropWithDataKindSize
changed from 5 -> 6? If there are existing object file that assumes PropWithDataKindSize
is 5?
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.
It is not an ABI breaking change, because it is not a property and it is used only in property_list_base.hpp
@s-kanaev could you, please, review? |
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.
LGTM, The latest change passes internal test and has the expected behavior.
Wait for others' approval though.
Update spec accordingly to the changes from #5604. buffer_location property will be ignored if the device it passed to doesn't support it. Signed-off-by: mdimakov <[email protected]>
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.
LGTM overall
sycl/source/detail/context_impl.hpp
Outdated
@@ -177,6 +182,7 @@ class context_impl { | |||
std::map<std::pair<DeviceLibExt, RT::PiDevice>, RT::PiProgram> | |||
MCachedLibPrograms; | |||
mutable KernelProgramCache MKernelProgramCache; | |||
mutable PropertySupport SupportBufferLocationByDevices; |
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.
mutable PropertySupport SupportBufferLocationByDevices; | |
mutable PropertySupport MSupportBufferLocationByDevices; |
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.
Done
@@ -33,4 +33,5 @@ add_subdirectory(program_manager) | |||
add_subdirectory(assert) | |||
add_subdirectory(Extensions) | |||
add_subdirectory(windows) | |||
add_subdirectory(event) |
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.
That's an interesting change in this late commit...
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 tried to resolve merge conflict. This line has already added to CMakeLists.txt
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.
LGTM
/summary:run |
There is the accessor property "buffer_location" that allows to allocate buffer in definite location (spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/supported/sycl_ext_intel_buffer_location.asciidoc)
Current implementation doesn't implement allocating a buffer at the passed location and the buffer will be re-sided when a kernel is enqueued. It leads to problems of various kinds.
The proposed solution implies adding new buffer property in order to store it in a buffer and use it when the buffer is allocated.
If the property is not supported by device it will be ignored.
Signed-off-by: mdimakov [email protected]