Skip to content
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

Reuse memory in SYCL parallel_scan #3899

Merged
merged 6 commits into from
Apr 27, 2021

Conversation

masterleinad
Copy link
Contributor

Based on top of #3873. This should be the last occurrence of a raw call to sycl::malloc outside of SYCLDeviceUSMSpace::allocate() or SYCLSharedUSMSpace::allocate()

@masterleinad masterleinad force-pushed the sycl_reuse_memory_parallel_scan branch from 7283ec1 to 2f7e870 Compare March 31, 2021 18:24
@masterleinad masterleinad marked this pull request as ready for review March 31, 2021 18:24
@masterleinad
Copy link
Contributor Author

Retest this please.

@masterleinad masterleinad requested a review from nliber April 2, 2021 15:27
// FIXME_SYCL consider only storing one value per block and recreate initial
// results in the end before doing the final pass
m_scratch_space = static_cast<pointer_type>(
instance.scratch_space(sizeof(value_type) * total_memory));
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't total_memory already take into account sizeof(value_type)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, you're right.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +227 to +238
std::size_t total_memory = 0;
{
size_t wgroup_size = 32;
size_t n_nested_size = len;
size_t n_nested_wgroups;
do {
total_memory += sizeof(value_type) * n_nested_size;
n_nested_wgroups = (n_nested_size + wgroup_size - 1) / wgroup_size;
n_nested_size = n_nested_wgroups;
} while (n_nested_wgroups > 1);
total_memory += sizeof(value_type) * wgroup_size;
}
Copy link
Member

Choose a reason for hiding this comment

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

Comment on what is going on here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@masterleinad
Copy link
Contributor Author

Retest this please.

1 similar comment
@masterleinad
Copy link
Contributor Author

Retest this please.

@crtrott crtrott merged commit 2324959 into kokkos:develop Apr 27, 2021
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.

None yet

4 participants