-
Notifications
You must be signed in to change notification settings - Fork 129
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
[service] Enable intra-session mutable state #591
Labels
Comments
ChrisCummins
added a commit
to ChrisCummins/CompilerGym
that referenced
this issue
Mar 2, 2022
This adds an explicit call to BenchmarkFactory::close() on the global singleton, since otherwise it may not be called. Fixes facebookresearch#582. Issue facebookresearch#591.
ChrisCummins
added a commit
to ChrisCummins/CompilerGym
that referenced
this issue
Mar 3, 2022
This adds an explicit call to BenchmarkFactory::close() on the global singleton, since otherwise it may not be called. Fixes facebookresearch#582. Issue facebookresearch#591.
ChrisCummins
added a commit
to ChrisCummins/CompilerGym
that referenced
this issue
Mar 6, 2022
ChrisCummins
added a commit
to ChrisCummins/CompilerGym
that referenced
this issue
Mar 6, 2022
This adds an explicit call to BenchmarkFactory::close() on the global singleton, since otherwise it may not be called. Fixes facebookresearch#582. Issue facebookresearch#591.
ChrisCummins
added a commit
to ChrisCummins/CompilerGym
that referenced
this issue
Mar 17, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🚀 Feature
Motivation
The
CompilationSession
interface allows mutable state only for the duration of a single compilation session, but there are cases where we may want to have mutable state that outlives a single session and is shared between sessions over the lifetime of a service. For example, the LLM service implements aBenchmarkFactory
class which is an in-memory cache of parsed bitcodes that is shared across all services.Pitch
Add a new class that encapsulates all intra-session state of a compiler service in a "Context" object:
Then change the CompilationSession interface so that it takes a reference to this context:
The helper function for creating and running a CompilerGymService then needs to be parametrized by this context type:
Importantly, implementing this new context should be optional. We should provide a default implementation for users who don't need to use it. That way, the only breaking change will be if users decided to overload the default constructor for
CompilationSession
, since we are changing its signature.Considerations
CompilerServiceContext
is thread-safe, since a single context object will be shared by all sessions.Alternatives
Don't provide a context object, but allow users to run their own shutdown code after
createAndRunCompilerGymService()
completes. The downside to this is that the user needs to remember to return the appropriate return code fromcreateAndRunCompilerGymService()
.The text was updated successfully, but these errors were encountered: