Implement the WaveGetLaneCount
HLSL Function
#99159
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.
WaveGetLaneCount
clang builtin,WaveGetLaneCount
clang builtin withhlsl_intrinsics.h
WaveGetLaneCount
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
WaveGetLaneCount
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
clang/test/CodeGenHLSL/builtins/WaveGetLaneCount.hlsl
clang/test/SemaHLSL/BuiltIns/WaveGetLaneCount-errors.hlsl
int_dx_WaveGetLaneCount
intrinsic inIntrinsicsDirectX.td
DXILOpMapping
ofint_dx_WaveGetLaneCount
to112
inDXIL.td
WaveGetLaneCount.ll
andWaveGetLaneCount_errors.ll
tests inllvm/test/CodeGen/DirectX/
int_spv_WaveGetLaneCount
intrinsic inIntrinsicsSPIRV.td
WaveGetLaneCount
lowering and map it toint_spv_WaveGetLaneCount
inSPIRVInstructionSelector::selectIntrinsic
.llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveGetLaneCount.ll
DirectX
SPIR-V
SubgroupSize
Short Description
SubgroupSize - Size of a subgroup
Description
SubgroupSize
Decorating a variable with the
SubgroupSize
builtin decoration willmake that variable contain the implementation-dependent number of invocations in a subgroup .
This value must be a power-of-two integer.
If the pipeline was created with the
VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT
flagset, or the shader object was created with the
VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT
flag set, orthe SPIR-V
module
is at least version 1.6, theSubgroupSize
decorated variable will contain the subgroup size for each subgroup that
gets dispatched. This value must be between
minSubgroupSize
andmaxSubgroupSize
andmust be uniform with subgroup scope . The value may
vary across a single draw call, and for fragment shaders may vary
across a single primitive. In compute dispatches,
SubgroupSize
must be uniform with command scope .
If the pipeline was created with a chained
VkPipelineShaderStageRequiredSubgroupSizeCreateInfo
structure, or the shader object was created with a chained
VkShaderRequiredSubgroupSizeCreateInfoEXT
structure, the
SubgroupSize
decorated variable will matchrequiredSubgroupSize
.If SPIR-V
module
is less than version 1.6 and the pipeline was notcreated with the
VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT
flagset and no
VkPipelineShaderStageRequiredSubgroupSizeCreateInfo
structure was chained, and the shader was not created with the
VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT
flag set and noVkShaderRequiredSubgroupSizeCreateInfoEXT
structure was chained, the variable decorated with
SubgroupSize
willmatch
subgroupSize
.The maximum number of invocations that an implementation can support per
subgroup is 128.
The old behavior for
SubgroupSize
is considered deprecated as certain compute algorithms cannot be easily implemented without the guarantees ofVK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT
andVK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT
.Valid Usage
VUID-SubgroupSize-SubgroupSize-04382
The variable decorated with
SubgroupSize
must be declaredusing the
Input
Storage
Class
VUID-SubgroupSize-SubgroupSize-04383
The variable decorated with
SubgroupSize
must be declared as ascalar 32-bit integer value
Test Case(s)
Example 1
SPIRV Example(s):
Example 2
HLSL:
Returns the number of lanes in a wave on this architecture.
Syntax
uint WaveGetLaneCount(void);
Parameters
This function has no parameters.
Return value
The result will be between 4 and 128, and includes all waves: active, inactive, and/or helper lanes. The result returned from this function may vary significantly depending on the driver implementation.
Remarks
This function is supported from shader model 6.0 in all shader stages.
Examples
uint laneCount = WaveGetLaneCount(); // number of lanes in wave
See also
Overview of Shader Model 6
Shader Model 6
The text was updated successfully, but these errors were encountered: