Skip to content

[Offload] Move (most) global state to an OffloadContext struct #144494

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RossBrunton
Copy link
Contributor

Rather than having a number of static local variables, we now use
a single OffloadContext struct to store global state. This is
initialised by olInit, but is never deleted (de-initialization of
Offload isn't yet implemented).

The error reporting mechanism has not been moved to the struct, since
that's going to cause issues with teardown (error messages must outlive
liboffload).

Rather than having a number of static local variables, we now use
a single `OffloadContext` struct to store global state. This is
initialised by `olInit`, but is never deleted (de-initialization of
Offload isn't yet implemented).

The error reporting mechanism has not been moved to the struct, since
that's going to cause issues with teardown (error messages must outlive
liboffload).
@callumfare
Copy link
Contributor

The global state stuff looks good to me, but I wonder if we can make tracing of olInit work. Rather than disable tracing for olInit, we could special-case it so it emits both parts of the trace after the actual function call, rather than before and after. If we did that I think it's ok to have a special check for the function name being olInit rather than adding a new property to the function record type.

@RossBrunton
Copy link
Contributor Author

@callumfare I've just updated it so that isTracingEnabled just checks to see whether offload has been inited, and if it hasn't just assumes false.

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