Implement the WaveActiveBallot
HLSL Function
#99163
Labels
backend:DirectX
backend:SPIR-V
bot:HLSL
HLSL
HLSL Language Support
metabug
Issue to collect references to a group of similar or related issues.
WaveActiveBallot
clang builtin,WaveActiveBallot
clang builtin withhlsl_intrinsics.h
WaveActiveBallot
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
WaveActiveBallot
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
clang/test/CodeGenHLSL/builtins/WaveActiveBallot.hlsl
clang/test/SemaHLSL/BuiltIns/WaveActiveBallot-errors.hlsl
int_dx_WaveActiveBallot
intrinsic inIntrinsicsDirectX.td
DXILOpMapping
ofint_dx_WaveActiveBallot
to116
inDXIL.td
WaveActiveBallot.ll
andWaveActiveBallot_errors.ll
tests inllvm/test/CodeGen/DirectX/
int_spv_WaveActiveBallot
intrinsic inIntrinsicsSPIRV.td
WaveActiveBallot
lowering and map it toint_spv_WaveActiveBallot
inSPIRVInstructionSelector::selectIntrinsic
.llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveBallot.ll
DirectX
SPIR-V
OpGroupNonUniformBallot:
Description:
Result is a bitfield value combining the Predicate value from all
invocations in the group that execute the same dynamic
instance of this instruction. The bit is set to one if the corresponding
invocation is active and the Predicate for that invocation evaluated
to true; otherwise, it is set to zero.
Result Type must be a vector of four components of integer
type scalar, whose Width operand is 32 and whose
Signedness operand is 0.
Result is a set of bitfields where the first invocation is represented
in the lowest bit of the first vector component and the last (up to the
size of the group) is the higher bit number of the last bitmask needed
to represent all bits of the group invocations.
Execution is a Scope that identifies the group of
invocations affected by this command.
Predicate must be a Boolean type.
Capability:
GroupNonUniformBallot
Missing before version 1.3.
5
339
<id>
Result Type
Result <id>
Scope <id>
Execution
<id>
Predicate
Test Case(s)
Example 1
HLSL:
Returns a uint4 containing a bitmask of the evaluation of the Boolean expression for all active lanes in the current wave.
Syntax
Parameters
expr
The boolean expression to evaluate.
Return value
A uint4 containing a bitmask of the evaluation of the Boolean expression for all active lanes in the current wave. The least-significant bit corresponds to the lane with index zero. The bits corresponding to inactive lanes will be zero. The bits that are greater than or equal to WaveGetLaneCount will be zero.
Remarks
Different GPUs have different SIMD processor widths (lane counts). Most of these WaveXXX functions are able to operate at level of abstraction where SIMD machine width is concealed. To maximize portability of code across GPUs, use the intrinsics that don’t rely on machine width. For example, use:
uint result = WaveActiveCountBits( bBit );
Instead of:
uint result = countbits( WaveActiveBallot( bBit ) );
This function is supported from shader model 6.0 in all shader stages.
Examples
See also
Overview of Shader Model 6
Shader Model 6
The text was updated successfully, but these errors were encountered: