...
Java threads share memory structures but keep their instruction streams private. Parallel processing hardware such as GPUs can have a complementary design, with shared instruction streams but private memory. Localized, unshared memory simplifies communication, while several execution units may share a single instruction stream to reduce cross-lane interactions and/or amortize costs of instruction issuing.
Thread
...
Swarms
Imagine a thread gangswarm G as a group of Java threads T(i), with full Java semantics, which executes all the threads with a high degree of alignment.
When a thread gang swarm starts, all of its threads are positioned at an instruction which is about to call the standard method Thread.run.
At any point, G has a pending continuation for each live thread T(i). In order to express the alignment between gang membersthreads in the swarm, we express G's continuations as a multi-map rather than a set, with the keys of the map being current instructions:
...
Let's call each value set in the multi-map an aligned thread set.
A thread gang swarm makes progress by picking a key bc from G.conts.keySet and running that instruction in SIMD fashion across the relevant parts of each T(i) in parallel.
...
Control Flow
When a thread gang swarm executes an instruction, there may be a variety of outcomes:
...
This variability of control flow is a strongly entrenched feature of the JVM. In order to execute a thread gang swarm efficienty on GPU hardware, threads must be managed to as to converge as much as possible. For example, consider this classic diamond-shaped program:
...
The SIMT model semms to allow some kinds of very serialized Java code to operate efficiently on GPUs.
The thread-gang swarm model is useless if the implementation actually requires that we create a large number of conventional threads. Perhaps a subclass of Thread would help express the necessary information to the system.
...
It should be possible to "roll up" or gather the final results (or provisional results) of a thread gang computationswarm computation. The rolled-up value must be structured as a map from processor to value, or a collection of values.
It should also be possible to "roll down" or scatter new values into the thread gang swarm computation from a map or collection.
...