[hipFile] Defer static init to first API call.#4864
Open
systems-assistant[bot] wants to merge 9 commits intodevelopfrom
Open
[hipFile] Defer static init to first API call.#4864systems-assistant[bot] wants to merge 9 commits intodevelopfrom
systems-assistant[bot] wants to merge 9 commits intodevelopfrom
Conversation
Adds ContextDefaultImpl, which has a type that defaults to the template type. Can be specialized to use different default type for a given template type.
Add an interface for StatsServer, so that a mock doesn't need to call StatsServer constructor. Adds specialization to ContextDefaultImpl so that StatsServer is used as default implementation for IStatsServer.
If multiple interfaces are being mocked, the standard implementation may end up calling mocked functions when constructing. Return the replacement first, so we only construct the standard implementation when it is actually needed.
Moves current static init to a hipFileInit function. It will be called from any public API function.
Allows use when compiled in C++20 for better type checking, but left out when compiled in C++17 mode.
…evelop/ROCm_hipFile/pr-235
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves static initialization of hipFile objects to the first API call. This allows mocking of static objects that call mockable functions, as we can now mock the calls before they are initialized.
Changes:
🔁 Imported from ROCm/hipFile#235
🧑💻 Originally authored by @jordan-turbofish