Closed staticfloat closed 2 months ago
This is great! I had been wanting to do something like this for a while because of all the various issues we seemed to be having earlier with function mapping, and it was so obtuse to figure out what functions weren't actually getting mapped.
This is independent from https://github.com/JuliaLang/julia/pull/55302, right? That should work without the new feature here in LBT?
Correct
We smuggle symbol indices in a scratch register through our trampolines, allowing our default error printing function to rescue out the appropriate symbol index, and turn that into a symbol name. While this is fancy, reduces code size, and makes me feel clever, it's also not very reproducible for other projects that wish to replicate this technique without requiring that the scratch register be preserved long enough for their handling code to get at it. In such a case, the fallback implementation would be to generate function stubs for every symbol individually. A Julia implementation of this follows:
First, a module is defined with error stubs for every symbol:
Next, these functions are inserted as the base layer of forwards for LBT:
After that, subsequent
lbt_forward()
calls (withoutclear
set, of course) will fill in forwards to the actual backing BLAS calls, but those left behind will have customized error messages, denoting which BLAS call was unsupported.