Skip to content

Conversation

@aelovikov-intel
Copy link
Contributor

No description provided.

@aelovikov-intel aelovikov-intel requested a review from a team as a code owner July 11, 2022 21:26
auto getNoInitWriteAcc(size_t Size, handler &CGH) {
MOutBufPtr = std::make_shared<buffer<T, buffer_dim>>(range<1>(Size));
CGH.addReduction(MOutBufPtr);
return MOutBufPtr->template get_access<access::mode::discard_write>(CGH);
Copy link
Contributor

Choose a reason for hiding this comment

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

"discard_write" is deprecated in SYCL 2020, please use "write"

Copy link
Contributor

@v-klochkov v-klochkov left a comment

Choose a reason for hiding this comment

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

Looks good in general, but

  1. requires answer to question about -fno-unnamed-lambda.

  2. The dynamic check of UseExtraKernelForInit and 2 calls of 'Rest' causes the code-duplication (2 versions of device code). Is that right? Does it worth the benefit coming from a bit faster initialization of Groups-Counter?

  3. The code and PR description need more comments explaining why one way is better than the other.
    Otherwise, sometime later someone may want to unify the code deleting the device code-duplication


bool UseExtraKernelForInit =
NWorkGroups > 1 && !sycl::detail::getDeviceFromHandler(CGH)
.get_info<info::device::host_unified_memory>();
Copy link
Contributor

Choose a reason for hiding this comment

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

"info::device::host_unified_memory" is deprecated in SYCL 2020.

std::shared_ptr<detail::queue_impl> QueueCopy = CGH.MQueue;
auto Event = CGH.withAuxHandler(QueueCopy, [&](handler &InitHandler) {
auto Acc = Buf->get_access<access::mode::discard_write>(InitHandler);
InitHandler.single_task([=]() { Acc[0] = 0; });
Copy link
Contributor

Choose a reason for hiding this comment

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

This would work because unnamed-lambda functions mode is ON by default now (because the default value of it depends on sycl-std, which is set to 2020 by default now).

It will not work with -fno-sycl-unnamed-lambda, IMO.

return {*CounterBuf, CGH};
}

auto getGroupsCounterAccDiscrete(handler &CGH) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment section describing the func, params and return.

@aelovikov-intel
Copy link
Contributor Author

Alternative implementation: aelovikov-intel#1

@aelovikov-intel aelovikov-intel deleted the reduction-discrete branch August 25, 2022 20:10
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

Successfully merging this pull request may close these issues.

2 participants