- Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
- Implement
WaveGetLaneCountclang builtin, - Link
WaveGetLaneCountclang builtin withhlsl_intrinsics.h - Add sema checks for
WaveGetLaneCounttoCheckHLSLBuiltinFunctionCallinSemaChecking.cpp - Add codegen for
WaveGetLaneCounttoEmitHLSLBuiltinExprinCGBuiltin.cpp - Add codegen tests to
clang/test/CodeGenHLSL/builtins/WaveGetLaneCount.hlsl - Add sema tests to
clang/test/SemaHLSL/BuiltIns/WaveGetLaneCount-errors.hlsl - Create the
int_dx_WaveGetLaneCountintrinsic inIntrinsicsDirectX.td - Create the
DXILOpMappingofint_dx_WaveGetLaneCountto112inDXIL.td - Create the
WaveGetLaneCount.llandWaveGetLaneCount_errors.lltests inllvm/test/CodeGen/DirectX/ - Create the
int_spv_WaveGetLaneCountintrinsic inIntrinsicsSPIRV.td - In SPIRVInstructionSelector.cpp create the
WaveGetLaneCountlowering and map it toint_spv_WaveGetLaneCountinSPIRVInstructionSelector::selectIntrinsic. - Create SPIR-V backend test case in
llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveGetLaneCount.ll
DirectX
| DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
|---|---|---|---|
| 112 | WaveGetLaneCount | 6.0 | ('library', 'compute', 'amplification', 'mesh', 'pixel', 'vertex', 'hull', 'domain', 'geometry', 'raygeneration', 'intersection', 'anyhit', 'closesthit', 'miss', 'callable', 'node') |
SPIR-V
Description
SubgroupSize
Decorating a variable with the SubgroupSize builtin decoration will
make 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 flag
set, or the shader object was created with the
VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT flag set, or
the SPIR-V module is at least version 1.6, the SubgroupSize
decorated variable will contain the subgroup size for each subgroup that
gets dispatched. This value must be between minSubgroupSize and maxSubgroupSize and
must 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 match requiredSubgroupSize .
If SPIR-V module is less than version 1.6 and the pipeline was not
created with the
VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT flag
set 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 no
VkShaderRequiredSubgroupSizeCreateInfoEXT
structure was chained, the variable decorated with SubgroupSize will
match subgroupSize .
The maximum number of invocations that an implementation can support per
subgroup is 128.
Note The old behavior for |
Test Case(s)
Example 1
//dxc WaveGetLaneCount_test.hlsl -T lib_6_8 -enable-16bit-types -O0 export uint fn() { return WaveGetLaneCount(); }SPIRV Example(s):
Example 2
//dxc WaveGetLaneCount_spirv_test.hlsl -T ps_6_8 -E fn -enable-16bit-types -spirv -fspv-target-env=universal1.5 -fcgl -O0 uint fn( ) : SV_Target { return WaveGetLaneCount(); }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 waveSee also
Metadata
Metadata
Assignees
Labels
Type
Projects
Status