-
Notifications
You must be signed in to change notification settings - Fork 12
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
Implement Policies #218
Closed
Closed
Implement Policies #218
Conversation
This file contains 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
We cannot pass a std::tuple as template argument as that may cause ADL problems with std::tuple<void>. The new type ttg::typelist is a shim wrapper that provides the tuple after the TT has been instantiated. Also, use existing TT base type definition instead of redefining the base type. Signed-off-by: Joseph Schuchart <[email protected]>
Signed-off-by: Joseph Schuchart <[email protected]>
Signed-off-by: Joseph Schuchart <[email protected]>
Signed-off-by: Joseph Schuchart <[email protected]>
Signed-off-by: Joseph Schuchart <[email protected]>
Signed-off-by: Joseph Schuchart <[email protected]>
Signed-off-by: Joseph Schuchart <[email protected]>
The wrapper base class tries to avoid the indirect function call if the std::function is not set. It also ensures that all TTs provide the same functionality around policies. Signed-off-by: Joseph Schuchart <[email protected]>
Signed-off-by: Joseph Schuchart <[email protected]>
Signed-off-by: Joseph Schuchart <[email protected]>
Signed-off-by: Joseph Schuchart <[email protected]>
Signed-off-by: Joseph Schuchart <[email protected]>
Signed-off-by: Joseph Schuchart <[email protected]>
Superseded bu #226, closing |
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.
Policies are a mechanism to steer the execution of tasks through a single entity controlling different properties. The interface is extensible to allow for the addition of future properties without breaking backwards compatibility. If desired, providing a custom policy allows the compiler to fully inline all calls and thus avoid a bunch of indirect calls through
std::function
. This is useful for small tasks and allows us to reduce the overhead of querying these properties.Currently, three properties are supported:
int procmap(const Key&)
member.int priomap(const Key&)
member.int inlinemap(const Key&)
member. This has yet to be implemented in the backends.Policies can be specified in two ways:
make_policy()
to work withmake_tt
. Example:Functions are defaulted to make sure that all necessary properties are implemented. A function that is not provided can later be set dynamically on the tt (using
tt->set_inlinemap([](const Key&){ return 0; })
in the example above).The
procmap
member function will shadow theprocmap
member ofttg::TTPolicyBase
. Since the TT is templated on the policy, theprocmap
ofMyPolicy
is used. There is no need for virtual functions here. Similarly to the above, properties not specified inMyPolicy
are defaulted to astd::function
and can be set dynamically.This PR is based on #217 to be able to default the policy type of TT so the diff is bigger than it will be if #217 gets merged.