Skip to content

[SYCL] Introduce thread-safety for kernels and programs cache #866

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

s-kanaev
Copy link
Contributor

No description provided.

@s-kanaev s-kanaev force-pushed the private/s-kanaev/thread-safe-program-kernel-cache branch from a705759 to 2938404 Compare November 25, 2019 08:06
@s-kanaev
Copy link
Contributor Author

Resolved comments by @AlexeySachkov

romanovvlad
romanovvlad previously approved these changes Nov 25, 2019
Copy link
Contributor

@asavonic asavonic left a comment

Choose a reason for hiding this comment

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

LGTM.

smaslov-intel
smaslov-intel previously approved these changes Nov 26, 2019
Copy link
Contributor

@smaslov-intel smaslov-intel left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@s-kanaev s-kanaev force-pushed the private/s-kanaev/thread-safe-program-kernel-cache branch 2 times, most recently from 2533609 to 05ffed3 Compare November 26, 2019 21:30
@s-kanaev s-kanaev requested a review from asavonic November 27, 2019 13:52
@s-kanaev s-kanaev requested a review from romanovvlad November 27, 2019 16:45
assert(false && "We've build a program that is already have been built.");
}

ProgramWithState->State.store(BS_Built);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use more relaxed memory models for all loads and stores you are adding?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we may use relaxed memory model here as current (sequentially consistent model) makes other threads to synchronize on this variable.

state = WithBuildState->State.load();
}

// expected to be null if state eq BuildFailed
Copy link
Contributor

Choose a reason for hiding this comment

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

How the nullptr is handled on the callers side?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now there will be an exception thrown according to spec.

@s-kanaev s-kanaev force-pushed the private/s-kanaev/thread-safe-program-kernel-cache branch 2 times, most recently from 78ba70e to 84fc26a Compare November 29, 2019 16:07
@s-kanaev s-kanaev force-pushed the private/s-kanaev/thread-safe-program-kernel-cache branch from 84fc26a to 53eebbd Compare December 2, 2019 14:16

Cache.notifyAllBuild();

std::rethrow_exception(std::current_exception());
Copy link
Contributor

Choose a reason for hiding this comment

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

Is just

throw;

not enough?

@s-kanaev s-kanaev force-pushed the private/s-kanaev/thread-safe-program-kernel-cache branch 2 times, most recently from 063ec1d to b36dc7c Compare December 3, 2019 10:17
@s-kanaev s-kanaev force-pushed the private/s-kanaev/thread-safe-program-kernel-cache branch from b36dc7c to ab4c8f2 Compare December 3, 2019 13:42
KernelProgramCache::EntityWithState<RetT> *WithState;

{
auto Locked = Acquire(Cache);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, do not use auto when the type is not clear for the line itself. Please, apply to whole patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.
BTW, it is template function. It is intended to not know the exact type here.

@s-kanaev s-kanaev force-pushed the private/s-kanaev/thread-safe-program-kernel-cache branch 2 times, most recently from ce17aee to 977858d Compare December 12, 2019 08:01
@s-kanaev s-kanaev requested a review from romanovvlad December 12, 2019 08:01
@AlexeySachkov
Copy link
Contributor

@s-kanaev, could you please rebase your patch and resolve merge conflicts?

@s-kanaev s-kanaev force-pushed the private/s-kanaev/thread-safe-program-kernel-cache branch from 977858d to 8a4f32f Compare December 19, 2019 08:42
@s-kanaev
Copy link
Contributor Author

@AlexeySachkov

could you please rebase your patch and resolve merge conflicts?

Done

@s-kanaev s-kanaev force-pushed the private/s-kanaev/thread-safe-program-kernel-cache branch from 8a4f32f to f2620b5 Compare December 24, 2019 11:10
@romanovvlad romanovvlad merged commit 118dc82 into intel:sycl Dec 24, 2019
@s-kanaev s-kanaev deleted the private/s-kanaev/thread-safe-program-kernel-cache branch March 12, 2020 13:13
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.

7 participants