src/computesim/api

Search:
Group by:
Source   Edit  

Types

AtomicInt = int32 | uint32
Type class for atomic integer operations Source   Edit  

Procs

proc atomicAdd[T: AtomicInt](mem: var T; data: T): T {.inline, discardable.}
Performs atomic addition on mem with data. Returns the original value stored in mem. Source   Edit  
proc atomicAnd[T: AtomicInt](mem: var T; data: T): T {.inline, discardable.}
Performs atomic AND on mem with data. Returns the original value stored in mem. Source   Edit  
proc atomicCompSwap[T: AtomicInt](mem: var T; compare, data: T): T {.discardable.}
Performs an atomic comparison of compare with the contents of mem. If the content of mem is equal to compare, then the content of data is written into mem, otherwise the content of mem is unmodified. Returns the original content of mem regardless of the outcome of the comparison. Source   Edit  
proc atomicExchange[T: AtomicInt](mem: var T; data: T): T {.inline, discardable.}
Atomically stores data into mem and returns the original value. Source   Edit  
proc atomicOr[T: AtomicInt](mem: var T; data: T): T {.inline, discardable.}
Performs atomic OR on mem with data. Returns the original value stored in mem. Source   Edit  
proc atomicXor[T: AtomicInt](mem: var T; data: T): T {.inline, discardable.}
Performs atomic XOR on mem with data. Returns the original value stored in mem. Source   Edit  
func subgroupBallotBitCount(ballot: UVec4): uint32 {....raises: [], tags: [],
    forbids: [].}
Returns the number of set bits in a ballot value, only counting bits up to gl_SubgroupSize Source   Edit  
func subgroupBallotBitExtract(value: UVec4; index: uint32): bool {....raises: [],
    tags: [], forbids: [].}
Returns true if the bit at position index is set in value Only valid for indices less than gl_SubgroupSize Source   Edit  
func subgroupBallotFindLSB(value: UVec4): uint32 {....raises: [], tags: [],
    forbids: [].}
Returns the index of the least significant 1 bit in value Only considers the bottom gl_SubgroupSize bits Source   Edit  
func subgroupBallotFindMSB(value: UVec4): uint32 {....raises: [], tags: [],
    forbids: [].}
Returns the index of the most significant 1 bit in value Only considers the bottom gl_SubgroupSize bits Source   Edit  

Templates

template barrier()
Synchronizes all threads within the current workgroup Source   Edit  
template gl_SubgroupEqMask(): UVec4
Returns a mask where only the bit at the current invocation's index is set Source   Edit  
template gl_SubgroupGeMask(): UVec4
Returns a mask where bits at and above the current invocation's index are set Source   Edit  
template gl_SubgroupGtMask(): UVec4
Returns a mask where bits above the current invocation's index are set Source   Edit  
template gl_SubgroupLeMask(): UVec4
Returns a mask where bits at and below the current invocation's index are set Source   Edit  
template gl_SubgroupLtMask(): UVec4
Returns a mask where bits below the current invocation's index are set Source   Edit  
template gl_SubgroupSize(): uint32
The number of invocations in a subgroup Source   Edit  
template groupMemoryBarrier()
Performs a memory barrier across all memory operations within the workgroup. Similar to memoryBarrier() but only synchronizes within the current workgroup. Source   Edit  
template memoryBarrier()
Performs a memory barrier across all memory operations in the shader. Ensures that all memory operations issued before the barrier complete before any memory operations after the barrier can begin. Source   Edit  
template subgroupAdd[T](value: T): T
Returns sum of value across all threads in subgroup Source   Edit  
template subgroupAll(condition: bool): bool
Returns true if condition is true for all active threads Source   Edit  
template subgroupAllEqual[T](value: T): bool
Returns true if value is equal across all active threads in subgroup Source   Edit  
template subgroupAny(condition: bool): bool
Returns true if condition is true for any active thread Source   Edit  
template subgroupBallot(condition: bool): UVec4
Returns bitmap of which threads have condition true Source   Edit  
template subgroupBallotExclusiveBitCount(value: UVec4): uint32
Returns the number of bits set in value up to the current invocation's index (exclusive) Only counts bits up to gl_SubgroupSize Source   Edit  
template subgroupBallotInclusiveBitCount(value: UVec4): uint32
Returns the number of bits set in value up to the current invocation's index (inclusive) Only counts bits up to gl_SubgroupSize Source   Edit  
template subgroupBarrier()
Synchronizes all threads within the current subgroup Source   Edit  
template subgroupBroadcast[T](value: T; id: uint32): T
Broadcasts value from thread with specified id to all threads in subgroup Source   Edit  
template subgroupBroadcastFirst[T](value: T): T
Broadcasts value from first active thread to all threads in subgroup Source   Edit  
template subgroupElect(): bool
Returns true for exactly one active thread in subgroup Source   Edit  
template subgroupExclusiveAdd[T](value: T): T
Returns exclusive prefix sum of value for current thread Source   Edit  
template subgroupInclusiveAdd[T](value: T): T
Returns inclusive prefix sum of value for current thread Source   Edit  
template subgroupInverseBallot(value: UVec4): bool
Returns true if the bit at this invocation's index in value is set Source   Edit  
template subgroupMax[T](value: T): T
Returns maximum of value across all threads in subgroup Source   Edit  
template subgroupMemoryBarrier()
Performs a memory barrier that ensures memory operations within the subgroup are properly ordered as seen by other invocations. Source   Edit  
template subgroupMin[T](value: T): T
Returns minimum of value across all threads in subgroup Source   Edit  
template subgroupShuffle[T](value: T; id: uint32): T
Returns value from thread with specified id Source   Edit  
template subgroupShuffleDown[T](value: T; delta: uint32): T
Returns value from thread with index current_id + delta Source   Edit  
template subgroupShuffleUp[T](value: T; delta: uint32): T
Returns value from thread with index current_id - delta Source   Edit  
template subgroupShuffleXor[T](value: T; mask: uint32): T
Returns value from thread with id equal to current_id XOR mask Source   Edit