Skip to content

[SYCL] Fix PIMock initialization in unit tests #4322

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
Aug 16, 2021

Conversation

vladimirlaz
Copy link
Contributor

@vladimirlaz vladimirlaz commented Aug 12, 2021

The problem comes from global initialization which is dependent on
another global which happens to be not initialized yet in this case
(the order is non-deterministic by standard).

Global variables causing the issue are moved to static locals in free
functions. That allows to avoid initialization races on usages.

The problem comes from global initialization which is dependent on
another global which happens to be not initialized yet in this case
(the order is non-deterministic by standard).
@vladimirlaz vladimirlaz requested a review from a team as a code owner August 12, 2021 08:41
@romanovvlad
Copy link
Contributor

The problem comes from global initialization which is dependent on
another global

Could you please clarify which global initialization and which global?

@vladimirlaz
Copy link
Contributor Author

The problem comes from global initialization which is dependent on
another global

Could you please clarify which global initialization and which global?

static std::vectordetail::plugin Plugins = pi::initializeAndRemoveInvalid();

another global SyclBeMap

@romanovvlad
Copy link
Contributor

SyclBeMap

I see, thanks. I would also suggest moving SyclBeMap and SyclDeviceTypeMap to the functions where they used to avoid conflicts with them in future.

That allows to avoid initialization races on usages.
@vladimirlaz
Copy link
Contributor Author

SyclBeMap

I see, thanks. I would also suggest moving SyclBeMap and SyclDeviceTypeMap to the functions where they used to avoid conflicts with them in future.

Moved to static locals of free functons.

@vladimirlaz vladimirlaz changed the title [NFC][SYCL] Fix PIMock initialization in unit tests [SYCL] Fix PIMock initialization in unit tests Aug 16, 2021
@romanovvlad romanovvlad merged commit 91a79d5 into intel:sycl Aug 16, 2021
@vladimirlaz vladimirlaz deleted the fix_unit_initorder branch October 8, 2021 06:19
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