habanalabs user-space thunk library available in GitHub

From: Oded Gabbay
Date: Fri Mar 01 2019 - 10:50:37 EST

Hi Greg and Olof,
I wanted to let you know that I put the sources of our new userspace
thunk library in GitHub, as we discussed a few weeks ago during the
review of the driver.
The link is: https://github.com/HabanaAI/hl-thunk

As this library was written from scratch in the past month, it is
still quite small and provides only the minimal functionality over the
We did ported some of the userspace tests we have in our runtime to
this library (using CMocka framework) to demonstrate how to use the
The library is written in pure C. It is a stateless library (at least
for now) and I took the basic design from drm library.

Going forward, we plan to (in order of importance):
1. Integrate this in our S/W stack. In effect, remove the functionally
we expose in the thunk layer from the runtime and make the runtime
link with the thunk layer and call it instead of calling directly to
the IOCTLs. This will be done in the next week or two.
2. Add additional tests for Goya and for future ASICs. We plan to use
this library for doing bring-ups on Palladium and the real ASICs as it
provides us with easy platform for testing purposes.
3. Add more functionality to the library. I didn't yet decided how
much functionality I want to add to this layer though, because I want
to keep it thin.

Bottom line, this is definitely not some mockup library. This will be
an integral part of our S/W stack going forward.

I sincerely hope we can open source additional S/W parts in the
future. I'll try pushing to this goal as much as I can inside the