heyoka.llvm_state#
- class heyoka.llvm_state#
LLVM state class.
This class encapsulates a single LLVM IR module together with the options used to compile it.
Static methods are provided to interact with both the in-memory and on-disk compilation caches, which are used by both
llvm_stateandllvm_multi_state. All static methods are thread-safe, and the static methods interacting with the on-disk cache can be invoked concurrently from multiple processes.A tutorial illustrating the use the caches is available.
Methods
Clear the on-disk cache.
Clear the in-memory cache.
Get the flag indicating whether the on-disk cache is enabled.
Get the size limit (in bytes) of the on-disk cache.
Get the path to the on-disk cache directory.
Get the current size (in bytes) of the on-disk cache.
Get the size limit (in bytes) of the in-memory cache.
Get the current size (in bytes) of the in-memory cache.
set_diskcache_enabled(flag)Enable or disable the on-disk cache.
set_diskcache_limit(limit)Set the size limit (in bytes) of the on-disk cache.
set_diskcache_path(path)Set the path to the on-disk cache directory.
set_memcache_limit(limit)Set the size limit (in bytes) of the in-memory cache.
Attributes
The bitcode of the module.
The code model used during compilation.
The fast math setting employed during compilation.
Flag indicating whether the use of AVX-512 registers was forced during compilation.
The intermediate representation (IR) of the module.
The object code of the module.
The optimisation level employed during compilation.
Flag indicating whether the LLVM SLP vectorizer was enabled during compilation.
- static clear_diskcache() None#
Clear the on-disk cache.
All entries in the on-disk cache are removed.
- static clear_memcache() None#
Clear the in-memory cache.
All entries in the in-memory cache are removed.
- property code_model#
The code model used during compilation.
- Type:
- property fast_math#
The fast math setting employed during compilation.
This flags indicates if optimisations which may improve floating-point performance at the expense of accuracy and/or strict conformance to the IEEE 754 standard were employed during compilation.
- Type:
- property force_avx512#
Flag indicating whether the use of AVX-512 registers was forced during compilation.
Currently heyoka.py’s default is to disable the use of AVX-512 registers on all Intel processors and to enable it on AMD Zen 4 and later processors. This flag indicates whether the default heuristic was overridden, forcing the use of AVX-512 registers. On processors without AVX-512 instructions, this flag has no effect.
- Type:
- static get_diskcache_enabled() bool#
Get the flag indicating whether the on-disk cache is enabled.
- Return type:
- static get_diskcache_limit() int#
Get the size limit (in bytes) of the on-disk cache.
When the cache size exceeds limit, the least recently used entries are evicted. A value of 0 disables the cache.
- Return type:
- static get_diskcache_path() pathlib.Path#
Get the path to the on-disk cache directory.
- Return type:
- static get_memcache_limit() int#
Get the size limit (in bytes) of the in-memory cache.
When the cache size exceeds this limit, the least recently used entries are evicted. A value of 0 disables the cache.
- Return type:
- static get_memcache_size() int#
Get the current size (in bytes) of the in-memory cache.
- Return type:
- property opt_level#
The optimisation level employed during compilation.
The returned value is in the [0, 3] range.
- Type:
- static set_diskcache_enabled(flag: bool) None#
Enable or disable the on-disk cache.
- Parameters:
flag –
Trueto enable,Falseto disable.
- static set_diskcache_limit(limit: int) None#
Set the size limit (in bytes) of the on-disk cache.
When the cache size exceeds limit, the least recently used entries are evicted. A value of 0 disables the cache.
- Parameters:
limit – the new size limit.
- Raises:
ValueError – if limit is negative.
- static set_diskcache_path(path: os.PathLike | str | bytes) None#
Set the path to the on-disk cache directory.
- Parameters:
path – the new cache path.
- static set_memcache_limit(limit: int) None#
Set the size limit (in bytes) of the in-memory cache.
When the cache size exceeds limit, the least recently used entries are evicted. A value of 0 disables the cache.
- Parameters:
limit – the new size limit.
- Raises:
ValueError – if limit is negative.
- property slp_vectorize#
Flag indicating whether the LLVM SLP vectorizer was enabled during compilation.
The SLP vectorizer can improve performance in some situations, but it results in longer compilation times.
- Type: