Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
d3aea5ed
Commit
d3aea5ed
authored
Jan 19, 2017
by
John Kessenich
Committed by
GitHub
Jan 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #679 from ashwinkolhe/akolhe_spv_khr_subgroup_vote
Implement SPV_KHR_subgroup_vote
parents
7dccb151
c720f3e6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
34 deletions
+50
-34
GLSL.ext.KHR.h
SPIRV/GLSL.ext.KHR.h
+1
-1
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+9
-10
doc.cpp
SPIRV/doc.cpp
+16
-0
spirv.hpp
SPIRV/spirv.hpp
+4
-0
spv.shaderGroupVote.comp.out
Test/baseResults/spv.shaderGroupVote.comp.out
+20
-23
No files found.
SPIRV/GLSL.ext.KHR.h
View file @
d3aea5ed
...
@@ -32,5 +32,5 @@ static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shade
...
@@ -32,5 +32,5 @@ static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shade
// SPV_KHR_shader_draw_parameters
// SPV_KHR_shader_draw_parameters
static
const
char
*
const
E_SPV_KHR_shader_draw_parameters
=
"SPV_KHR_shader_draw_parameters"
;
static
const
char
*
const
E_SPV_KHR_shader_draw_parameters
=
"SPV_KHR_shader_draw_parameters"
;
static
const
char
*
const
E_SPV_KHR_subgroup_vote
=
"SPV_KHR_subgroup_vote"
;
#endif // #ifndef GLSLextKHR_H
#endif // #ifndef GLSLextKHR_H
SPIRV/GlslangToSpv.cpp
View file @
d3aea5ed
...
@@ -4148,6 +4148,11 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
...
@@ -4148,6 +4148,11 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
op
==
glslang
::
EOpReadInvocation
)
{
op
==
glslang
::
EOpReadInvocation
)
{
builder
.
addExtension
(
spv
::
E_SPV_KHR_shader_ballot
);
builder
.
addExtension
(
spv
::
E_SPV_KHR_shader_ballot
);
builder
.
addCapability
(
spv
::
CapabilitySubgroupBallotKHR
);
builder
.
addCapability
(
spv
::
CapabilitySubgroupBallotKHR
);
}
else
if
(
op
==
glslang
::
EOpAnyInvocation
||
op
==
glslang
::
EOpAllInvocations
||
op
==
glslang
::
EOpAllInvocationsEqual
)
{
builder
.
addExtension
(
spv
::
E_SPV_KHR_subgroup_vote
);
builder
.
addCapability
(
spv
::
CapabilitySubgroupVoteKHR
);
}
else
{
}
else
{
builder
.
addCapability
(
spv
::
CapabilityGroups
);
builder
.
addCapability
(
spv
::
CapabilityGroups
);
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
...
@@ -4202,20 +4207,14 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
...
@@ -4202,20 +4207,14 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
switch
(
op
)
{
switch
(
op
)
{
case
glslang
:
:
EOpAnyInvocation
:
case
glslang
:
:
EOpAnyInvocation
:
opCode
=
spv
::
Op
GroupAny
;
opCode
=
spv
::
Op
SubgroupAnyKHR
;
break
;
break
;
case
glslang
:
:
EOpAllInvocations
:
case
glslang
:
:
EOpAllInvocations
:
opCode
=
spv
::
Op
GroupAll
;
opCode
=
spv
::
Op
SubgroupAllKHR
;
break
;
break
;
case
glslang
:
:
EOpAllInvocationsEqual
:
case
glslang
:
:
EOpAllInvocationsEqual
:
{
opCode
=
spv
::
OpSubgroupAllEqualKHR
;
spv
::
Id
groupAll
=
builder
.
createOp
(
spv
::
OpGroupAll
,
typeId
,
spvGroupOperands
);
break
;
spv
::
Id
groupAny
=
builder
.
createOp
(
spv
::
OpGroupAny
,
typeId
,
spvGroupOperands
);
return
builder
.
createBinOp
(
spv
::
OpLogicalOr
,
typeId
,
groupAll
,
builder
.
createUnaryOp
(
spv
::
OpLogicalNot
,
typeId
,
groupAny
));
}
case
glslang
:
:
EOpReadInvocation
:
case
glslang
:
:
EOpReadInvocation
:
opCode
=
spv
::
OpSubgroupReadInvocationKHR
;
opCode
=
spv
::
OpSubgroupReadInvocationKHR
;
if
(
builder
.
isVectorType
(
typeId
))
if
(
builder
.
isVectorType
(
typeId
))
...
...
SPIRV/doc.cpp
View file @
d3aea5ed
...
@@ -819,6 +819,7 @@ const char* CapabilityString(int info)
...
@@ -819,6 +819,7 @@ const char* CapabilityString(int info)
case
4423
:
return
"SubgroupBallotKHR"
;
case
4423
:
return
"SubgroupBallotKHR"
;
case
4427
:
return
"DrawParameters"
;
case
4427
:
return
"DrawParameters"
;
case
4431
:
return
"SubgroupVoteKHR"
;
#ifdef NV_EXTENSIONS
#ifdef NV_EXTENSIONS
case
5251
:
return
"GeometryShaderPassthroughNV"
;
case
5251
:
return
"GeometryShaderPassthroughNV"
;
...
@@ -1158,6 +1159,9 @@ const char* OpcodeString(int op)
...
@@ -1158,6 +1159,9 @@ const char* OpcodeString(int op)
case
4421
:
return
"OpSubgroupBallotKHR"
;
case
4421
:
return
"OpSubgroupBallotKHR"
;
case
4422
:
return
"OpSubgroupFirstInvocationKHR"
;
case
4422
:
return
"OpSubgroupFirstInvocationKHR"
;
case
4428
:
return
"OpSubgroupAnyKHR"
;
case
4429
:
return
"OpSubgroupAllKHR"
;
case
4430
:
return
"OpSubgroupAllEqualKHR"
;
case
4432
:
return
"OpSubgroupReadInvocationKHR"
;
case
4432
:
return
"OpSubgroupReadInvocationKHR"
;
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
...
@@ -2771,6 +2775,18 @@ void Parameterize()
...
@@ -2771,6 +2775,18 @@ void Parameterize()
InstructionDesc
[
OpSubgroupFirstInvocationKHR
].
operands
.
push
(
OperandId
,
"'Value'"
);
InstructionDesc
[
OpSubgroupFirstInvocationKHR
].
operands
.
push
(
OperandId
,
"'Value'"
);
InstructionDesc
[
OpSubgroupAnyKHR
].
capabilities
.
push_back
(
CapabilitySubgroupVoteKHR
);
InstructionDesc
[
OpSubgroupAnyKHR
].
operands
.
push
(
OperandScope
,
"'Execution'"
);
InstructionDesc
[
OpSubgroupAnyKHR
].
operands
.
push
(
OperandId
,
"'Predicate'"
);
InstructionDesc
[
OpSubgroupAllKHR
].
capabilities
.
push_back
(
CapabilitySubgroupVoteKHR
);
InstructionDesc
[
OpSubgroupAllKHR
].
operands
.
push
(
OperandScope
,
"'Execution'"
);
InstructionDesc
[
OpSubgroupAllKHR
].
operands
.
push
(
OperandId
,
"'Predicate'"
);
InstructionDesc
[
OpSubgroupAllEqualKHR
].
capabilities
.
push_back
(
CapabilitySubgroupVoteKHR
);
InstructionDesc
[
OpSubgroupAllEqualKHR
].
operands
.
push
(
OperandScope
,
"'Execution'"
);
InstructionDesc
[
OpSubgroupAllEqualKHR
].
operands
.
push
(
OperandId
,
"'Predicate'"
);
InstructionDesc
[
OpSubgroupReadInvocationKHR
].
capabilities
.
push_back
(
CapabilityGroups
);
InstructionDesc
[
OpSubgroupReadInvocationKHR
].
capabilities
.
push_back
(
CapabilityGroups
);
InstructionDesc
[
OpSubgroupReadInvocationKHR
].
operands
.
push
(
OperandId
,
"'Value'"
);
InstructionDesc
[
OpSubgroupReadInvocationKHR
].
operands
.
push
(
OperandId
,
"'Value'"
);
InstructionDesc
[
OpSubgroupReadInvocationKHR
].
operands
.
push
(
OperandId
,
"'Index'"
);
InstructionDesc
[
OpSubgroupReadInvocationKHR
].
operands
.
push
(
OperandId
,
"'Index'"
);
...
...
SPIRV/spirv.hpp
View file @
d3aea5ed
...
@@ -605,6 +605,7 @@ enum Capability {
...
@@ -605,6 +605,7 @@ enum Capability {
CapabilityMultiViewport
=
57
,
CapabilityMultiViewport
=
57
,
CapabilitySubgroupBallotKHR
=
4423
,
CapabilitySubgroupBallotKHR
=
4423
,
CapabilityDrawParameters
=
4427
,
CapabilityDrawParameters
=
4427
,
CapabilitySubgroupVoteKHR
=
4431
,
CapabilityMax
=
0x7fffffff
,
CapabilityMax
=
0x7fffffff
,
};
};
...
@@ -906,6 +907,9 @@ enum Op {
...
@@ -906,6 +907,9 @@ enum Op {
OpSubgroupBallotKHR
=
4421
,
OpSubgroupBallotKHR
=
4421
,
OpSubgroupFirstInvocationKHR
=
4422
,
OpSubgroupFirstInvocationKHR
=
4422
,
OpSubgroupReadInvocationKHR
=
4432
,
OpSubgroupReadInvocationKHR
=
4432
,
OpSubgroupAllKHR
=
4428
,
OpSubgroupAnyKHR
=
4429
,
OpSubgroupAllEqualKHR
=
4430
,
OpMax
=
0x7fffffff
,
OpMax
=
0x7fffffff
,
};
};
...
...
Test/baseResults/spv.shaderGroupVote.comp.out
View file @
d3aea5ed
...
@@ -3,10 +3,11 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -3,10 +3,11 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
// Id's are bound by 3
7
// Id's are bound by 3
3
Capability Shader
Capability Shader
Capability Groups
Capability SubgroupVoteKHR
Extension "SPV_KHR_subgroup_vote"
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
EntryPoint GLCompute 4 "main"
...
@@ -22,7 +23,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -22,7 +23,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Decorate 10(Buffers) BufferBlock
Decorate 10(Buffers) BufferBlock
Decorate 12 DescriptorSet 0
Decorate 12 DescriptorSet 0
Decorate 12 Binding 0
Decorate 12 Binding 0
Decorate 3
6
BuiltIn WorkgroupSize
Decorate 3
2
BuiltIn WorkgroupSize
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeBool
6: TypeBool
...
@@ -35,11 +36,10 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -35,11 +36,10 @@ Warning, version 450 is not yet complete; most version-specific features are pre
14: 13(int) Constant 0
14: 13(int) Constant 0
15: TypePointer Uniform 9(int)
15: TypePointer Uniform 9(int)
18: 9(int) Constant 0
18: 9(int) Constant 0
21: 9(int) Constant 3
27: 9(int) Constant 1
31: 9(int) Constant 1
30: TypeVector 9(int) 3
34: TypeVector 9(int) 3
31: 9(int) Constant 4
35: 9(int) Constant 4
32: 30(ivec3) ConstantComposite 31 31 27
36: 34(ivec3) ConstantComposite 35 35 31
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
8(b1): 7(ptr) Variable Function
8(b1): 7(ptr) Variable Function
...
@@ -48,20 +48,17 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -48,20 +48,17 @@ Warning, version 450 is not yet complete; most version-specific features are pre
19: 6(bool) INotEqual 17 18
19: 6(bool) INotEqual 17 18
Store 8(b1) 19
Store 8(b1) 19
20: 6(bool) Load 8(b1)
20: 6(bool) Load 8(b1)
22: 6(bool) GroupAny 21 20
21: 6(bool) SubgroupAllKHR 20
Store 8(b1) 22
Store 8(b1) 21
23: 6(bool) Load 8(b1)
22: 6(bool) Load 8(b1)
24: 6(bool) GroupAll 21 23
23: 6(bool) SubgroupAnyKHR 22
Store 8(b1) 24
Store 8(b1) 23
25: 6(bool) Load 8(b1)
24: 6(bool) Load 8(b1)
26: 6(bool) GroupAll 21 25
25: 6(bool) SubgroupAllEqualKHR 24
27: 6(bool) GroupAny 21 25
Store 8(b1) 25
28: 6(bool) LogicalNot 27
26: 6(bool) Load 8(b1)
29: 6(bool) LogicalOr 26 28
28: 9(int) Select 26 27 18
Store 8(b1) 29
29: 15(ptr) AccessChain 12 14
30: 6(bool) Load 8(b1)
Store 29 28
32: 9(int) Select 30 31 18
33: 15(ptr) AccessChain 12 14
Store 33 32
Return
Return
FunctionEnd
FunctionEnd
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment