[Mesa-dev] [PATCH 2/2] spirv: bump headers to SPIRV 1.1
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Wed Jan 25 13:06:02 UTC 2017
Just to confirm, are you fine with the header update triggering warnings
fixed by the following commit?
Thanks!
On 25/01/17 12:45, Bas Nieuwenhuizen wrote:
> Can you split the switch changes to a different commit? With that,
>
> Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
>
> for the series.
>
> On Wed, Jan 25, 2017, at 04:39, Lionel Landwerlin wrote:
>> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
>> ---
>> src/compiler/spirv/GLSL.std.450.h | 12 ++++--
>> src/compiler/spirv/spirv.h | 77
>> +++++++++++++++++++++++++++++++++++---
>> src/compiler/spirv/spirv_info.c | 6 +++
>> src/compiler/spirv/spirv_to_nir.c | 12 ++++++
>> src/compiler/spirv/vtn_variables.c | 3 ++
>> 5 files changed, 101 insertions(+), 9 deletions(-)
>>
>> diff --git a/src/compiler/spirv/GLSL.std.450.h
>> b/src/compiler/spirv/GLSL.std.450.h
>> index d1c9b5c1d4..54cc00e9a8 100644
>> --- a/src/compiler/spirv/GLSL.std.450.h
>> +++ b/src/compiler/spirv/GLSL.std.450.h
>> @@ -1,5 +1,5 @@
>> /*
>> -** Copyright (c) 2014-2015 The Khronos Group Inc.
>> +** Copyright (c) 2014-2016 The Khronos Group Inc.
>> **
>> ** Permission is hereby granted, free of charge, to any person obtaining
>> a copy
>> ** of this software and/or associated documentation files (the
>> "Materials"),
>> @@ -27,8 +27,8 @@
>> #ifndef GLSLstd450_H
>> #define GLSLstd450_H
>>
>> -const int GLSLstd450Version = 99;
>> -const int GLSLstd450Revision = 3;
>> +static const int GLSLstd450Version = 100;
>> +static const int GLSLstd450Revision = 3;
>>
>> enum GLSLstd450 {
>> GLSLstd450Bad = 0, // Don't use
>> @@ -83,7 +83,7 @@ enum GLSLstd450 {
>> GLSLstd450UClamp = 44,
>> GLSLstd450SClamp = 45,
>> GLSLstd450FMix = 46,
>> - GLSLstd450IMix = 47,
>> + GLSLstd450IMix = 47, // Reserved
>> GLSLstd450Step = 48,
>> GLSLstd450SmoothStep = 49,
>>
>> @@ -121,6 +121,10 @@ enum GLSLstd450 {
>> GLSLstd450InterpolateAtSample = 77,
>> GLSLstd450InterpolateAtOffset = 78,
>>
>> + GLSLstd450NMin = 79,
>> + GLSLstd450NMax = 80,
>> + GLSLstd450NClamp = 81,
>> +
>> GLSLstd450Count
>> };
>>
>> diff --git a/src/compiler/spirv/spirv.h b/src/compiler/spirv/spirv.h
>> index 63bcb2f88d..769c10225d 100644
>> --- a/src/compiler/spirv/spirv.h
>> +++ b/src/compiler/spirv/spirv.h
>> @@ -1,5 +1,5 @@
>> /*
>> -** Copyright (c) 2014-2015 The Khronos Group Inc.
>> +** Copyright (c) 2014-2016 The Khronos Group Inc.
>> **
>> ** Permission is hereby granted, free of charge, to any person obtaining
>> a copy
>> ** of this software and/or associated documentation files (the
>> "Materials"),
>> @@ -50,12 +50,12 @@
>>
>> typedef unsigned int SpvId;
>>
>> -#define SPV_VERSION 0x10000
>> -#define SPV_REVISION 2
>> +#define SPV_VERSION 0x10100
>> +#define SPV_REVISION 4
>>
>> static const unsigned int SpvMagicNumber = 0x07230203;
>> -static const unsigned int SpvVersion = 0x00010000;
>> -static const unsigned int SpvRevision = 2;
>> +static const unsigned int SpvVersion = 0x00010100;
>> +static const unsigned int SpvRevision = 4;
>> static const unsigned int SpvOpCodeMask = 0xffff;
>> static const unsigned int SpvWordCountShift = 16;
>>
>> @@ -65,6 +65,7 @@ typedef enum SpvSourceLanguage_ {
>> SpvSourceLanguageGLSL = 2,
>> SpvSourceLanguageOpenCL_C = 3,
>> SpvSourceLanguageOpenCL_CPP = 4,
>> + SpvSourceLanguageMax = 0x7fffffff,
>> } SpvSourceLanguage;
>>
>> typedef enum SpvExecutionModel_ {
>> @@ -75,18 +76,21 @@ typedef enum SpvExecutionModel_ {
>> SpvExecutionModelFragment = 4,
>> SpvExecutionModelGLCompute = 5,
>> SpvExecutionModelKernel = 6,
>> + SpvExecutionModelMax = 0x7fffffff,
>> } SpvExecutionModel;
>>
>> typedef enum SpvAddressingModel_ {
>> SpvAddressingModelLogical = 0,
>> SpvAddressingModelPhysical32 = 1,
>> SpvAddressingModelPhysical64 = 2,
>> + SpvAddressingModelMax = 0x7fffffff,
>> } SpvAddressingModel;
>>
>> typedef enum SpvMemoryModel_ {
>> SpvMemoryModelSimple = 0,
>> SpvMemoryModelGLSL450 = 1,
>> SpvMemoryModelOpenCL = 2,
>> + SpvMemoryModelMax = 0x7fffffff,
>> } SpvMemoryModel;
>>
>> typedef enum SpvExecutionMode_ {
>> @@ -121,6 +125,11 @@ typedef enum SpvExecutionMode_ {
>> SpvExecutionModeOutputTriangleStrip = 29,
>> SpvExecutionModeVecTypeHint = 30,
>> SpvExecutionModeContractionOff = 31,
>> + SpvExecutionModeInitializer = 33,
>> + SpvExecutionModeFinalizer = 34,
>> + SpvExecutionModeSubgroupSize = 35,
>> + SpvExecutionModeSubgroupsPerWorkgroup = 36,
>> + SpvExecutionModeMax = 0x7fffffff,
>> } SpvExecutionMode;
>>
>> typedef enum SpvStorageClass_ {
>> @@ -136,6 +145,7 @@ typedef enum SpvStorageClass_ {
>> SpvStorageClassPushConstant = 9,
>> SpvStorageClassAtomicCounter = 10,
>> SpvStorageClassImage = 11,
>> + SpvStorageClassMax = 0x7fffffff,
>> } SpvStorageClass;
>>
>> typedef enum SpvDim_ {
>> @@ -146,6 +156,7 @@ typedef enum SpvDim_ {
>> SpvDimRect = 4,
>> SpvDimBuffer = 5,
>> SpvDimSubpassData = 6,
>> + SpvDimMax = 0x7fffffff,
>> } SpvDim;
>>
>> typedef enum SpvSamplerAddressingMode_ {
>> @@ -154,11 +165,13 @@ typedef enum SpvSamplerAddressingMode_ {
>> SpvSamplerAddressingModeClamp = 2,
>> SpvSamplerAddressingModeRepeat = 3,
>> SpvSamplerAddressingModeRepeatMirrored = 4,
>> + SpvSamplerAddressingModeMax = 0x7fffffff,
>> } SpvSamplerAddressingMode;
>>
>> typedef enum SpvSamplerFilterMode_ {
>> SpvSamplerFilterModeNearest = 0,
>> SpvSamplerFilterModeLinear = 1,
>> + SpvSamplerFilterModeMax = 0x7fffffff,
>> } SpvSamplerFilterMode;
>>
>> typedef enum SpvImageFormat_ {
>> @@ -202,6 +215,7 @@ typedef enum SpvImageFormat_ {
>> SpvImageFormatRg8ui = 37,
>> SpvImageFormatR16ui = 38,
>> SpvImageFormatR8ui = 39,
>> + SpvImageFormatMax = 0x7fffffff,
>> } SpvImageFormat;
>>
>> typedef enum SpvImageChannelOrder_ {
>> @@ -224,6 +238,8 @@ typedef enum SpvImageChannelOrder_ {
>> SpvImageChannelOrdersRGBx = 16,
>> SpvImageChannelOrdersRGBA = 17,
>> SpvImageChannelOrdersBGRA = 18,
>> + SpvImageChannelOrderABGR = 19,
>> + SpvImageChannelOrderMax = 0x7fffffff,
>> } SpvImageChannelOrder;
>>
>> typedef enum SpvImageChannelDataType_ {
>> @@ -244,6 +260,7 @@ typedef enum SpvImageChannelDataType_ {
>> SpvImageChannelDataTypeFloat = 14,
>> SpvImageChannelDataTypeUnormInt24 = 15,
>> SpvImageChannelDataTypeUnormInt101010_2 = 16,
>> + SpvImageChannelDataTypeMax = 0x7fffffff,
>> } SpvImageChannelDataType;
>>
>> typedef enum SpvImageOperandsShift_ {
>> @@ -255,6 +272,7 @@ typedef enum SpvImageOperandsShift_ {
>> SpvImageOperandsConstOffsetsShift = 5,
>> SpvImageOperandsSampleShift = 6,
>> SpvImageOperandsMinLodShift = 7,
>> + SpvImageOperandsMax = 0x7fffffff,
>> } SpvImageOperandsShift;
>>
>> typedef enum SpvImageOperandsMask_ {
>> @@ -275,6 +293,7 @@ typedef enum SpvFPFastMathModeShift_ {
>> SpvFPFastMathModeNSZShift = 2,
>> SpvFPFastMathModeAllowRecipShift = 3,
>> SpvFPFastMathModeFastShift = 4,
>> + SpvFPFastMathModeMax = 0x7fffffff,
>> } SpvFPFastMathModeShift;
>>
>> typedef enum SpvFPFastMathModeMask_ {
>> @@ -291,17 +310,20 @@ typedef enum SpvFPRoundingMode_ {
>> SpvFPRoundingModeRTZ = 1,
>> SpvFPRoundingModeRTP = 2,
>> SpvFPRoundingModeRTN = 3,
>> + SpvFPRoundingModeMax = 0x7fffffff,
>> } SpvFPRoundingMode;
>>
>> typedef enum SpvLinkageType_ {
>> SpvLinkageTypeExport = 0,
>> SpvLinkageTypeImport = 1,
>> + SpvLinkageTypeMax = 0x7fffffff,
>> } SpvLinkageType;
>>
>> typedef enum SpvAccessQualifier_ {
>> SpvAccessQualifierReadOnly = 0,
>> SpvAccessQualifierWriteOnly = 1,
>> SpvAccessQualifierReadWrite = 2,
>> + SpvAccessQualifierMax = 0x7fffffff,
>> } SpvAccessQualifier;
>>
>> typedef enum SpvFunctionParameterAttribute_ {
>> @@ -313,6 +335,7 @@ typedef enum SpvFunctionParameterAttribute_ {
>> SpvFunctionParameterAttributeNoCapture = 5,
>> SpvFunctionParameterAttributeNoWrite = 6,
>> SpvFunctionParameterAttributeNoReadWrite = 7,
>> + SpvFunctionParameterAttributeMax = 0x7fffffff,
>> } SpvFunctionParameterAttribute;
>>
>> typedef enum SpvDecoration_ {
>> @@ -359,6 +382,8 @@ typedef enum SpvDecoration_ {
>> SpvDecorationNoContraction = 42,
>> SpvDecorationInputAttachmentIndex = 43,
>> SpvDecorationAlignment = 44,
>> + SpvDecorationMaxByteOffset = 45,
>> + SpvDecorationMax = 0x7fffffff,
>> } SpvDecoration;
>>
>> typedef enum SpvBuiltIn_ {
>> @@ -403,11 +428,21 @@ typedef enum SpvBuiltIn_ {
>> SpvBuiltInSubgroupLocalInvocationId = 41,
>> SpvBuiltInVertexIndex = 42,
>> SpvBuiltInInstanceIndex = 43,
>> + SpvBuiltInSubgroupEqMaskKHR = 4416,
>> + SpvBuiltInSubgroupGeMaskKHR = 4417,
>> + SpvBuiltInSubgroupGtMaskKHR = 4418,
>> + SpvBuiltInSubgroupLeMaskKHR = 4419,
>> + SpvBuiltInSubgroupLtMaskKHR = 4420,
>> + SpvBuiltInBaseVertex = 4424,
>> + SpvBuiltInBaseInstance = 4425,
>> + SpvBuiltInDrawIndex = 4426,
>> + SpvBuiltInMax = 0x7fffffff,
>> } SpvBuiltIn;
>>
>> typedef enum SpvSelectionControlShift_ {
>> SpvSelectionControlFlattenShift = 0,
>> SpvSelectionControlDontFlattenShift = 1,
>> + SpvSelectionControlMax = 0x7fffffff,
>> } SpvSelectionControlShift;
>>
>> typedef enum SpvSelectionControlMask_ {
>> @@ -419,12 +454,17 @@ typedef enum SpvSelectionControlMask_ {
>> typedef enum SpvLoopControlShift_ {
>> SpvLoopControlUnrollShift = 0,
>> SpvLoopControlDontUnrollShift = 1,
>> + SpvLoopControlDependencyInfiniteShift = 2,
>> + SpvLoopControlDependencyLengthShift = 3,
>> + SpvLoopControlMax = 0x7fffffff,
>> } SpvLoopControlShift;
>>
>> typedef enum SpvLoopControlMask_ {
>> SpvLoopControlMaskNone = 0,
>> SpvLoopControlUnrollMask = 0x00000001,
>> SpvLoopControlDontUnrollMask = 0x00000002,
>> + SpvLoopControlDependencyInfiniteMask = 0x00000004,
>> + SpvLoopControlDependencyLengthMask = 0x00000008,
>> } SpvLoopControlMask;
>>
>> typedef enum SpvFunctionControlShift_ {
>> @@ -432,6 +472,7 @@ typedef enum SpvFunctionControlShift_ {
>> SpvFunctionControlDontInlineShift = 1,
>> SpvFunctionControlPureShift = 2,
>> SpvFunctionControlConstShift = 3,
>> + SpvFunctionControlMax = 0x7fffffff,
>> } SpvFunctionControlShift;
>>
>> typedef enum SpvFunctionControlMask_ {
>> @@ -453,6 +494,7 @@ typedef enum SpvMemorySemanticsShift_ {
>> SpvMemorySemanticsCrossWorkgroupMemoryShift = 9,
>> SpvMemorySemanticsAtomicCounterMemoryShift = 10,
>> SpvMemorySemanticsImageMemoryShift = 11,
>> + SpvMemorySemanticsMax = 0x7fffffff,
>> } SpvMemorySemanticsShift;
>>
>> typedef enum SpvMemorySemanticsMask_ {
>> @@ -473,6 +515,7 @@ typedef enum SpvMemoryAccessShift_ {
>> SpvMemoryAccessVolatileShift = 0,
>> SpvMemoryAccessAlignedShift = 1,
>> SpvMemoryAccessNontemporalShift = 2,
>> + SpvMemoryAccessMax = 0x7fffffff,
>> } SpvMemoryAccessShift;
>>
>> typedef enum SpvMemoryAccessMask_ {
>> @@ -488,22 +531,26 @@ typedef enum SpvScope_ {
>> SpvScopeWorkgroup = 2,
>> SpvScopeSubgroup = 3,
>> SpvScopeInvocation = 4,
>> + SpvScopeMax = 0x7fffffff,
>> } SpvScope;
>>
>> typedef enum SpvGroupOperation_ {
>> SpvGroupOperationReduce = 0,
>> SpvGroupOperationInclusiveScan = 1,
>> SpvGroupOperationExclusiveScan = 2,
>> + SpvGroupOperationMax = 0x7fffffff,
>> } SpvGroupOperation;
>>
>> typedef enum SpvKernelEnqueueFlags_ {
>> SpvKernelEnqueueFlagsNoWait = 0,
>> SpvKernelEnqueueFlagsWaitKernel = 1,
>> SpvKernelEnqueueFlagsWaitWorkGroup = 2,
>> + SpvKernelEnqueueFlagsMax = 0x7fffffff,
>> } SpvKernelEnqueueFlags;
>>
>> typedef enum SpvKernelProfilingInfoShift_ {
>> SpvKernelProfilingInfoCmdExecTimeShift = 0,
>> + SpvKernelProfilingInfoMax = 0x7fffffff,
>> } SpvKernelProfilingInfoShift;
>>
>> typedef enum SpvKernelProfilingInfoMask_ {
>> @@ -568,6 +615,12 @@ typedef enum SpvCapability_ {
>> SpvCapabilityStorageImageReadWithoutFormat = 55,
>> SpvCapabilityStorageImageWriteWithoutFormat = 56,
>> SpvCapabilityMultiViewport = 57,
>> + SpvCapabilitySubgroupDispatch = 58,
>> + SpvCapabilityNamedBarrier = 59,
>> + SpvCapabilityPipeStorage = 60,
>> + SpvCapabilitySubgroupBallotKHR = 4423,
>> + SpvCapabilityDrawParameters = 4427,
>> + SpvCapabilityMax = 0x7fffffff,
>> } SpvCapability;
>>
>> typedef enum SpvOp_ {
>> @@ -864,6 +917,20 @@ typedef enum SpvOp_ {
>> SpvOpNoLine = 317,
>> SpvOpAtomicFlagTestAndSet = 318,
>> SpvOpAtomicFlagClear = 319,
>> + SpvOpImageSparseRead = 320,
>> + SpvOpSizeOf = 321,
>> + SpvOpTypePipeStorage = 322,
>> + SpvOpConstantPipeStorage = 323,
>> + SpvOpCreatePipeFromPipeStorage = 324,
>> + SpvOpGetKernelLocalSizeForSubgroupCount = 325,
>> + SpvOpGetKernelMaxNumSubgroups = 326,
>> + SpvOpTypeNamedBarrier = 327,
>> + SpvOpNamedBarrierInitialize = 328,
>> + SpvOpMemoryNamedBarrier = 329,
>> + SpvOpModuleProcessed = 330,
>> + SpvOpSubgroupBallotKHR = 4421,
>> + SpvOpSubgroupFirstInvocationKHR = 4422,
>> + SpvOpMax = 0x7fffffff,
>> } SpvOp;
>>
>> #endif // #ifndef spirv_H
>> diff --git a/src/compiler/spirv/spirv_info.c
>> b/src/compiler/spirv/spirv_info.c
>> index 7a5774c443..1036b41c31 100644
>> --- a/src/compiler/spirv/spirv_info.c
>> +++ b/src/compiler/spirv/spirv_info.c
>> @@ -82,6 +82,11 @@ static const char * const capability_to_string[] = {
>> CAPABILITY(StorageImageReadWithoutFormat),
>> CAPABILITY(StorageImageWriteWithoutFormat),
>> CAPABILITY(MultiViewport),
>> + CAPABILITY(SubgroupDispatch),
>> + CAPABILITY(NamedBarrier),
>> + CAPABILITY(PipeStorage),
>> + CAPABILITY(SubgroupBallotKHR),
>> + CAPABILITY(DrawParameters),
>> };
>>
>> const char *
>> @@ -138,6 +143,7 @@ static const char * const decoration_to_string[] = {
>> DECORATION(NoContraction),
>> DECORATION(InputAttachmentIndex),
>> DECORATION(Alignment),
>> + DECORATION(MaxByteOffset),
>> };
>>
>> const char *
>> diff --git a/src/compiler/spirv/spirv_to_nir.c
>> b/src/compiler/spirv/spirv_to_nir.c
>> index 968502c5fd..6f18af2018 100644
>> --- a/src/compiler/spirv/spirv_to_nir.c
>> +++ b/src/compiler/spirv/spirv_to_nir.c
>> @@ -561,6 +561,9 @@ struct_member_decoration_cb(struct vtn_builder *b,
>> vtn_warn("Decoration only allowed for CL-style kernels: %s",
>> spirv_decoration_to_string(dec->decoration));
>> break;
>> +
>> + default:
>> + unreachable("Unhandled decoration");
>> }
>> }
>>
>> @@ -638,6 +641,9 @@ type_decoration_cb(struct vtn_builder *b,
>> vtn_warn("Decoration only allowed for CL-style kernels: %s",
>> spirv_decoration_to_string(dec->decoration));
>> break;
>> +
>> + default:
>> + unreachable("Unhandled decoration");
>> }
>> }
>>
>> @@ -2653,6 +2659,9 @@ vtn_handle_preamble_instruction(struct vtn_builder
>> *b, SpvOp opcode,
>> case SpvCapabilityTessellationPointSize:
>> spv_check_supported(tessellation, cap);
>> break;
>> +
>> + default:
>> + unreachable("Unhandled capability");
>> }
>> break;
>> }
>> @@ -2842,6 +2851,9 @@ vtn_handle_execution_mode(struct vtn_builder *b,
>> struct vtn_value *entry_point,
>> case SpvExecutionModeVecTypeHint:
>> case SpvExecutionModeContractionOff:
>> break; /* OpenCL */
>> +
>> + default:
>> + unreachable("Unhandled execution mode");
>> }
>> }
>>
>> diff --git a/src/compiler/spirv/vtn_variables.c
>> b/src/compiler/spirv/vtn_variables.c
>> index 4d1ec789cc..05ac91eedd 100644
>> --- a/src/compiler/spirv/vtn_variables.c
>> +++ b/src/compiler/spirv/vtn_variables.c
>> @@ -1139,6 +1139,9 @@ apply_var_decoration(struct vtn_builder *b,
>> nir_variable *nir_var,
>> vtn_warn("Decoration only allowed for CL-style kernels: %s",
>> spirv_decoration_to_string(dec->decoration));
>> break;
>> +
>> + default:
>> + unreachable("Unhandled decoration");
>> }
>> }
>>
>> --
>> 2.11.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list