clifford icon indicating copy to clipboard operation
clifford copied to clipboard

Improve the handling of layout lifetimes in the numba extension

Open eric-wieser opened this issue 4 years ago • 0 comments

A key part of #97 (implemented in #189) is keeping track of the Layout instances and MultiVector class.

Today, we use context.add_dynamic_addr to embed these objects in the LLVM code. As a result of this, our llvm code is tied to our python process, and it is not possible to cache the result.

https://github.com/pygae/clifford/blob/8f4f247c46e45ccd287f11d4a974a5636bc8705a/clifford/numba/_layout.py#L37-L50

The PR at https://github.com/numba/numba/pull/4929, which @asodeur dew our attention to, shows some alternative approaches to this problem, namely:

  • Using env_manager.add_const
  • Using the conventional unserialize / serialize pairing (that invokes pickle), but with an llvm-side cache (https://github.com/numba/numba/pull/4929#issuecomment-635790607).

I don't think this is urgent, but we should keep an eye on whether a better solution to our problem appears upstream.

eric-wieser avatar Jun 10 '20 09:06 eric-wieser