Re: [LEAF] The usage of TLS

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [LEAF] The usage of TLS

Boost - Dev mailing list
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.

An example of a lock-free hash table:

   https://eourcs.github.io/LockFreeCuckooHash/

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [LEAF] The usage of TLS

Boost - Dev mailing list
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
parallel.
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.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost