On 2020-05-04 01:15, Andrzej Krzemienski via Boost wrote:
> There is a number of reasons people do not want to or cannot use the C++
> exception handling mechanism. One of them is that the implementation of
> exception handling requires the usage of TLS, and TLS is not implementable
> on some platforms, like GPUs. If Nvidia's compiler does not implement C++
> exception handling mechanism, it is not because it would be slow, but
> because it would require TLS support. From this perspective, if I cannot
> use C++ exceptions because of TLS and I have to use something else, then
> another TLS-based library is not really an alternative. In this case it
> does not matter that it is only IDs that are stored in TLS. The sole fact
> of even employing TLS is a deal breaker.
LEAF really only needs one thread-local pointer to the topmost context
per thread, so it may be possible to replace the thread-local storage
with a global lock-free hash table.
A lock-free hash table only requires atomic support, which is generally
available on GPUs and microcontrollers.
The key of the hash table could be the thread id. Task-based RTOS
systems could use its task handle instead.
On Fri, 22 May 2020 at 12:54, Bjorn Reese via Boost
<[hidden email]> wrote:
> LEAF really only needs one thread-local pointer to the topmost context
> per thread, so it may be possible to replace the thread-local storage
> with a global lock-free hash table.
On Nvidia GPUs, there is already a mechanism for this, known as local
memory, which in effect is a global region which interleaves the
various thread's data so that they can all access their fields in
This is what gets used whenever a register needs to be spilled to memory.
I do not know why Nvidia couldn't just implement TLS using this.