Re: [Mesa-dev] [PATCH 1/8] spirv: Import the latest 1.0.2 header from Khronos

2017-07-14 Thread Ian Romanick
On 07/14/2017 05:45 AM, Emil Velikov wrote:
> Hi gents,
> 
> On 14 July 2017 at 02:57, Jason Ekstrand  wrote:
>> On Thu, Jul 13, 2017 at 6:38 PM, Ian Romanick  wrote:
> 
>>>
>>>   This will cause spirv_capability_to_string() to
>>> happily return NULL pointers that none of the callers are prepared to
>>> handle.
>>
> If this is an issue we'd want fixed in -stable, can I suggest a simple
> NULL check.

I believe the NULL pointers would only be consumed by printf, which
won't explode.  I don't think a -stable fix is necessary.

> Hmm the spirv_*_to_string helpers are used by vtn_warn() so there's no
> big need for stable fix?
> 
> Out of curiosity: is vtn_warn() meant to aid developers, or there's
> something about it in the spirc/vulkan spec?
> 
> Thanks
> Emil
> 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/8] spirv: Import the latest 1.0.2 header from Khronos

2017-07-14 Thread Emil Velikov
Hi gents,

On 14 July 2017 at 02:57, Jason Ekstrand  wrote:
> On Thu, Jul 13, 2017 at 6:38 PM, Ian Romanick  wrote:

>>
>>   This will cause spirv_capability_to_string() to
>> happily return NULL pointers that none of the callers are prepared to
>> handle.
>
If this is an issue we'd want fixed in -stable, can I suggest a simple
NULL check.
Hmm the spirv_*_to_string helpers are used by vtn_warn() so there's no
big need for stable fix?

Out of curiosity: is vtn_warn() meant to aid developers, or there's
something about it in the spirc/vulkan spec?

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/8] spirv: Import the latest 1.0.2 header from Khronos

2017-07-13 Thread Ian Romanick
On 07/13/2017 06:57 PM, Jason Ekstrand wrote:
> On Thu, Jul 13, 2017 at 6:38 PM, Ian Romanick  > wrote:
> 
> Shouldn't this also update capability_to_string in spriv_info.c?
> 
> 
> Yes, probably.
>  
> 
>   I'm
> also questioning that implementation... there are huge blocks in that
> array (e.g., all the elements from 61 to 4322) that are zeroed out by
> the initialization.
> 
> 
> Ugh... I didn't realize we were packing it into an array. :(  We really
> need to use a switch since it's sparse.
> 
> I think the correct answer here is a bit of python codegen.  There is a
> json file that provides all of these SPIR-V enums so it should be fairly
> easy to do.

I was thinking the same thing.  I'm on it.

>   This will cause spirv_capability_to_string() to
> happily return NULL pointers that none of the callers are prepared to
> handle.
> 
> 
> I think you'll find that the SPIR-V parser does all sorts of "bad"
> things if you touch it wrong.  It was, after all, written for the Vulkan
> world where crashing is a valid response to *any* invalid input.  We
> probably want to make it a bit more robust for GL.  I've got something
> of a plan for doing so but haven't had the time to sit down and hack on it.
> 
> --Jason
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/8] spirv: Import the latest 1.0.2 header from Khronos

2017-07-13 Thread Jason Ekstrand
On Thu, Jul 13, 2017 at 6:38 PM, Ian Romanick  wrote:

> Shouldn't this also update capability_to_string in spriv_info.c?


Yes, probably.


>   I'm
> also questioning that implementation... there are huge blocks in that
> array (e.g., all the elements from 61 to 4322) that are zeroed out by
> the initialization.


Ugh... I didn't realize we were packing it into an array. :(  We really
need to use a switch since it's sparse.

I think the correct answer here is a bit of python codegen.  There is a
json file that provides all of these SPIR-V enums so it should be fairly
easy to do.


>   This will cause spirv_capability_to_string() to
> happily return NULL pointers that none of the callers are prepared to
> handle.
>

