forked from OSchip/llvm-project
[mlir][spirv] Support for a few more decorations in (de)serialization
Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D90655
This commit is contained in:
parent
9af561ec99
commit
d5bf727bcd
|
@ -780,10 +780,14 @@ LogicalResult Deserializer::processDecoration(ArrayRef<uint32_t> words) {
|
|||
}
|
||||
typeDecorations[words[0]] = words[2];
|
||||
break;
|
||||
case spirv::Decoration::Aliased:
|
||||
case spirv::Decoration::Block:
|
||||
case spirv::Decoration::BufferBlock:
|
||||
case spirv::Decoration::Flat:
|
||||
case spirv::Decoration::NonReadable:
|
||||
case spirv::Decoration::NonWritable:
|
||||
case spirv::Decoration::NoPerspective:
|
||||
case spirv::Decoration::Restrict:
|
||||
if (words.size() != 2) {
|
||||
return emitError(unknownLoc, "OpDecoration with ")
|
||||
<< decorationName << "needs a single target <id>";
|
||||
|
|
|
@ -751,12 +751,15 @@ LogicalResult Serializer::processDecoration(Location loc, uint32_t resultID,
|
|||
<< attrName << " attribute " << strAttr.getValue();
|
||||
}
|
||||
return emitError(loc, "expected string attribute for ") << attrName;
|
||||
case spirv::Decoration::Aliased:
|
||||
case spirv::Decoration::Flat:
|
||||
case spirv::Decoration::NonReadable:
|
||||
case spirv::Decoration::NonWritable:
|
||||
case spirv::Decoration::NoPerspective:
|
||||
if (auto unitAttr = attr.second.dyn_cast<UnitAttr>()) {
|
||||
// For unit attributes, the args list has no values so we do nothing
|
||||
case spirv::Decoration::Restrict:
|
||||
// For unit attributes, the args list has no values so we do nothing
|
||||
if (auto unitAttr = attr.second.dyn_cast<UnitAttr>())
|
||||
break;
|
||||
}
|
||||
return emitError(loc, "expected unit attribute for ") << attrName;
|
||||
default:
|
||||
return emitError(loc, "unhandled decoration ") << decorationName;
|
||||
|
|
|
@ -2,20 +2,50 @@
|
|||
|
||||
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
||||
// CHECK: location = 0 : i32
|
||||
spv.globalVariable @var1 {location = 0 : i32} : !spv.ptr<vector<4xf32>, Input>
|
||||
spv.globalVariable @var {location = 0 : i32} : !spv.ptr<vector<4xf32>, Input>
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
||||
// CHECK: no_perspective
|
||||
spv.globalVariable @var1 {no_perspective} : !spv.ptr<vector<4xf32>, Input>
|
||||
spv.globalVariable @var {no_perspective} : !spv.ptr<vector<4xf32>, Input>
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
||||
// CHECK: flat
|
||||
spv.globalVariable @var2 {flat} : !spv.ptr<si32, Input>
|
||||
spv.globalVariable @var {flat} : !spv.ptr<si32, Input>
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
||||
// CHECK: aliased
|
||||
// CHECK: aliased
|
||||
spv.globalVariable @var1 bind(0, 0) {aliased} : !spv.ptr<!spv.struct<(!spv.array<4xf32, stride=4>[0])>, StorageBuffer>
|
||||
spv.globalVariable @var2 bind(0, 0) {aliased} : !spv.ptr<!spv.struct<(vector<4xf32>[0])>, StorageBuffer>
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
||||
// CHECK: non_readable
|
||||
spv.globalVariable @var bind(0, 0) {non_readable} : !spv.ptr<!spv.struct<(!spv.array<4xf32, stride=4>[0])>, StorageBuffer>
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
||||
// CHECK: non_writable
|
||||
spv.globalVariable @var bind(0, 0) {non_writable} : !spv.ptr<!spv.struct<(!spv.array<4xf32, stride=4>[0])>, StorageBuffer>
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
||||
// CHECK: restrict
|
||||
spv.globalVariable @var bind(0, 0) {restrict} : !spv.ptr<!spv.struct<(!spv.array<4xf32, stride=4>[0])>, StorageBuffer>
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue