Script.single_thread

Script.single_thread

Script.single_thread(thread=-1)

Create a thread group context with only one thread.

By default (thread=-1), uses elect-any semantics: the hardware is free to pick any single thread in the current group, enabling the back-end to emit elect.sync / uniform-predicate code.

Pass an explicit thread index (e.g., thread=0) to pin execution to a specific thread.

Parameters:

thread (int) – Thread index within the current group, or -1 for elect-any.

Returns:

ret – The thread group context created.

Return type:

ThreadGroupContext