Skip to content

[SYCL] Guard access to the cache of device lib programs #6094

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

Merged
merged 2 commits into from
May 4, 2022

Conversation

againull
Copy link
Contributor

@againull againull commented May 3, 2022

We cache device library programs (like fallback assertion) in the
context. In multi-threaded applications simultaneous access to the
cache of device lib programs is possible in program_manager::build().
That's why access to the this cache needs to be guarded to avoid data
race.

We cache device library programs (like fallback assertion) in the
context. In multi-threaded applications simultaneous access to the
cache of device lib programs is possible in program_manager::build().
That's why access to the this cache needs to be guarded to avoid data
race.
@againull againull requested a review from a team as a code owner May 3, 2022 16:39
@againull againull requested a review from aelovikov-intel May 3, 2022 16:39
cperkinsintel
cperkinsintel previously approved these changes May 3, 2022
Copy link
Contributor

@cperkinsintel cperkinsintel left a comment

Choose a reason for hiding this comment

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

LGTM !

Copy link
Contributor

@aelovikov-intel aelovikov-intel left a comment

Choose a reason for hiding this comment

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

This looks good to me. I'd probably make a few infrastructure changes but those shouldn't be tied to this PR:

template <typename T>
class Lockable {
public:
  class Locked {
    /* Same as before, plus */
  public:
    T* operator->() { ... }
  };

  Locked aquire() { return {...} }
  const T* operator->() { ... } // Not sure if read should be allowed without lock.
private:
  T obj;
  std::mutex M;
};

@againull againull merged commit 92cfd53 into intel:sycl May 4, 2022
@steffenlarsen
Copy link
Contributor

@againull - It seems this is causing post-commit failure in SchedulerTests on Windows. Could you please investigate?

@againull
Copy link
Contributor Author

againull commented May 6, 2022

@againull - It seems this is causing post-commit failure in SchedulerTests on Windows. Could you please investigate?

Yes, I am investigating.

@againull
Copy link
Contributor Author

againull commented May 6, 2022

@againull - It seems this is causing post-commit failure in SchedulerTests on Windows. Could you please investigate?

Yes, I am investigating.

It turned out that the fail is unrelated to this change. We have a tracker for this issue and Andrei is working on it.

@pvchupin
Copy link
Contributor

pvchupin commented May 7, 2022

@againull, @aelovikov-intel, fwiw revert seems make test pass. I've triggered failing testing manually at: https://github.com/intel/llvm/actions/runs/2284512659

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.

5 participants