I think you'll find that the SPIR-V parser does all sorts of "bad" things
if you touch it wrong.  It was, after all, written for the Vulkan world
where crashing is a valid response to *any* invalid input.  We probably
want to make it a bit more robust for GL.  I've got something of a plan for
doing so but haven't had the time to sit down and hack on it.

--Jason


>
> On 07/13/2017 12:41 PM, Jason Ekstrand wrote:
> > ---
> >  src/compiler/spirv/spirv.h | 41 ++
> +++
> >  1 file changed, 37 insertions(+), 4 deletions(-)
> >
> > diff --git a/src/compiler/spirv/spirv.h b/src/compiler/spirv/spirv.h
> > index 89354c0..61559a1 100644
> > --- a/src/compiler/spirv/spirv.h
> > +++ b/src/compiler/spirv/spirv.h
> > @@ -50,12 +50,12 @@
> >
> >  typedef unsigned int SpvId;
> >
> > -#define SPV_VERSION 0x10100
> > -#define SPV_REVISION 6
> > +#define SPV_VERSION 0x10200
> > +#define SPV_REVISION 1
> >
> >  static const unsigned int SpvMagicNumber = 0x07230203;
> > -static const unsigned int SpvVersion = 0x00010100;
> > -static const unsigned int SpvRevision = 6;
> > +static const unsigned int SpvVersion = 0x00010200;
> > +static const unsigned int SpvRevision = 1;
> >  static const unsigned int SpvOpCodeMask = 0x;
> >  static const unsigned int SpvWordCountShift = 16;
> >
> > @@ -65,6 +65,7 @@ typedef enum SpvSourceLanguage_ {
> >  SpvSourceLanguageGLSL = 2,
> >  SpvSourceLanguageOpenCL_C = 3,
> >  SpvSourceLanguageOpenCL_CPP = 4,
> > +SpvSourceLanguageHLSL = 5,
> >  SpvSourceLanguageMax = 0x7fff,
> >  } SpvSourceLanguage;
> >
> > @@ -129,6 +130,10 @@ typedef enum SpvExecutionMode_ {
> >  SpvExecutionModeFinalizer = 34,
> >  SpvExecutionModeSubgroupSize = 35,
> >  SpvExecutionModeSubgroupsPerWorkgroup = 36,
> > +SpvExecutionModeSubgroupsPerWorkgroupId = 37,
> > +SpvExecutionModeLocalSizeId = 38,
> > +SpvExecutionModeLocalSizeHintId = 39,
> > +SpvExecutionModePostDepthCoverage = 4446,
> >  SpvExecutionModeMax = 0x7fff,
> >  } SpvExecutionMode;
> >
> > @@ -145,6 +150,7 @@ typedef enum SpvStorageClass_ {
> >  SpvStorageClassPushConstant = 9,
> >  SpvStorageClassAtomicCounter = 10,
> >  SpvStorageClassImage = 11,
> > +SpvStorageClassStorageBuffer = 12,
> >  SpvStorageClassMax = 0x7fff,
> >  } SpvStorageClass;
> >
> > @@ -383,6 +389,9 @@ typedef enum SpvDecoration_ {
> >  SpvDecorationInputAttachmentIndex = 43,
> >  SpvDecorationAlignment = 44,
> >  SpvDecorationMaxByteOffset = 45,
> > +SpvDecorationAlignmentId = 46,
> > +SpvDecorationMaxByteOffsetId = 47,
> > +SpvDecorationExplicitInterpAMD = 4999,
> >  SpvDecorationOverrideCoverageNV = 5248,
> >  SpvDecorationPassthroughNV = 5250,
> >  SpvDecorationViewportRelativeNV = 5252,
> > @@ -442,6 +451,13 @@ typedef enum SpvBuiltIn_ {
> >  SpvBuiltInDrawIndex = 4426,
> >  SpvBuiltInDeviceIndex = 4438,
> >  SpvBuiltInViewIndex = 4440,
> > +SpvBuiltInBaryCoordNoPerspAMD = 4992,
> > +SpvBuiltInBaryCoordNoPerspCentroidAMD = 4993,
> > +SpvBuiltInBaryCoordNoPerspSampleAMD = 4994,
> > +SpvBuiltInBaryCoordSmoothAMD = 4995,
> > +SpvBuiltInBaryCoordSmoothCentroidAMD = 4996,
> > +SpvBuiltInBaryCoordSmoothSampleAMD = 4997,
> > +SpvBuiltInBaryCoordPullModelAMD = 4998,
> >  SpvBuiltInViewportMaskNV = 5253,
> >  SpvBuiltInSecondaryPositionNV = 5257,
> >  SpvBuiltInSecondaryViewportMaskNV = 5258,
> > @@ -632,12 +648,19 @@ typedef enum SpvCapability_ {
> >  SpvCapabilitySubgroupBallotKHR = 4423,
> >  SpvCapabilityDrawParameters = 4427,
> >  SpvCapabilitySubgroupVoteKHR = 4431,
> > +SpvCapabilityStorageBuffer16BitAccess = 4433,
> >  SpvCapabilityStorageUniformBufferBlock16 = 4433,
> >  SpvCapabilityStorageUniform16 = 4434,
> > +SpvCapabilityUniformAndStorageBuffer16BitAccess = 4434,
> >  SpvCapabilityStoragePushConstant16 = 4435,
> >  SpvCapabilityStorageInputOutput16 = 4436,
> >  SpvCapabilityDeviceGroup = 4437,
> >  SpvCapabilityMultiView = 4439,
> > +SpvCapabilityVariablePointersStorageBuffer = 4441,
> > +SpvCapabilityVariablePointers = 4442,
> > +SpvCapabilityAtomicStorageOps = 4445,
> > +

Re: [Mesa-dev] [PATCH 1/8] spirv: Import the latest 1.0.2 header from Khronos

2017-07-13 Thread Ian Romanick
Shouldn't this also update capability_to_string in spriv_info.c?  I'm
also questioning that implementation... there are huge blocks in that
array (e.g., all the elements from 61 to 4322) that are zeroed out by
the initialization.  This will cause spirv_capability_to_string() to
happily return NULL pointers that none of the callers are prepared to
handle.

On 07/13/2017 12:41 PM, Jason Ekstrand wrote:
> ---
>  src/compiler/spirv/spirv.h | 41 +
>  1 file changed, 37 insertions(+), 4 deletions(-)
> 
> diff --git a/src/compiler/spirv/spirv.h b/src/compiler/spirv/spirv.h
> index 89354c0..61559a1 100644
> --- a/src/compiler/spirv/spirv.h
> +++ b/src/compiler/spirv/spirv.h
> @@ -50,12 +50,12 @@
>  
>  typedef unsigned int SpvId;
>  
> -#define SPV_VERSION 0x10100
> -#define SPV_REVISION 6
> +#define SPV_VERSION 0x10200
> +#define SPV_REVISION 1
>  
>  static const unsigned int SpvMagicNumber = 0x07230203;
> -static const unsigned int SpvVersion = 0x00010100;
> -static const unsigned int SpvRevision = 6;
> +static const unsigned int SpvVersion = 0x00010200;
> +static const unsigned int SpvRevision = 1;
>  static const unsigned int SpvOpCodeMask = 0x;
>  static const unsigned int SpvWordCountShift = 16;
>  
> @@ -65,6 +65,7 @@ typedef enum SpvSourceLanguage_ {
>  SpvSourceLanguageGLSL = 2,
>  SpvSourceLanguageOpenCL_C = 3,
>  SpvSourceLanguageOpenCL_CPP = 4,
> +SpvSourceLanguageHLSL = 5,
>  SpvSourceLanguageMax = 0x7fff,
>  } SpvSourceLanguage;
>  
> @@ -129,6 +130,10 @@ typedef enum SpvExecutionMode_ {
>  SpvExecutionModeFinalizer = 34,
>  SpvExecutionModeSubgroupSize = 35,
>  SpvExecutionModeSubgroupsPerWorkgroup = 36,
> +SpvExecutionModeSubgroupsPerWorkgroupId = 37,
> +SpvExecutionModeLocalSizeId = 38,
> +SpvExecutionModeLocalSizeHintId = 39,
> +SpvExecutionModePostDepthCoverage = 4446,
>  SpvExecutionModeMax = 0x7fff,
>  } SpvExecutionMode;
>  
> @@ -145,6 +150,7 @@ typedef enum SpvStorageClass_ {
>  SpvStorageClassPushConstant = 9,
>  SpvStorageClassAtomicCounter = 10,
>  SpvStorageClassImage = 11,
> +SpvStorageClassStorageBuffer = 12,
>  SpvStorageClassMax = 0x7fff,
>  } SpvStorageClass;
>  
> @@ -383,6 +389,9 @@ typedef enum SpvDecoration_ {
>  SpvDecorationInputAttachmentIndex = 43,
>  SpvDecorationAlignment = 44,
>  SpvDecorationMaxByteOffset = 45,
> +SpvDecorationAlignmentId = 46,
> +SpvDecorationMaxByteOffsetId = 47,
> +SpvDecorationExplicitInterpAMD = 4999,
>  SpvDecorationOverrideCoverageNV = 5248,
>  SpvDecorationPassthroughNV = 5250,
>  SpvDecorationViewportRelativeNV = 5252,
> @@ -442,6 +451,13 @@ typedef enum SpvBuiltIn_ {
>  SpvBuiltInDrawIndex = 4426,
>  SpvBuiltInDeviceIndex = 4438,
>  SpvBuiltInViewIndex = 4440,
> +SpvBuiltInBaryCoordNoPerspAMD = 4992,
> +SpvBuiltInBaryCoordNoPerspCentroidAMD = 4993,
> +SpvBuiltInBaryCoordNoPerspSampleAMD = 4994,
> +SpvBuiltInBaryCoordSmoothAMD = 4995,
> +SpvBuiltInBaryCoordSmoothCentroidAMD = 4996,
> +SpvBuiltInBaryCoordSmoothSampleAMD = 4997,
> +SpvBuiltInBaryCoordPullModelAMD = 4998,
>  SpvBuiltInViewportMaskNV = 5253,
>  SpvBuiltInSecondaryPositionNV = 5257,
>  SpvBuiltInSecondaryViewportMaskNV = 5258,
> @@ -632,12 +648,19 @@ typedef enum SpvCapability_ {
>  SpvCapabilitySubgroupBallotKHR = 4423,
>  SpvCapabilityDrawParameters = 4427,
>  SpvCapabilitySubgroupVoteKHR = 4431,
> +SpvCapabilityStorageBuffer16BitAccess = 4433,
>  SpvCapabilityStorageUniformBufferBlock16 = 4433,
>  SpvCapabilityStorageUniform16 = 4434,
> +SpvCapabilityUniformAndStorageBuffer16BitAccess = 4434,
>  SpvCapabilityStoragePushConstant16 = 4435,
>  SpvCapabilityStorageInputOutput16 = 4436,
>  SpvCapabilityDeviceGroup = 4437,
>  SpvCapabilityMultiView = 4439,
> +SpvCapabilityVariablePointersStorageBuffer = 4441,
> +SpvCapabilityVariablePointers = 4442,
> +SpvCapabilityAtomicStorageOps = 4445,
> +SpvCapabilitySampleMaskPostDepthCoverage = 4447,
> +SpvCapabilityImageGatherBiasLodAMD = 5009,
>  SpvCapabilitySampleMaskOverrideCoverageNV = 5249,
>  SpvCapabilityGeometryShaderPassthroughNV = 5251,
>  SpvCapabilityShaderViewportIndexLayerNV = 5254,
> @@ -952,12 +975,22 @@ typedef enum SpvOp_ {
>  SpvOpNamedBarrierInitialize = 328,
>  SpvOpMemoryNamedBarrier = 329,
>  SpvOpModuleProcessed = 330,
> +SpvOpExecutionModeId = 331,
> +SpvOpDecorateId = 332,
>  SpvOpSubgroupBallotKHR = 4421,
>  SpvOpSubgroupFirstInvocationKHR = 4422,
>  SpvOpSubgroupAllKHR = 4428,
>  SpvOpSubgroupAnyKHR = 4429,
>  SpvOpSubgroupAllEqualKHR = 4430,
>  SpvOpSubgroupReadInvocationKHR = 4432,
> +SpvOpGroupIAddNonUniformAMD = 5000,
> +SpvOpGroupFAddNonUniformAMD = 5001,
> +SpvOpGroupFMinNonUniformAMD = 5002,
> +SpvOpGroupUMinNonUniformAMD = 5003,
> +

[Mesa-dev] [PATCH 1/8] spirv: Import the latest 1.0.2 header from Khronos

2017-07-13 Thread Jason Ekstrand
---
 src/compiler/spirv/spirv.h | 41 +
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/src/compiler/spirv/spirv.h b/src/compiler/spirv/spirv.h
index 89354c0..61559a1 100644
--- a/src/compiler/spirv/spirv.h
+++ b/src/compiler/spirv/spirv.h
@@ -50,12 +50,12 @@
 
 typedef unsigned int SpvId;
 
-#define SPV_VERSION 0x10100
-#define SPV_REVISION 6
+#define SPV_VERSION 0x10200
+#define SPV_REVISION 1
 
 static const unsigned int SpvMagicNumber = 0x07230203;
-static const unsigned int SpvVersion = 0x00010100;
-static const unsigned int SpvRevision = 6;
+static const unsigned int SpvVersion = 0x00010200;
+static const unsigned int SpvRevision = 1;
 static const unsigned int SpvOpCodeMask = 0x;
 static const unsigned int SpvWordCountShift = 16;
 
@@ -65,6 +65,7 @@ typedef enum SpvSourceLanguage_ {
 SpvSourceLanguageGLSL = 2,
 SpvSourceLanguageOpenCL_C = 3,
 SpvSourceLanguageOpenCL_CPP = 4,
+SpvSourceLanguageHLSL = 5,
 SpvSourceLanguageMax = 0x7fff,
 } SpvSourceLanguage;
 
@@ -129,6 +130,10 @@ typedef enum SpvExecutionMode_ {
 SpvExecutionModeFinalizer = 34,
 SpvExecutionModeSubgroupSize = 35,
 SpvExecutionModeSubgroupsPerWorkgroup = 36,
+SpvExecutionModeSubgroupsPerWorkgroupId = 37,
+SpvExecutionModeLocalSizeId = 38,
+SpvExecutionModeLocalSizeHintId = 39,
+SpvExecutionModePostDepthCoverage = 4446,
 SpvExecutionModeMax = 0x7fff,
 } SpvExecutionMode;
 
@@ -145,6 +150,7 @@ typedef enum SpvStorageClass_ {
 SpvStorageClassPushConstant = 9,
 SpvStorageClassAtomicCounter = 10,
 SpvStorageClassImage = 11,
+SpvStorageClassStorageBuffer = 12,
 SpvStorageClassMax = 0x7fff,
 } SpvStorageClass;
 
@@ -383,6 +389,9 @@ typedef enum SpvDecoration_ {
 SpvDecorationInputAttachmentIndex = 43,
 SpvDecorationAlignment = 44,
 SpvDecorationMaxByteOffset = 45,
+SpvDecorationAlignmentId = 46,
+SpvDecorationMaxByteOffsetId = 47,
+SpvDecorationExplicitInterpAMD = 4999,
 SpvDecorationOverrideCoverageNV = 5248,
 SpvDecorationPassthroughNV = 5250,
 SpvDecorationViewportRelativeNV = 5252,
@@ -442,6 +451,13 @@ typedef enum SpvBuiltIn_ {
 SpvBuiltInDrawIndex = 4426,
 SpvBuiltInDeviceIndex = 4438,
 SpvBuiltInViewIndex = 4440,
+SpvBuiltInBaryCoordNoPerspAMD = 4992,
+SpvBuiltInBaryCoordNoPerspCentroidAMD = 4993,
+SpvBuiltInBaryCoordNoPerspSampleAMD = 4994,
+SpvBuiltInBaryCoordSmoothAMD = 4995,
+SpvBuiltInBaryCoordSmoothCentroidAMD = 4996,
+SpvBuiltInBaryCoordSmoothSampleAMD = 4997,
+SpvBuiltInBaryCoordPullModelAMD = 4998,
 SpvBuiltInViewportMaskNV = 5253,
 SpvBuiltInSecondaryPositionNV = 5257,
 SpvBuiltInSecondaryViewportMaskNV = 5258,
@@ -632,12 +648,19 @@ typedef enum SpvCapability_ {
 SpvCapabilitySubgroupBallotKHR = 4423,
 SpvCapabilityDrawParameters = 4427,
 SpvCapabilitySubgroupVoteKHR = 4431,
+SpvCapabilityStorageBuffer16BitAccess = 4433,
 SpvCapabilityStorageUniformBufferBlock16 = 4433,
 SpvCapabilityStorageUniform16 = 4434,
+SpvCapabilityUniformAndStorageBuffer16BitAccess = 4434,
 SpvCapabilityStoragePushConstant16 = 4435,
 SpvCapabilityStorageInputOutput16 = 4436,
 SpvCapabilityDeviceGroup = 4437,
 SpvCapabilityMultiView = 4439,
+SpvCapabilityVariablePointersStorageBuffer = 4441,
+SpvCapabilityVariablePointers = 4442,
+SpvCapabilityAtomicStorageOps = 4445,
+SpvCapabilitySampleMaskPostDepthCoverage = 4447,
+SpvCapabilityImageGatherBiasLodAMD = 5009,
 SpvCapabilitySampleMaskOverrideCoverageNV = 5249,
 SpvCapabilityGeometryShaderPassthroughNV = 5251,
 SpvCapabilityShaderViewportIndexLayerNV = 5254,
@@ -952,12 +975,22 @@ typedef enum SpvOp_ {
 SpvOpNamedBarrierInitialize = 328,
 SpvOpMemoryNamedBarrier = 329,
 SpvOpModuleProcessed = 330,
+SpvOpExecutionModeId = 331,
+SpvOpDecorateId = 332,
 SpvOpSubgroupBallotKHR = 4421,
 SpvOpSubgroupFirstInvocationKHR = 4422,
 SpvOpSubgroupAllKHR = 4428,
 SpvOpSubgroupAnyKHR = 4429,
 SpvOpSubgroupAllEqualKHR = 4430,
 SpvOpSubgroupReadInvocationKHR = 4432,
+SpvOpGroupIAddNonUniformAMD = 5000,
+SpvOpGroupFAddNonUniformAMD = 5001,
+SpvOpGroupFMinNonUniformAMD = 5002,
+SpvOpGroupUMinNonUniformAMD = 5003,
+SpvOpGroupSMinNonUniformAMD = 5004,
+SpvOpGroupFMaxNonUniformAMD = 5005,
+SpvOpGroupUMaxNonUniformAMD = 5006,
+SpvOpGroupSMaxNonUniformAMD = 5007,
 SpvOpMax = 0x7fff,
 } SpvOp;
 
-- 
2.5.0.400.gff86faf

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev