BLAS in AOCL supports self-initialization, removing the need to explicitly call bli_init() before using BLIS APIs.
This behavior aligns with upstream BLIS since commit 9804adf (December 2017), which introduced automatic setup of internal resources.
However, memory allocated during initialization is retained for the lifetime of the process unless explicitly released. To ensure clean memory deallocation, especially when using tools like Valgrind or sanitizers, it is recommended to call:
bli_finalize();
at the end of your application.
Why is bli_finalize() important?
BLIS allocates internal memory pools and threading contexts during initialization.
These resources are kept alive to avoid repeated allocation overhead.
Without
bli_finalize(), memory may appear as leaked in diagnostic tools, even though it’s harmless and intended to persist until process exit.Calling
bli_finalize()ensures proper cleanup and avoids false positives in memory leak reports.
When should I use bli_finalize()?
At program shutdown, if your application uses BLIS.
If you want to free BLIS resources early, before the process exits.
In long-running applications or those with dynamic BLIS usage patterns.
Summary
While bli_init() and bli_finalize() are not strictly required for basic usage, calling bli_finalize() is a best practice for
clean resource management in AOCL-based applications.