Skip to content

Commit 7fc7907

Browse files
IgWod-IMGkcloudy0717
authored andcommitted
[mlir][spirv] (De)serialize Coherent decoration (llvm#170280)
1 parent 4c25de0 commit 7fc7907

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ LogicalResult spirv::Deserializer::processDecoration(ArrayRef<uint32_t> words) {
346346
case spirv::Decoration::Constant:
347347
case spirv::Decoration::Invariant:
348348
case spirv::Decoration::Patch:
349+
case spirv::Decoration::Coherent:
349350
if (words.size() != 2) {
350351
return emitError(unknownLoc, "OpDecoration with ")
351352
<< decorationName << "needs a single target <id>";

mlir/lib/Target/SPIRV/Serialization/Serializer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ LogicalResult Serializer::processDecorationAttr(Location loc, uint32_t resultID,
373373
case spirv::Decoration::Block:
374374
case spirv::Decoration::Invariant:
375375
case spirv::Decoration::Patch:
376+
case spirv::Decoration::Coherent:
376377
// For unit attributes and decoration attributes, the args list
377378
// has no values so we do nothing.
378379
if (isa<UnitAttr, DecorationAttr>(attr))

mlir/test/Target/SPIRV/decorations.mlir

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Linkage], []> {
7777

7878
// -----
7979

80+
spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Linkage], []> {
81+
// CHECK: coherent
82+
spirv.GlobalVariable @var {coherent} : !spirv.ptr<vector<2xf32>, Output>
83+
}
84+
85+
// -----
86+
8087
spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Linkage], []> {
8188
// CHECK: linkage_attributes = #spirv.linkage_attributes<linkage_name = "outSideGlobalVar1", linkage_type = <Import>>
8289
spirv.GlobalVariable @var1 {

0 commit comments

Comments
 (0)