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

Update SYCL UniqueToken avoiding bitset #4748

Merged
merged 8 commits into from
Feb 15, 2022

Conversation

masterleinad
Copy link
Contributor

@masterleinad masterleinad commented Feb 2, 2022

This corresponds to #4741. I see similar speed-ups.

@masterleinad masterleinad added the Blocks Promotion Overview issue for release-blocking bugs label Feb 2, 2022
@ajpowelsnl
Copy link
Contributor

Hi @masterleinad -- A couple of questions: 1) will this PR be in the 3.6 release? 2) if it will be in 3.6, is it still a blocker?

@ajpowelsnl ajpowelsnl added this to In progress in Kokkos Release 3.7 -- 2022 Target Date via automation Feb 7, 2022
@ajpowelsnl ajpowelsnl removed the Blocks Promotion Overview issue for release-blocking bugs label Feb 7, 2022
@masterleinad
Copy link
Contributor Author

@ajpowelsnl Is there a reason to remove the BlocksPromotion label here if #4741 still has it?

@masterleinad
Copy link
Contributor Author

Hi @masterleinad -- A couple of questions: 1) will this PR be in the 3.6 release? 2) if it will be in 3.6, is it still a blocker?

I think we should treat it the same as #4741.

@ajpowelsnl
Copy link
Contributor

Hi @masterleinad -- A couple of questions: 1) will this PR be in the 3.6 release? 2) if it will be in 3.6, is it still a blocker?

I think we should treat it the same as #4741.

Yes, I just spoke with Christian about it, and the unique token stuff will go in Kokkos 3.6 (including the work in this PR). Thanks for responding!

@masterleinad masterleinad added the Blocks Promotion Overview issue for release-blocking bugs label Feb 9, 2022
@masterleinad masterleinad added this to In progress in Kokkos Release 3.6 via automation Feb 9, 2022
@masterleinad masterleinad moved this from In progress to Awaiting Feedback in Kokkos Release 3.6 Feb 9, 2022
@masterleinad
Copy link
Contributor Author

Retest this please.

1 similar comment
@masterleinad
Copy link
Contributor Author

Retest this please.

@masterleinad
Copy link
Contributor Author

OpenMPTarget failing with an internal compiler error is clearly unrelated,

Copy link
Member

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

Will approve once we clarify the question about the UniqueToken<SYCL, UniqueTokenScope::Instance> constructors.

core/src/SYCL/Kokkos_SYCL_Instance.cpp Show resolved Hide resolved
Comment on lines 111 to 113
int idx = (blockIdx[0] * (blockDim[0] * blockDim[1]) +
threadIdx[1] * blockDim[0] + threadIdx[0]) %
size();
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer if you split the expression in two and had idx = idx % size(); like we do in CUDA

Comment on lines 160 to 172
UniqueToken(size_type max_size,
execution_space const& arg = execution_space())
: UniqueToken<SYCL, UniqueTokenScope::Global>(max_size, arg) {}
Copy link
Member

Choose a reason for hiding this comment

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

Should this one be declared explicit too? ( I know we didn't in CUDA)
Also why is it OK to only have two constructors when we had 4 in CUDA?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cuda has

  explicit UniqueToken()
      : UniqueToken<Cuda, UniqueTokenScope::Global>(
            Kokkos::Cuda().concurrency()) {}
  explicit UniqueToken(execution_space const& arg)
      : UniqueToken<Cuda, UniqueTokenScope::Global>(
            Kokkos::Cuda().concurrency(), arg) {}
  UniqueToken(size_type max_size)
      : UniqueToken<Cuda, UniqueTokenScope::Global>(max_size) {}
  UniqueToken(size_type max_size,
              execution_space const& arg = execution_space())
      : UniqueToken<Cuda, UniqueTokenScope::Global>(max_size, arg) {}

In the current form, the first two Cuda constructors are the same as the first one here and the last two Cuda constructors are the same as the second one here. In fact, the third constructor in Cuda (and HIP) should just be removed since trying to use is would be ambiguous taking the last constructor into account.

Of course, we could argue about not using default arguments to be able to only mark the constructors taking one argument as explicit. In the end, that only matters for copy initialization with an initializer list. I agree, though, that we should make all specializations for UniqueToken have the same interface.

@dalg24 dalg24 requested a review from crtrott February 12, 2022 03:33
@masterleinad
Copy link
Contributor Author

Again, only OpenMPTarget is failing with an internal compiler error.

@masterleinad
Copy link
Contributor Author

Retest this please.

@dalg24 dalg24 merged commit dd709bd into kokkos:develop Feb 15, 2022
Kokkos Release 3.6 automation moved this from Awaiting Feedback to Done Feb 15, 2022
@dalg24 dalg24 removed the Blocks Promotion Overview issue for release-blocking bugs label Feb 15, 2022
@masterleinad masterleinad deleted the sycl-unique-token-improvement branch February 15, 2022 15:15
@ajpowelsnl ajpowelsnl added the InDevelop Enhancement, fix, etc. has been merged into the develop branch; label Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
InDevelop Enhancement, fix, etc. has been merged into the develop branch;
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants