[mlir][spirv] Add support for Invariant and Patch decorations (#152301)
New tests were validated with `spriv-val`.
This commit is contained in:
parent
3f6f5b9121
commit
fa91dcbefd
@ -344,6 +344,8 @@ LogicalResult spirv::Deserializer::processDecoration(ArrayRef<uint32_t> words) {
|
||||
case spirv::Decoration::RestrictPointer:
|
||||
case spirv::Decoration::NoContraction:
|
||||
case spirv::Decoration::Constant:
|
||||
case spirv::Decoration::Invariant:
|
||||
case spirv::Decoration::Patch:
|
||||
if (words.size() != 2) {
|
||||
return emitError(unknownLoc, "OpDecoration with ")
|
||||
<< decorationName << "needs a single target <id>";
|
||||
|
@ -338,6 +338,8 @@ LogicalResult Serializer::processDecorationAttr(Location loc, uint32_t resultID,
|
||||
case spirv::Decoration::NoContraction:
|
||||
case spirv::Decoration::Constant:
|
||||
case spirv::Decoration::Block:
|
||||
case spirv::Decoration::Invariant:
|
||||
case spirv::Decoration::Patch:
|
||||
// For unit attributes and decoration attributes, the args list
|
||||
// has no values so we do nothing.
|
||||
if (isa<UnitAttr, DecorationAttr>(attr))
|
||||
|
@ -58,6 +58,20 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
|
||||
|
||||
// -----
|
||||
|
||||
spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Tessellation, Linkage], []> {
|
||||
// CHECK: patch
|
||||
spirv.GlobalVariable @var {patch} : !spirv.ptr<vector<4xf32>, Input>
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Linkage], []> {
|
||||
// CHECK: invariant
|
||||
spirv.GlobalVariable @var {invariant} : !spirv.ptr<vector<2xf32>, Output>
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Linkage], []> {
|
||||
// CHECK: linkage_attributes = #spirv.linkage_attributes<linkage_name = "outSideGlobalVar1", linkage_type = <Import>>
|
||||
spirv.GlobalVariable @var1 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user