| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
coverage: 99.44% (-0.4%) from 99.806% |
Sorry, something went wrong.
|
Alright, I think we should consider how we want contexts to behave and not rely on default behavior. For example, I think it would be nice to be able to layer contexts: with Context(nthreads=4):
# nthreads is 4
with Context(chunk=0.5):
# nthreads is still 4 (new behavior!)
...
# nthreads is still 4 (new behavior!) |
Sorry, something went wrong.
|
I updated contexts to chain and stack by default as illustrated in my previous comment. Descriptor-like context values (such as expr.new(nthreads=4)) create new context objects derived from the current active context, and they "disengage" when they go out of scope so they can now apply to GraphBLAS functions that don't have descriptors. I think everything should more-or-less behave exactly as expected/desired in all plausible usage (but it's probably possible to get contexts in a weird state if one tries, really, really hard to do so). I/we still need to document and test descriptors, and work on the JIT. If anybody wants to continue to work or play with this PR, ping me on discord or slack. |
Sorry, something went wrong.
|
In response to this comment, DrTimothyAldenDavis/GraphBLAS#218 (comment), I wonder whether it would be better for us to have a single context per thread that we update (it sounds like engaging a context in a thread may be required for kernel fusion in the future, and engaging many contexts in a thread may wreak havoc on this). This would mean that Context objects that would get used on a regular basis are pure Python that don't create/free GxB_Context objects, but modify the thread-local context. I'm glad we learned of this now. I'd like to think on it a bit. |
Sorry, something went wrong.
|
JIT tests are now passing in CI for Linux and Windows! 🎉 |
Sorry, something went wrong.
| jit_ffi = FFI() | ||
|
|
||
|
|
||
| def register_new(name, jit_c_definition, *, np_type=None): |
There was a problem hiding this comment.
Should we remove the name argument here? It's required to be the same name as the typedef, and I bet we could determine the name from jit_c_definition.
Sorry, something went wrong.
| __call__ = TypedUserUnaryOp.__call__ | ||
|
|
||
|
|
||
| def register_new(name, jit_c_definition, input_type, ret_type): |
There was a problem hiding this comment.
Similarly, should we get the name, input type, and return type from the C definition here?
Alternatively, should name not be required to match the name used in the C definition?
Should we call this function something else, such as gb.unary.ss.register_jit?
Also, should we consider adding register_anonymous or allowing it to be anonymous?
Sorry, something went wrong.
|
This is going in! We still need to add some tests and documentaion, so SuiteSparse 8 is not yet "officially" supported. The metadata only allows SuiteSparse 7. This also gives us more time to review and refine the JIT. Feel free to add review comments to this PR even after it's merged. |
Sorry, something went wrong.
|
btw, the JIT is working for CI for all OSes with both python-suitesparse-graphblas wheels and GraphBLAS from conda-forge except for Window wheels (I don't know why). |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This begins updating to SuiteSparse:GraphBLAS 8.0.0, which added the JIT and contexts. Currently, this PR adds support for context and updates the configurations. We still need to support the JIT.
See release log here: https://github.com/DrTimothyAldenDavis/GraphBLAS/releases/tag/v8.0.0
Contexts
There are two types of contexts: global, and thread-local.
Local contexts do not stack. The inner context replaces the outer context here:
I don't know if we want to try to keep track of the stack ourselves. Perhaps if/when somebody needs such a workflow.
The other tricky thing with contexts is that nthreads and chunks were removed as descriptor options. This is awkward for us, since I like the syntax of expr.new(nthreads=8) and C(nthreads=8) << expr and would like to keep it (and not add incompatible changes). So, I kept it. If any context option is used in **opts (which is typically for the descriptor), then we either update the current context that the user explicitly engaged, or we create a new context whose lifetime matches the descriptor lifetime. This ought to work well enough in practice, but I'm not fond of relying on __del__ to disengage the context. I would prefer if e.g. nthreads was still part of the descriptor.
Configs
Two changes happened with configuration in SuiteSparse:GraphBLAS:
We have some choices for how we can handle these.
First, the global config can have all configurations and global contexts:
Second, we can have a new global_context object:
Third, we can have a new jit or jitconfig object:
So, if we want global_context and/or jit/jitconfig objects, we could remove one/both of them from the global config, which simplifies the global config considerably. For example, here's the global config without the JIT options:
If we also removed the global context items from the global config, we get:
@jim22k @SultanOrazbayev how would you like to organize the global configuration and global context? It's helpful to expose the global context so users can do global_contect.engage() to reset the context. I also like keeping nthreads in the global config (which gets and sets via the global context). So, my main question I'm struggling with is whether to split out the jit config.
Finally, we don't yet support getting or setting functions such as malloc, free, print, and flush (the third change in 8.0.0).
JIT
Coming soon!