Implement GL_NV_shader_subgroup_partitioned
This commit is contained in:
121
SPIRV/GlslangToSpv.cpp
Normal file → Executable file
121
SPIRV/GlslangToSpv.cpp
Normal file → Executable file
@@ -4666,7 +4666,13 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe
|
||||
libCall = spv::CubeFaceCoordAMD;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case glslang::EOpSubgroupPartition:
|
||||
builder.addExtension(spv::E_SPV_NV_shader_subgroup_partitioned);
|
||||
builder.addCapability(spv::CapabilityGroupNonUniformPartitionedNV);
|
||||
unaryOp = spv::OpGroupNonUniformPartitionNV;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -5629,6 +5635,32 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
||||
builder.addCapability(spv::CapabilityGroupNonUniform);
|
||||
builder.addCapability(spv::CapabilityGroupNonUniformQuad);
|
||||
break;
|
||||
#ifdef NV_EXTENSIONS
|
||||
case glslang::EOpSubgroupPartitionedAdd:
|
||||
case glslang::EOpSubgroupPartitionedMul:
|
||||
case glslang::EOpSubgroupPartitionedMin:
|
||||
case glslang::EOpSubgroupPartitionedMax:
|
||||
case glslang::EOpSubgroupPartitionedAnd:
|
||||
case glslang::EOpSubgroupPartitionedOr:
|
||||
case glslang::EOpSubgroupPartitionedXor:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveAdd:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveMul:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveMin:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveMax:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveAnd:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveOr:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveXor:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveAdd:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveMul:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveMin:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveMax:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveAnd:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveOr:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveXor:
|
||||
builder.addExtension(spv::E_SPV_NV_shader_subgroup_partitioned);
|
||||
builder.addCapability(spv::CapabilityGroupNonUniformPartitionedNV);
|
||||
break;
|
||||
#endif
|
||||
default: assert(0 && "Unhandled subgroup operation!");
|
||||
}
|
||||
|
||||
@@ -5662,6 +5694,11 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
||||
case glslang::EOpSubgroupInclusiveAdd:
|
||||
case glslang::EOpSubgroupExclusiveAdd:
|
||||
case glslang::EOpSubgroupClusteredAdd:
|
||||
#ifdef NV_EXTENSIONS
|
||||
case glslang::EOpSubgroupPartitionedAdd:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveAdd:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveAdd:
|
||||
#endif
|
||||
if (isFloat) {
|
||||
opCode = spv::OpGroupNonUniformFAdd;
|
||||
} else {
|
||||
@@ -5672,6 +5709,11 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
||||
case glslang::EOpSubgroupInclusiveMul:
|
||||
case glslang::EOpSubgroupExclusiveMul:
|
||||
case glslang::EOpSubgroupClusteredMul:
|
||||
#ifdef NV_EXTENSIONS
|
||||
case glslang::EOpSubgroupPartitionedMul:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveMul:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveMul:
|
||||
#endif
|
||||
if (isFloat) {
|
||||
opCode = spv::OpGroupNonUniformFMul;
|
||||
} else {
|
||||
@@ -5682,6 +5724,11 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
||||
case glslang::EOpSubgroupInclusiveMin:
|
||||
case glslang::EOpSubgroupExclusiveMin:
|
||||
case glslang::EOpSubgroupClusteredMin:
|
||||
#ifdef NV_EXTENSIONS
|
||||
case glslang::EOpSubgroupPartitionedMin:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveMin:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveMin:
|
||||
#endif
|
||||
if (isFloat) {
|
||||
opCode = spv::OpGroupNonUniformFMin;
|
||||
} else if (isUnsigned) {
|
||||
@@ -5694,6 +5741,11 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
||||
case glslang::EOpSubgroupInclusiveMax:
|
||||
case glslang::EOpSubgroupExclusiveMax:
|
||||
case glslang::EOpSubgroupClusteredMax:
|
||||
#ifdef NV_EXTENSIONS
|
||||
case glslang::EOpSubgroupPartitionedMax:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveMax:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveMax:
|
||||
#endif
|
||||
if (isFloat) {
|
||||
opCode = spv::OpGroupNonUniformFMax;
|
||||
} else if (isUnsigned) {
|
||||
@@ -5706,6 +5758,11 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
||||
case glslang::EOpSubgroupInclusiveAnd:
|
||||
case glslang::EOpSubgroupExclusiveAnd:
|
||||
case glslang::EOpSubgroupClusteredAnd:
|
||||
#ifdef NV_EXTENSIONS
|
||||
case glslang::EOpSubgroupPartitionedAnd:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveAnd:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveAnd:
|
||||
#endif
|
||||
if (isBool) {
|
||||
opCode = spv::OpGroupNonUniformLogicalAnd;
|
||||
} else {
|
||||
@@ -5716,6 +5773,11 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
||||
case glslang::EOpSubgroupInclusiveOr:
|
||||
case glslang::EOpSubgroupExclusiveOr:
|
||||
case glslang::EOpSubgroupClusteredOr:
|
||||
#ifdef NV_EXTENSIONS
|
||||
case glslang::EOpSubgroupPartitionedOr:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveOr:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveOr:
|
||||
#endif
|
||||
if (isBool) {
|
||||
opCode = spv::OpGroupNonUniformLogicalOr;
|
||||
} else {
|
||||
@@ -5726,6 +5788,11 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
||||
case glslang::EOpSubgroupInclusiveXor:
|
||||
case glslang::EOpSubgroupExclusiveXor:
|
||||
case glslang::EOpSubgroupClusteredXor:
|
||||
#ifdef NV_EXTENSIONS
|
||||
case glslang::EOpSubgroupPartitionedXor:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveXor:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveXor:
|
||||
#endif
|
||||
if (isBool) {
|
||||
opCode = spv::OpGroupNonUniformLogicalXor;
|
||||
} else {
|
||||
@@ -5786,6 +5853,35 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
||||
case glslang::EOpSubgroupClusteredXor:
|
||||
spvGroupOperands.push_back(spv::GroupOperationClusteredReduce);
|
||||
break;
|
||||
#ifdef NV_EXTENSIONS
|
||||
case glslang::EOpSubgroupPartitionedAdd:
|
||||
case glslang::EOpSubgroupPartitionedMul:
|
||||
case glslang::EOpSubgroupPartitionedMin:
|
||||
case glslang::EOpSubgroupPartitionedMax:
|
||||
case glslang::EOpSubgroupPartitionedAnd:
|
||||
case glslang::EOpSubgroupPartitionedOr:
|
||||
case glslang::EOpSubgroupPartitionedXor:
|
||||
spvGroupOperands.push_back(spv::GroupOperationPartitionedReduceNV);
|
||||
break;
|
||||
case glslang::EOpSubgroupPartitionedInclusiveAdd:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveMul:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveMin:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveMax:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveAnd:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveOr:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveXor:
|
||||
spvGroupOperands.push_back(spv::GroupOperationPartitionedInclusiveScanNV);
|
||||
break;
|
||||
case glslang::EOpSubgroupPartitionedExclusiveAdd:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveMul:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveMin:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveMax:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveAnd:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveOr:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveXor:
|
||||
spvGroupOperands.push_back(spv::GroupOperationPartitionedExclusiveScanNV);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Push back the operands next.
|
||||
@@ -5974,6 +6070,29 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
||||
case glslang::EOpSubgroupClusteredOr:
|
||||
case glslang::EOpSubgroupClusteredXor:
|
||||
case glslang::EOpSubgroupQuadBroadcast:
|
||||
#ifdef NV_EXTENSIONS
|
||||
case glslang::EOpSubgroupPartitionedAdd:
|
||||
case glslang::EOpSubgroupPartitionedMul:
|
||||
case glslang::EOpSubgroupPartitionedMin:
|
||||
case glslang::EOpSubgroupPartitionedMax:
|
||||
case glslang::EOpSubgroupPartitionedAnd:
|
||||
case glslang::EOpSubgroupPartitionedOr:
|
||||
case glslang::EOpSubgroupPartitionedXor:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveAdd:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveMul:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveMin:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveMax:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveAnd:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveOr:
|
||||
case glslang::EOpSubgroupPartitionedInclusiveXor:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveAdd:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveMul:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveMin:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveMax:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveAnd:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveOr:
|
||||
case glslang::EOpSubgroupPartitionedExclusiveXor:
|
||||
#endif
|
||||
return createSubgroupOperation(op, typeId, operands, typeProxy);
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
|
||||
Reference in New Issue
Block a user