-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Make EvalState::callDepth thread-local #13479
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
base: master
Are you sure you want to change the base?
Conversation
This is needed to make it thread-safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it a static? That seems bad if there are multiple interpreters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems bad if there are multiple interpreters
Yeah, this is a non-starter fundamentally. This would really conflict with the multi-evaluator goals (cc @roberth). We should make code more reusable and without globals.
I think the idea here is to make the call depth local to an evaluation worker (by abusing thread_local mechanisms). Wouldn't it be better to instead have that concept expressed as an evaluation context of sorts?
Why? Presumably any thread will have only one interpreter active at any given time. Or, in the unlikely scenario that one interpreter calls another, they should share the same
What's the use case for that? |
Multithreading creates a situation where In other words I'm not a big fan of
The prior is more memory efficient but also produces less detailed error traces, as the That all is in addition to worries that I share about the reduced flexibility. This could affect the unit tests, as well as C API users, and it may make experimentation with the evaluator more difficult, e.g. new caching approaches or agent-style isolated heaps per flake. |
Motivation
This is needed to make it thread-safe.
Context
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.