Updated spirv-tools.

This commit is contained in:
Бранимир Караџић
2024-04-12 21:21:04 -07:00
parent 03279fe3c1
commit 9287b7cd18
31 changed files with 414 additions and 77 deletions

View File

@@ -1 +1 @@
"v2023.6", "SPIRV-Tools v2023.6 v2023.6.rc1-53-g0b935b1d"
"v2024.1", "SPIRV-Tools v2024.1 v2024.1-24-g37e8c915"

View File

@@ -53,6 +53,7 @@ static const spv::Capability pygen_variable_caps_NamedBarrier[] = {spv::Capabili
static const spv::Capability pygen_variable_caps_PipeStorage[] = {spv::Capability::PipeStorage};
static const spv::Capability pygen_variable_caps_Pipes[] = {spv::Capability::Pipes};
static const spv::Capability pygen_variable_caps_QuadControlKHR[] = {spv::Capability::QuadControlKHR};
static const spv::Capability pygen_variable_caps_RawAccessChainsNV[] = {spv::Capability::RawAccessChainsNV};
static const spv::Capability pygen_variable_caps_RayQueryKHR[] = {spv::Capability::RayQueryKHR};
static const spv::Capability pygen_variable_caps_RayQueryPositionFetchKHR[] = {spv::Capability::RayQueryPositionFetchKHR};
static const spv::Capability pygen_variable_caps_RayTracingKHR[] = {spv::Capability::RayTracingKHR};
@@ -597,6 +598,7 @@ static const spv_opcode_desc_t kOpcodeTableEntries[] = {
{"ConvertUToSampledImageNV", spv::Op::OpConvertUToSampledImageNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu},
{"ConvertSampledImageToUNV", spv::Op::OpConvertSampledImageToUNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu},
{"SamplerImageAddressingModeNV", spv::Op::OpSamplerImageAddressingModeNV, 1, pygen_variable_caps_BindlessTextureNV, 1, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu},
{"RawAccessChainNV", spv::Op::OpRawAccessChainNV, 1, pygen_variable_caps_RawAccessChainsNV, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_RAW_ACCESS_CHAIN_OPERANDS}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu},
{"SubgroupShuffleINTEL", spv::Op::OpSubgroupShuffleINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu},
{"SubgroupShuffleDownINTEL", spv::Op::OpSubgroupShuffleDownINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu},
{"SubgroupShuffleUpINTEL", spv::Op::OpSubgroupShuffleUpINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu},

File diff suppressed because one or more lines are too long

View File

@@ -59,6 +59,7 @@ kSPV_INTEL_kernel_attributes,
kSPV_INTEL_long_composites,
kSPV_INTEL_loop_fuse,
kSPV_INTEL_masked_gather_scatter,
kSPV_INTEL_maximum_registers,
kSPV_INTEL_media_block_io,
kSPV_INTEL_memory_access_aliasing,
kSPV_INTEL_optnone,
@@ -114,6 +115,7 @@ kSPV_NV_displacement_micromap,
kSPV_NV_fragment_shader_barycentric,
kSPV_NV_geometry_shader_passthrough,
kSPV_NV_mesh_shader,
kSPV_NV_raw_access_chains,
kSPV_NV_ray_tracing,
kSPV_NV_ray_tracing_motion_blur,
kSPV_NV_sample_mask_override_coverage,

View File

@@ -39,4 +39,6 @@
{38, "Meta", "SparkSL", "Meta SparkSL"},
{39, "SirLynix", "Nazara ShaderLang Compiler", "SirLynix Nazara ShaderLang Compiler"},
{40, "NVIDIA", "Slang Compiler", "NVIDIA Slang Compiler"},
{41, "Zig Software Foundation", "Zig Compiler", "Zig Software Foundation Zig Compiler"},
{41, "Zig Software Foundation", "Zig Compiler", "Zig Software Foundation Zig Compiler"},
{42, "Rendong Liang", "spq", "Rendong Liang spq"},
{43, "LLVM", "LLVM SPIR-V Backend", "LLVM LLVM SPIR-V Backend"},

View File

@@ -0,0 +1,12 @@
static const spv_ext_inst_desc_t nonsemantic_vkspreflection_entries[] = {
{"Configuration", 1, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}},
{"StartCounter", 2, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_NONE}},
{"StopCounter", 3, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}},
{"PushConstants", 4, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}},
{"SpecializationMapEntry", 5, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}},
{"DescriptorSetBuffer", 6, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}},
{"DescriptorSetImage", 7, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}},
{"DescriptorSetSampler", 8, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_FLOAT, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_FLOAT, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_FLOAT, SPV_OPERAND_TYPE_LITERAL_FLOAT, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}
};

View File

@@ -86,6 +86,7 @@ static const spv::Capability pygen_variable_caps_PerViewAttributesNVMeshShadingN
static const spv::Capability pygen_variable_caps_PhysicalStorageBufferAddresses[] = {spv::Capability::PhysicalStorageBufferAddresses};
static const spv::Capability pygen_variable_caps_Pipes[] = {spv::Capability::Pipes};
static const spv::Capability pygen_variable_caps_QuadControlKHR[] = {spv::Capability::QuadControlKHR};
static const spv::Capability pygen_variable_caps_RawAccessChainsNV[] = {spv::Capability::RawAccessChainsNV};
static const spv::Capability pygen_variable_caps_RayCullMaskKHR[] = {spv::Capability::RayCullMaskKHR};
static const spv::Capability pygen_variable_caps_RayQueryKHR[] = {spv::Capability::RayQueryKHR};
static const spv::Capability pygen_variable_caps_RayQueryKHRRayTracingKHR[] = {spv::Capability::RayQueryKHR, spv::Capability::RayTracingKHR};
@@ -97,6 +98,7 @@ static const spv::Capability pygen_variable_caps_RayTracingNVRayTracingKHR[] = {
static const spv::Capability pygen_variable_caps_RayTracingOpacityMicromapEXT[] = {spv::Capability::RayTracingOpacityMicromapEXT};
static const spv::Capability pygen_variable_caps_RayTracingPositionFetchKHR[] = {spv::Capability::RayTracingPositionFetchKHR};
static const spv::Capability pygen_variable_caps_RayTraversalPrimitiveCullingKHR[] = {spv::Capability::RayTraversalPrimitiveCullingKHR};
static const spv::Capability pygen_variable_caps_RegisterLimitsINTEL[] = {spv::Capability::RegisterLimitsINTEL};
static const spv::Capability pygen_variable_caps_RoundToInfinityINTEL[] = {spv::Capability::RoundToInfinityINTEL};
static const spv::Capability pygen_variable_caps_RoundingModeRTE[] = {spv::Capability::RoundingModeRTE};
static const spv::Capability pygen_variable_caps_RoundingModeRTZ[] = {spv::Capability::RoundingModeRTZ};
@@ -200,6 +202,7 @@ static const spvtools::Extension pygen_variable_exts_SPV_INTEL_kernel_attributes
static const spvtools::Extension pygen_variable_exts_SPV_INTEL_long_composites[] = {spvtools::Extension::kSPV_INTEL_long_composites};
static const spvtools::Extension pygen_variable_exts_SPV_INTEL_loop_fuse[] = {spvtools::Extension::kSPV_INTEL_loop_fuse};
static const spvtools::Extension pygen_variable_exts_SPV_INTEL_masked_gather_scatter[] = {spvtools::Extension::kSPV_INTEL_masked_gather_scatter};
static const spvtools::Extension pygen_variable_exts_SPV_INTEL_maximum_registers[] = {spvtools::Extension::kSPV_INTEL_maximum_registers};
static const spvtools::Extension pygen_variable_exts_SPV_INTEL_media_block_io[] = {spvtools::Extension::kSPV_INTEL_media_block_io};
static const spvtools::Extension pygen_variable_exts_SPV_INTEL_memory_access_aliasing[] = {spvtools::Extension::kSPV_INTEL_memory_access_aliasing};
static const spvtools::Extension pygen_variable_exts_SPV_INTEL_optnone[] = {spvtools::Extension::kSPV_INTEL_optnone};
@@ -255,6 +258,7 @@ static const spvtools::Extension pygen_variable_exts_SPV_NV_displacement_microma
static const spvtools::Extension pygen_variable_exts_SPV_NV_geometry_shader_passthrough[] = {spvtools::Extension::kSPV_NV_geometry_shader_passthrough};
static const spvtools::Extension pygen_variable_exts_SPV_NV_mesh_shader[] = {spvtools::Extension::kSPV_NV_mesh_shader};
static const spvtools::Extension pygen_variable_exts_SPV_NV_mesh_shaderSPV_NV_viewport_array2[] = {spvtools::Extension::kSPV_NV_mesh_shader, spvtools::Extension::kSPV_NV_viewport_array2};
static const spvtools::Extension pygen_variable_exts_SPV_NV_raw_access_chains[] = {spvtools::Extension::kSPV_NV_raw_access_chains};
static const spvtools::Extension pygen_variable_exts_SPV_NV_ray_tracing[] = {spvtools::Extension::kSPV_NV_ray_tracing};
static const spvtools::Extension pygen_variable_exts_SPV_NV_ray_tracing_motion_blur[] = {spvtools::Extension::kSPV_NV_ray_tracing_motion_blur};
static const spvtools::Extension pygen_variable_exts_SPV_NV_sample_mask_override_coverage[] = {spvtools::Extension::kSPV_NV_sample_mask_override_coverage};
@@ -408,6 +412,12 @@ static const spv_operand_desc_t pygen_variable_FragmentShadingRateEntries[] = {
{"Horizontal4Pixels", 0x0008, 1, pygen_variable_caps_FragmentShadingRateKHR, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}
};
static const spv_operand_desc_t pygen_variable_RawAccessChainOperandsEntries[] = {
{"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu},
{"RobustnessPerComponentNV", 0x0001, 1, pygen_variable_caps_RawAccessChainsNV, 0, nullptr, {}, 0xffffffffu, 0xffffffffu},
{"RobustnessPerElementNV", 0x0002, 1, pygen_variable_caps_RawAccessChainsNV, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}
};
static const spv_operand_desc_t pygen_variable_SourceLanguageEntries[] = {
{"Unknown", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu},
{"ESSL", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu},
@@ -558,7 +568,10 @@ static const spv_operand_desc_t pygen_variable_ExecutionModeEntries[] = {
{"FPFastMathDefault", 6028, 1, pygen_variable_caps_FloatControls2, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0xffffffffu, 0xffffffffu},
{"StreamingInterfaceINTEL", 6154, 1, pygen_variable_caps_FPGAKernelAttributesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu},
{"RegisterMapInterfaceINTEL", 6160, 1, pygen_variable_caps_FPGAKernelAttributesv2INTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu},
{"NamedBarrierCountINTEL", 6417, 1, pygen_variable_caps_VectorComputeINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}
{"NamedBarrierCountINTEL", 6417, 1, pygen_variable_caps_VectorComputeINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu},
{"MaximumRegistersINTEL", 6461, 1, pygen_variable_caps_RegisterLimitsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu},
{"MaximumRegistersIdINTEL", 6462, 1, pygen_variable_caps_RegisterLimitsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_ID}, 0xffffffffu, 0xffffffffu},
{"NamedMaximumRegistersINTEL", 6463, 1, pygen_variable_caps_RegisterLimitsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_NAMED_MAXIMUM_NUMBER_OF_REGISTERS}, 0xffffffffu, 0xffffffffu}
};
static const spv_operand_desc_t pygen_variable_StorageClassEntries[] = {
@@ -1280,6 +1293,7 @@ static const spv_operand_desc_t pygen_variable_CapabilityEntries[] = {
{"RayQueryPositionFetchKHR", 5391, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_KHR_ray_tracing_position_fetch, {}, 0xffffffffu, 0xffffffffu},
{"AtomicFloat16VectorNV", 5404, 0, nullptr, 1, pygen_variable_exts_SPV_NV_shader_atomic_fp16_vector, {}, 0xffffffffu, 0xffffffffu},
{"RayTracingDisplacementMicromapNV", 5409, 1, pygen_variable_caps_RayTracingKHR, 1, pygen_variable_exts_SPV_NV_displacement_micromap, {}, 0xffffffffu, 0xffffffffu},
{"RawAccessChainsNV", 5414, 0, nullptr, 1, pygen_variable_exts_SPV_NV_raw_access_chains, {}, 0xffffffffu, 0xffffffffu},
{"SubgroupShuffleINTEL", 5568, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_subgroups, {}, 0xffffffffu, 0xffffffffu},
{"SubgroupBufferBlockIOINTEL", 5569, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_subgroups, {}, 0xffffffffu, 0xffffffffu},
{"SubgroupImageBlockIOINTEL", 5570, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_subgroups, {}, 0xffffffffu, 0xffffffffu},
@@ -1352,7 +1366,8 @@ static const spv_operand_desc_t pygen_variable_CapabilityEntries[] = {
{"GlobalVariableFPGADecorationsINTEL", 6189, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_global_variable_fpga_decorations, {}, 0xffffffffu, 0xffffffffu},
{"GroupUniformArithmeticKHR", 6400, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_uniform_group_instructions, {}, 0xffffffffu, 0xffffffffu},
{"MaskedGatherScatterINTEL", 6427, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_masked_gather_scatter, {}, 0xffffffffu, 0xffffffffu},
{"CacheControlsINTEL", 6441, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_cache_controls, {}, 0xffffffffu, 0xffffffffu}
{"CacheControlsINTEL", 6441, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_cache_controls, {}, 0xffffffffu, 0xffffffffu},
{"RegisterLimitsINTEL", 6460, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_maximum_registers, {}, 0xffffffffu, 0xffffffffu}
};
static const spv_operand_desc_t pygen_variable_RayQueryIntersectionEntries[] = {
@@ -1416,6 +1431,10 @@ static const spv_operand_desc_t pygen_variable_StoreCacheControlEntries[] = {
{"StreamingINTEL", 3, 1, pygen_variable_caps_CacheControlsINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}
};
static const spv_operand_desc_t pygen_variable_NamedMaximumNumberOfRegistersEntries[] = {
{"AutoINTEL", 0, 1, pygen_variable_caps_RegisterLimitsINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}
};
static const spv_operand_desc_t pygen_variable_DebugInfoFlagsEntries[] = {
{"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu},
{"FlagIsProtected", 0x01, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu},
@@ -1545,6 +1564,7 @@ static const spv_operand_desc_group_t pygen_variable_OperandInfoTable[] = {
{SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO, ARRAY_SIZE(pygen_variable_KernelProfilingInfoEntries), pygen_variable_KernelProfilingInfoEntries},
{SPV_OPERAND_TYPE_RAY_FLAGS, ARRAY_SIZE(pygen_variable_RayFlagsEntries), pygen_variable_RayFlagsEntries},
{SPV_OPERAND_TYPE_FRAGMENT_SHADING_RATE, ARRAY_SIZE(pygen_variable_FragmentShadingRateEntries), pygen_variable_FragmentShadingRateEntries},
{SPV_OPERAND_TYPE_RAW_ACCESS_CHAIN_OPERANDS, ARRAY_SIZE(pygen_variable_RawAccessChainOperandsEntries), pygen_variable_RawAccessChainOperandsEntries},
{SPV_OPERAND_TYPE_SOURCE_LANGUAGE, ARRAY_SIZE(pygen_variable_SourceLanguageEntries), pygen_variable_SourceLanguageEntries},
{SPV_OPERAND_TYPE_EXECUTION_MODEL, ARRAY_SIZE(pygen_variable_ExecutionModelEntries), pygen_variable_ExecutionModelEntries},
{SPV_OPERAND_TYPE_ADDRESSING_MODEL, ARRAY_SIZE(pygen_variable_AddressingModelEntries), pygen_variable_AddressingModelEntries},
@@ -1582,6 +1602,7 @@ static const spv_operand_desc_group_t pygen_variable_OperandInfoTable[] = {
{SPV_OPERAND_TYPE_INITIALIZATION_MODE_QUALIFIER, ARRAY_SIZE(pygen_variable_InitializationModeQualifierEntries), pygen_variable_InitializationModeQualifierEntries},
{SPV_OPERAND_TYPE_LOAD_CACHE_CONTROL, ARRAY_SIZE(pygen_variable_LoadCacheControlEntries), pygen_variable_LoadCacheControlEntries},
{SPV_OPERAND_TYPE_STORE_CACHE_CONTROL, ARRAY_SIZE(pygen_variable_StoreCacheControlEntries), pygen_variable_StoreCacheControlEntries},
{SPV_OPERAND_TYPE_NAMED_MAXIMUM_NUMBER_OF_REGISTERS, ARRAY_SIZE(pygen_variable_NamedMaximumNumberOfRegistersEntries), pygen_variable_NamedMaximumNumberOfRegistersEntries},
{SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS, ARRAY_SIZE(pygen_variable_DebugInfoFlagsEntries), pygen_variable_DebugInfoFlagsEntries},
{SPV_OPERAND_TYPE_DEBUG_BASE_TYPE_ATTRIBUTE_ENCODING, ARRAY_SIZE(pygen_variable_DebugBaseTypeAttributeEncodingEntries), pygen_variable_DebugBaseTypeAttributeEncodingEntries},
{SPV_OPERAND_TYPE_DEBUG_COMPOSITE_TYPE, ARRAY_SIZE(pygen_variable_DebugCompositeTypeEntries), pygen_variable_DebugCompositeTypeEntries},
@@ -1595,6 +1616,7 @@ static const spv_operand_desc_group_t pygen_variable_OperandInfoTable[] = {
{SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_IMPORTED_ENTITY, ARRAY_SIZE(pygen_variable_CLDEBUG100_DebugImportedEntityEntries), pygen_variable_CLDEBUG100_DebugImportedEntityEntries},
{SPV_OPERAND_TYPE_OPTIONAL_IMAGE, ARRAY_SIZE(pygen_variable_ImageOperandsEntries), pygen_variable_ImageOperandsEntries},
{SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, ARRAY_SIZE(pygen_variable_MemoryAccessEntries), pygen_variable_MemoryAccessEntries},
{SPV_OPERAND_TYPE_OPTIONAL_RAW_ACCESS_CHAIN_OPERANDS, ARRAY_SIZE(pygen_variable_RawAccessChainOperandsEntries), pygen_variable_RawAccessChainOperandsEntries},
{SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER, ARRAY_SIZE(pygen_variable_AccessQualifierEntries), pygen_variable_AccessQualifierEntries},
{SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT, ARRAY_SIZE(pygen_variable_PackedVectorFormatEntries), pygen_variable_PackedVectorFormatEntries},
{SPV_OPERAND_TYPE_OPTIONAL_COOPERATIVE_MATRIX_OPERANDS, ARRAY_SIZE(pygen_variable_CooperativeMatrixOperandsEntries), pygen_variable_CooperativeMatrixOperandsEntries}

View File

@@ -302,6 +302,12 @@ typedef enum spv_operand_type_t {
SPV_OPERAND_TYPE_LOAD_CACHE_CONTROL,
// Enum type from SPV_INTEL_cache_controls
SPV_OPERAND_TYPE_STORE_CACHE_CONTROL,
// Enum type from SPV_INTEL_maximum_registers
SPV_OPERAND_TYPE_NAMED_MAXIMUM_NUMBER_OF_REGISTERS,
// Enum type from SPV_NV_raw_access_chains
SPV_OPERAND_TYPE_RAW_ACCESS_CHAIN_OPERANDS,
// Optional enum type from SPV_NV_raw_access_chains
SPV_OPERAND_TYPE_OPTIONAL_RAW_ACCESS_CHAIN_OPERANDS,
// This is a sentinel value, and does not represent an operand type.
// It should come last.
@@ -328,6 +334,7 @@ typedef enum spv_ext_inst_type_t {
SPV_EXT_INST_TYPE_OPENCL_DEBUGINFO_100,
SPV_EXT_INST_TYPE_NONSEMANTIC_CLSPVREFLECTION,
SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100,
SPV_EXT_INST_TYPE_NONSEMANTIC_VKSPREFLECTION,
// Multiple distinct extended instruction set types could return this
// value, if they are prefixed with NonSemantic. and are otherwise

View File

@@ -670,7 +670,8 @@ spv_result_t Parser::parseOperand(size_t inst_offset,
case SPV_OPERAND_TYPE_QUANTIZATION_MODES:
case SPV_OPERAND_TYPE_OVERFLOW_MODES:
case SPV_OPERAND_TYPE_PACKED_VECTOR_FORMAT:
case SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT: {
case SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT:
case SPV_OPERAND_TYPE_NAMED_MAXIMUM_NUMBER_OF_REGISTERS: {
// A single word that is a plain enum value.
// Map an optional operand type to its corresponding concrete type.
@@ -710,6 +711,7 @@ spv_result_t Parser::parseOperand(size_t inst_offset,
case SPV_OPERAND_TYPE_IMAGE:
case SPV_OPERAND_TYPE_OPTIONAL_IMAGE:
case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS:
case SPV_OPERAND_TYPE_OPTIONAL_RAW_ACCESS_CHAIN_OPERANDS:
case SPV_OPERAND_TYPE_SELECTION_CONTROL:
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_INFO_FLAGS:
case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS:
@@ -720,10 +722,12 @@ spv_result_t Parser::parseOperand(size_t inst_offset,
// Map an optional operand type to its corresponding concrete type.
if (type == SPV_OPERAND_TYPE_OPTIONAL_IMAGE)
parsed_operand.type = SPV_OPERAND_TYPE_IMAGE;
else if (type == SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS)
if (type == SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS)
parsed_operand.type = SPV_OPERAND_TYPE_MEMORY_ACCESS;
if (type == SPV_OPERAND_TYPE_OPTIONAL_COOPERATIVE_MATRIX_OPERANDS)
parsed_operand.type = SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_OPERANDS;
if (type == SPV_OPERAND_TYPE_OPTIONAL_RAW_ACCESS_CHAIN_OPERANDS)
parsed_operand.type = SPV_OPERAND_TYPE_RAW_ACCESS_CHAIN_OPERANDS;
// Check validity of set mask bits. Also prepare for operands for those
// masks if they have any. To get operand order correct, scan from

View File

@@ -425,6 +425,7 @@ void InstructionDisassembler::EmitOperand(const spv_parsed_instruction_t& inst,
case SPV_OPERAND_TYPE_SELECTION_CONTROL:
case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS:
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_INFO_FLAGS:
case SPV_OPERAND_TYPE_RAW_ACCESS_CHAIN_OPERANDS:
EmitMaskOperand(operand.type, word);
break;
default:

View File

@@ -30,6 +30,7 @@
#include "glsl.std.450.insts.inc"
#include "nonsemantic.clspvreflection.insts.inc"
#include "nonsemantic.shader.debuginfo.100.insts.inc"
#include "nonsemantic.vkspreflection.insts.inc"
#include "opencl.debuginfo.100.insts.inc"
#include "opencl.std.insts.inc"
@@ -62,6 +63,9 @@ static const spv_ext_inst_group_t kGroups_1_0[] = {
{SPV_EXT_INST_TYPE_NONSEMANTIC_CLSPVREFLECTION,
ARRAY_SIZE(nonsemantic_clspvreflection_entries),
nonsemantic_clspvreflection_entries},
{SPV_EXT_INST_TYPE_NONSEMANTIC_VKSPREFLECTION,
ARRAY_SIZE(nonsemantic_vkspreflection_entries),
nonsemantic_vkspreflection_entries},
};
static const spv_ext_inst_table_t kTable_1_0 = {ARRAY_SIZE(kGroups_1_0),
@@ -138,6 +142,9 @@ spv_ext_inst_type_t spvExtInstImportTypeGet(const char* name) {
if (!strncmp("NonSemantic.ClspvReflection.", name, 28)) {
return SPV_EXT_INST_TYPE_NONSEMANTIC_CLSPVREFLECTION;
}
if (!strncmp("NonSemantic.VkspReflection.", name, 27)) {
return SPV_EXT_INST_TYPE_NONSEMANTIC_VKSPREFLECTION;
}
// ensure to add any known non-semantic extended instruction sets
// above this point, and update spvExtInstIsNonSemantic()
if (!strncmp("NonSemantic.", name, 12)) {
@@ -149,7 +156,8 @@ spv_ext_inst_type_t spvExtInstImportTypeGet(const char* name) {
bool spvExtInstIsNonSemantic(const spv_ext_inst_type_t type) {
if (type == SPV_EXT_INST_TYPE_NONSEMANTIC_UNKNOWN ||
type == SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100 ||
type == SPV_EXT_INST_TYPE_NONSEMANTIC_CLSPVREFLECTION) {
type == SPV_EXT_INST_TYPE_NONSEMANTIC_CLSPVREFLECTION ||
type == SPV_EXT_INST_TYPE_NONSEMANTIC_VKSPREFLECTION) {
return true;
}
return false;

View File

@@ -295,6 +295,7 @@ bool spvOpcodeReturnsLogicalVariablePointer(const spv::Op opcode) {
case spv::Op::OpPtrAccessChain:
case spv::Op::OpLoad:
case spv::Op::OpConstantNull:
case spv::Op::OpRawAccessChainNV:
return true;
default:
return false;
@@ -309,6 +310,7 @@ int32_t spvOpcodeReturnsLogicalPointer(const spv::Op opcode) {
case spv::Op::OpFunctionParameter:
case spv::Op::OpImageTexelPointer:
case spv::Op::OpCopyObject:
case spv::Op::OpRawAccessChainNV:
return true;
default:
return false;
@@ -754,6 +756,7 @@ bool spvOpcodeIsAccessChain(spv::Op opcode) {
case spv::Op::OpInBoundsAccessChain:
case spv::Op::OpPtrAccessChain:
case spv::Op::OpInBoundsPtrAccessChain:
case spv::Op::OpRawAccessChainNV:
return true;
default:
return false;

View File

@@ -220,6 +220,11 @@ const char* spvOperandTypeStr(spv_operand_type_t type) {
return "load cache control";
case SPV_OPERAND_TYPE_STORE_CACHE_CONTROL:
return "store cache control";
case SPV_OPERAND_TYPE_NAMED_MAXIMUM_NUMBER_OF_REGISTERS:
return "named maximum number of registers";
case SPV_OPERAND_TYPE_RAW_ACCESS_CHAIN_OPERANDS:
case SPV_OPERAND_TYPE_OPTIONAL_RAW_ACCESS_CHAIN_OPERANDS:
return "raw access chain operands";
case SPV_OPERAND_TYPE_IMAGE:
case SPV_OPERAND_TYPE_OPTIONAL_IMAGE:
return "image";
@@ -360,6 +365,7 @@ bool spvOperandIsConcrete(spv_operand_type_t type) {
case SPV_OPERAND_TYPE_HOST_ACCESS_QUALIFIER:
case SPV_OPERAND_TYPE_LOAD_CACHE_CONTROL:
case SPV_OPERAND_TYPE_STORE_CACHE_CONTROL:
case SPV_OPERAND_TYPE_NAMED_MAXIMUM_NUMBER_OF_REGISTERS:
return true;
default:
break;
@@ -379,6 +385,7 @@ bool spvOperandIsConcreteMask(spv_operand_type_t type) {
case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS:
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_INFO_FLAGS:
case SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_OPERANDS:
case SPV_OPERAND_TYPE_RAW_ACCESS_CHAIN_OPERANDS:
return true;
default:
break;
@@ -399,6 +406,7 @@ bool spvOperandIsOptional(spv_operand_type_t type) {
case SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT:
case SPV_OPERAND_TYPE_OPTIONAL_COOPERATIVE_MATRIX_OPERANDS:
case SPV_OPERAND_TYPE_OPTIONAL_CIV:
case SPV_OPERAND_TYPE_OPTIONAL_RAW_ACCESS_CHAIN_OPERANDS:
return true;
default:
break;

View File

@@ -57,12 +57,6 @@ spv_result_t spvOperandTableValueLookup(spv_target_env,
// Gets the name string of the non-variable operand type.
const char* spvOperandTypeStr(spv_operand_type_t type);
// Returns true if the given type is concrete.
bool spvOperandIsConcrete(spv_operand_type_t type);
// Returns true if the given type is concrete and also a mask.
bool spvOperandIsConcreteMask(spv_operand_type_t type);
// Returns true if an operand of the given type is optional.
bool spvOperandIsOptional(spv_operand_type_t type);

View File

@@ -498,7 +498,7 @@ const Constant* ConstantManager::GetIntConst(uint64_t val, int32_t bitWidth,
int32_t num_of_bit_to_ignore = 64 - bitWidth;
val = static_cast<int64_t>(val << num_of_bit_to_ignore) >>
num_of_bit_to_ignore;
} else {
} else if (bitWidth < 64) {
// Clear the upper bit that are not used.
uint64_t mask = ((1ull << bitWidth) - 1);
val &= mask;
@@ -511,7 +511,7 @@ const Constant* ConstantManager::GetIntConst(uint64_t val, int32_t bitWidth,
// If the value is more than 32-bit, we need to split the operands into two
// 32-bit integers.
return GetConstant(
int_type, {static_cast<uint32_t>(val >> 32), static_cast<uint32_t>(val)});
int_type, {static_cast<uint32_t>(val), static_cast<uint32_t>(val >> 32)});
}
uint32_t ConstantManager::GetUIntConstId(uint32_t val) {

View File

@@ -213,6 +213,19 @@ uint32_t InlinePass::CreateReturnVar(
{(uint32_t)spv::StorageClass::Function}}}));
new_vars->push_back(std::move(var_inst));
get_decoration_mgr()->CloneDecorations(calleeFn->result_id(), returnVarId);
// Decorate the return var with AliasedPointer if the storage class of the
// pointee type is PhysicalStorageBuffer.
auto const pointee_type =
type_mgr->GetType(returnVarTypeId)->AsPointer()->pointee_type();
if (pointee_type->AsPointer() != nullptr) {
if (pointee_type->AsPointer()->storage_class() ==
spv::StorageClass::PhysicalStorageBuffer) {
get_decoration_mgr()->AddDecoration(
returnVarId, uint32_t(spv::Decoration::AliasedPointer));
}
}
return returnVarId;
}

View File

@@ -88,6 +88,9 @@ void IRContext::BuildInvalidAnalyses(IRContext::Analysis set) {
if (set & kAnalysisDebugInfo) {
BuildDebugInfoManager();
}
if (set & kAnalysisLiveness) {
BuildLivenessManager();
}
}
void IRContext::InvalidateAnalysesExceptFor(

View File

@@ -84,7 +84,7 @@ class IRContext {
kAnalysisTypes = 1 << 15,
kAnalysisDebugInfo = 1 << 16,
kAnalysisLiveness = 1 << 17,
kAnalysisEnd = 1 << 17
kAnalysisEnd = 1 << 18
};
using ProcessFunction = std::function<bool(Function*)>;

View File

@@ -517,13 +517,24 @@ void TypeManager::CreateDecoration(uint32_t target,
context()->get_def_use_mgr()->AnalyzeInstUse(inst);
}
Type* TypeManager::RebuildType(const Type& type) {
Type* TypeManager::RebuildType(uint32_t type_id, const Type& type) {
assert(type_id != 0);
// The comparison and hash on the type pool will avoid inserting the rebuilt
// type if an equivalent type already exists. The rebuilt type will be deleted
// when it goes out of scope at the end of the function in that case. Repeated
// insertions of the same Type will, at most, keep one corresponding object in
// the type pool.
std::unique_ptr<Type> rebuilt_ty;
// If |type_id| is already present in the type pool, return the existing type.
// This saves extra work in the type builder and prevents running into
// circular issues (https://github.com/KhronosGroup/SPIRV-Tools/issues/5623).
Type* pool_ty = GetType(type_id);
if (pool_ty != nullptr) {
return pool_ty;
}
switch (type.kind()) {
#define DefineNoSubtypeCase(kind) \
case Type::k##kind: \
@@ -550,43 +561,46 @@ Type* TypeManager::RebuildType(const Type& type) {
case Type::kVector: {
const Vector* vec_ty = type.AsVector();
const Type* ele_ty = vec_ty->element_type();
rebuilt_ty =
MakeUnique<Vector>(RebuildType(*ele_ty), vec_ty->element_count());
rebuilt_ty = MakeUnique<Vector>(RebuildType(GetId(ele_ty), *ele_ty),
vec_ty->element_count());
break;
}
case Type::kMatrix: {
const Matrix* mat_ty = type.AsMatrix();
const Type* ele_ty = mat_ty->element_type();
rebuilt_ty =
MakeUnique<Matrix>(RebuildType(*ele_ty), mat_ty->element_count());
rebuilt_ty = MakeUnique<Matrix>(RebuildType(GetId(ele_ty), *ele_ty),
mat_ty->element_count());
break;
}
case Type::kImage: {
const Image* image_ty = type.AsImage();
const Type* ele_ty = image_ty->sampled_type();
rebuilt_ty =
MakeUnique<Image>(RebuildType(*ele_ty), image_ty->dim(),
image_ty->depth(), image_ty->is_arrayed(),
image_ty->is_multisampled(), image_ty->sampled(),
image_ty->format(), image_ty->access_qualifier());
rebuilt_ty = MakeUnique<Image>(
RebuildType(GetId(ele_ty), *ele_ty), image_ty->dim(),
image_ty->depth(), image_ty->is_arrayed(),
image_ty->is_multisampled(), image_ty->sampled(), image_ty->format(),
image_ty->access_qualifier());
break;
}
case Type::kSampledImage: {
const SampledImage* image_ty = type.AsSampledImage();
const Type* ele_ty = image_ty->image_type();
rebuilt_ty = MakeUnique<SampledImage>(RebuildType(*ele_ty));
rebuilt_ty =
MakeUnique<SampledImage>(RebuildType(GetId(ele_ty), *ele_ty));
break;
}
case Type::kArray: {
const Array* array_ty = type.AsArray();
rebuilt_ty =
MakeUnique<Array>(array_ty->element_type(), array_ty->length_info());
const Type* ele_ty = array_ty->element_type();
rebuilt_ty = MakeUnique<Array>(RebuildType(GetId(ele_ty), *ele_ty),
array_ty->length_info());
break;
}
case Type::kRuntimeArray: {
const RuntimeArray* array_ty = type.AsRuntimeArray();
const Type* ele_ty = array_ty->element_type();
rebuilt_ty = MakeUnique<RuntimeArray>(RebuildType(*ele_ty));
rebuilt_ty =
MakeUnique<RuntimeArray>(RebuildType(GetId(ele_ty), *ele_ty));
break;
}
case Type::kStruct: {
@@ -594,7 +608,7 @@ Type* TypeManager::RebuildType(const Type& type) {
std::vector<const Type*> subtypes;
subtypes.reserve(struct_ty->element_types().size());
for (const auto* ele_ty : struct_ty->element_types()) {
subtypes.push_back(RebuildType(*ele_ty));
subtypes.push_back(RebuildType(GetId(ele_ty), *ele_ty));
}
rebuilt_ty = MakeUnique<Struct>(subtypes);
Struct* rebuilt_struct = rebuilt_ty->AsStruct();
@@ -611,7 +625,7 @@ Type* TypeManager::RebuildType(const Type& type) {
case Type::kPointer: {
const Pointer* pointer_ty = type.AsPointer();
const Type* ele_ty = pointer_ty->pointee_type();
rebuilt_ty = MakeUnique<Pointer>(RebuildType(*ele_ty),
rebuilt_ty = MakeUnique<Pointer>(RebuildType(GetId(ele_ty), *ele_ty),
pointer_ty->storage_class());
break;
}
@@ -621,9 +635,10 @@ Type* TypeManager::RebuildType(const Type& type) {
std::vector<const Type*> param_types;
param_types.reserve(function_ty->param_types().size());
for (const auto* param_ty : function_ty->param_types()) {
param_types.push_back(RebuildType(*param_ty));
param_types.push_back(RebuildType(GetId(param_ty), *param_ty));
}
rebuilt_ty = MakeUnique<Function>(RebuildType(*ret_ty), param_types);
rebuilt_ty = MakeUnique<Function>(RebuildType(GetId(ret_ty), *ret_ty),
param_types);
break;
}
case Type::kForwardPointer: {
@@ -633,7 +648,7 @@ Type* TypeManager::RebuildType(const Type& type) {
const Pointer* target_ptr = forward_ptr_ty->target_pointer();
if (target_ptr) {
rebuilt_ty->AsForwardPointer()->SetTargetPointer(
RebuildType(*target_ptr)->AsPointer());
RebuildType(GetId(target_ptr), *target_ptr)->AsPointer());
}
break;
}
@@ -641,16 +656,17 @@ Type* TypeManager::RebuildType(const Type& type) {
const CooperativeMatrixNV* cm_type = type.AsCooperativeMatrixNV();
const Type* component_type = cm_type->component_type();
rebuilt_ty = MakeUnique<CooperativeMatrixNV>(
RebuildType(*component_type), cm_type->scope_id(), cm_type->rows_id(),
cm_type->columns_id());
RebuildType(GetId(component_type), *component_type),
cm_type->scope_id(), cm_type->rows_id(), cm_type->columns_id());
break;
}
case Type::kCooperativeMatrixKHR: {
const CooperativeMatrixKHR* cm_type = type.AsCooperativeMatrixKHR();
const Type* component_type = cm_type->component_type();
rebuilt_ty = MakeUnique<CooperativeMatrixKHR>(
RebuildType(*component_type), cm_type->scope_id(), cm_type->rows_id(),
cm_type->columns_id(), cm_type->use_id());
RebuildType(GetId(component_type), *component_type),
cm_type->scope_id(), cm_type->rows_id(), cm_type->columns_id(),
cm_type->use_id());
break;
}
default:
@@ -669,7 +685,7 @@ Type* TypeManager::RebuildType(const Type& type) {
void TypeManager::RegisterType(uint32_t id, const Type& type) {
// Rebuild |type| so it and all its constituent types are owned by the type
// pool.
Type* rebuilt = RebuildType(type);
Type* rebuilt = RebuildType(id, type);
assert(rebuilt->IsSame(&type));
id_to_type_[id] = rebuilt;
if (GetId(rebuilt) == 0) {

View File

@@ -260,7 +260,9 @@ class TypeManager {
// Returns an equivalent pointer to |type| built in terms of pointers owned by
// |type_pool_|. For example, if |type| is a vec3 of bool, it will be rebuilt
// replacing the bool subtype with one owned by |type_pool_|.
Type* RebuildType(const Type& type);
//
// The re-built type will have ID |type_id|.
Type* RebuildType(uint32_t type_id, const Type& type);
// Completes the incomplete type |type|, by replaces all references to
// ForwardPointer by the defining Pointer.

View File

@@ -74,7 +74,7 @@ typedef struct spv_ext_inst_desc_t {
const uint32_t ext_inst;
const uint32_t numCapabilities;
const spv::Capability* capabilities;
const spv_operand_type_t operandTypes[16]; // TODO: Smaller/larger?
const spv_operand_type_t operandTypes[40]; // vksp needs at least 40
} spv_ext_inst_desc_t;
typedef struct spv_ext_inst_group_t {

View File

@@ -411,6 +411,7 @@ spv_result_t spvTextEncodeOperand(const spvtools::AssemblyGrammar& grammar,
case SPV_OPERAND_TYPE_IMAGE:
case SPV_OPERAND_TYPE_OPTIONAL_IMAGE:
case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS:
case SPV_OPERAND_TYPE_OPTIONAL_RAW_ACCESS_CHAIN_OPERANDS:
case SPV_OPERAND_TYPE_SELECTION_CONTROL:
case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS:
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_INFO_FLAGS:

View File

@@ -144,6 +144,9 @@ spv_result_t ValidateEntryPoints(ValidationState_t& _) {
if (auto error = ValidateFloatControls2(_)) {
return error;
}
if (auto error = ValidateDuplicateExecutionModes(_)) {
return error;
}
return SPV_SUCCESS;
}

View File

@@ -94,6 +94,13 @@ spv_result_t ValidateInterfaces(ValidationState_t& _);
/// @return SPV_SUCCESS if no errors are found.
spv_result_t ValidateFloatControls2(ValidationState_t& _);
/// @brief Validates duplicated execution modes for each entry point.
///
/// @param[in] _ the validation state of the module
///
/// @return SPV_SUCCESS if no errors are found.
spv_result_t ValidateDuplicateExecutionModes(ValidationState_t& _);
/// @brief Validates memory instructions
///
/// @param[in] _ the validation state of the module

View File

@@ -161,7 +161,8 @@ spv_result_t ValidateDecorationTarget(ValidationState_t& _, spv::Decoration dec,
case spv::Decoration::RestrictPointer:
case spv::Decoration::AliasedPointer:
if (target->opcode() != spv::Op::OpVariable &&
target->opcode() != spv::Op::OpFunctionParameter) {
target->opcode() != spv::Op::OpFunctionParameter &&
target->opcode() != spv::Op::OpRawAccessChainNV) {
return fail(0) << "must be a memory object declaration";
}
if (_.GetIdOpcode(target->type_id()) != spv::Op::OpTypePointer) {

View File

@@ -1325,21 +1325,14 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) {
// Returns true if |decoration| cannot be applied to the same id more than once.
bool AtMostOncePerId(spv::Decoration decoration) {
return decoration == spv::Decoration::ArrayStride;
return decoration != spv::Decoration::UserSemantic &&
decoration != spv::Decoration::FuncParamAttr;
}
// Returns true if |decoration| cannot be applied to the same member more than
// once.
bool AtMostOncePerMember(spv::Decoration decoration) {
switch (decoration) {
case spv::Decoration::Offset:
case spv::Decoration::MatrixStride:
case spv::Decoration::RowMajor:
case spv::Decoration::ColMajor:
return true;
default:
return false;
}
return decoration != spv::Decoration::UserSemantic;
}
spv_result_t CheckDecorationsCompatibility(ValidationState_t& vstate) {
@@ -1556,7 +1549,8 @@ spv_result_t CheckNonWritableDecoration(ValidationState_t& vstate,
const auto opcode = inst.opcode();
const auto type_id = inst.type_id();
if (opcode != spv::Op::OpVariable &&
opcode != spv::Op::OpFunctionParameter) {
opcode != spv::Op::OpFunctionParameter &&
opcode != spv::Op::OpRawAccessChainNV) {
return vstate.diag(SPV_ERROR_INVALID_ID, &inst)
<< "Target of NonWritable decoration must be a memory object "
"declaration (a variable or a function parameter)";
@@ -1569,10 +1563,11 @@ spv_result_t CheckNonWritableDecoration(ValidationState_t& vstate,
vstate.features().nonwritable_var_in_function_or_private) {
// New permitted feature in SPIR-V 1.4.
} else if (
// It may point to a UBO, SSBO, or storage image.
// It may point to a UBO, SSBO, storage image, or raw access chain.
vstate.IsPointerToUniformBlock(type_id) ||
vstate.IsPointerToStorageBuffer(type_id) ||
vstate.IsPointerToStorageImage(type_id)) {
vstate.IsPointerToStorageImage(type_id) ||
opcode == spv::Op::OpRawAccessChainNV) {
} else {
return vstate.diag(SPV_ERROR_INVALID_ID, &inst)
<< "Target of NonWritable decoration is invalid: must point to a "

View File

@@ -982,6 +982,10 @@ bool IsAllowedSampledImageOperand(spv::Op opcode, ValidationState_t& _) {
case spv::Op::OpImageBoxFilterQCOM:
case spv::Op::OpImageBlockMatchSSDQCOM:
case spv::Op::OpImageBlockMatchSADQCOM:
case spv::Op::OpImageBlockMatchWindowSADQCOM:
case spv::Op::OpImageBlockMatchWindowSSDQCOM:
case spv::Op::OpImageBlockMatchGatherSADQCOM:
case spv::Op::OpImageBlockMatchGatherSSDQCOM:
return true;
case spv::Op::OpStore:
if (_.HasCapability(spv::Capability::BindlessTextureNV)) return true;
@@ -2168,7 +2172,7 @@ spv_result_t ValidateImageProcessingQCOMDecoration(ValidationState_t& _, int id,
int texture_id = ld_inst->GetOperandAs<int>(2); // variable to load
if (!_.HasDecoration(texture_id, decor)) {
return _.diag(SPV_ERROR_INVALID_DATA, ld_inst)
<< "Missing decoration WeightTextureQCOM/BlockMatchTextureQCOM";
<< "Missing decoration " << _.SpvDecorationString(decor);
}
return SPV_SUCCESS;
@@ -2196,6 +2200,34 @@ spv_result_t ValidateImageProcessingQCOM(ValidationState_t& _,
_, ref_idx, spv::Decoration::BlockMatchTextureQCOM);
break;
}
case spv::Op::OpImageBlockMatchWindowSSDQCOM:
case spv::Op::OpImageBlockMatchWindowSADQCOM: {
int tgt_idx = inst->GetOperandAs<int>(2); // target
res = ValidateImageProcessingQCOMDecoration(
_, tgt_idx, spv::Decoration::BlockMatchTextureQCOM);
if (res != SPV_SUCCESS) break;
res = ValidateImageProcessingQCOMDecoration(
_, tgt_idx, spv::Decoration::BlockMatchSamplerQCOM);
if (res != SPV_SUCCESS) break;
int ref_idx = inst->GetOperandAs<int>(4); // reference
res = ValidateImageProcessingQCOMDecoration(
_, ref_idx, spv::Decoration::BlockMatchTextureQCOM);
if (res != SPV_SUCCESS) break;
res = ValidateImageProcessingQCOMDecoration(
_, ref_idx, spv::Decoration::BlockMatchSamplerQCOM);
break;
}
case spv::Op::OpImageBlockMatchGatherSSDQCOM:
case spv::Op::OpImageBlockMatchGatherSADQCOM: {
int tgt_idx = inst->GetOperandAs<int>(2); // target
res = ValidateImageProcessingQCOMDecoration(
_, tgt_idx, spv::Decoration::BlockMatchTextureQCOM);
if (res != SPV_SUCCESS) break;
int ref_idx = inst->GetOperandAs<int>(4); // reference
res = ValidateImageProcessingQCOMDecoration(
_, ref_idx, spv::Decoration::BlockMatchTextureQCOM);
break;
}
default:
break;
}
@@ -2326,6 +2358,10 @@ spv_result_t ImagePass(ValidationState_t& _, const Instruction* inst) {
case spv::Op::OpImageBoxFilterQCOM:
case spv::Op::OpImageBlockMatchSSDQCOM:
case spv::Op::OpImageBlockMatchSADQCOM:
case spv::Op::OpImageBlockMatchWindowSADQCOM:
case spv::Op::OpImageBlockMatchWindowSSDQCOM:
case spv::Op::OpImageBlockMatchGatherSADQCOM:
case spv::Op::OpImageBlockMatchGatherSSDQCOM:
return ValidateImageProcessingQCOM(_, inst);
default:
@@ -2378,6 +2414,10 @@ bool IsImageInstruction(const spv::Op opcode) {
case spv::Op::OpImageBoxFilterQCOM:
case spv::Op::OpImageBlockMatchSSDQCOM:
case spv::Op::OpImageBlockMatchSADQCOM:
case spv::Op::OpImageBlockMatchWindowSADQCOM:
case spv::Op::OpImageBlockMatchWindowSSDQCOM:
case spv::Op::OpImageBlockMatchGatherSADQCOM:
case spv::Op::OpImageBlockMatchGatherSSDQCOM:
return true;
default:
break;
@@ -2396,6 +2436,11 @@ spv_result_t ValidateQCOMImageProcessingTextureUsages(ValidationState_t& _,
case spv::Op::OpImageBlockMatchSSDQCOM:
case spv::Op::OpImageBlockMatchSADQCOM:
break;
case spv::Op::OpImageBlockMatchWindowSADQCOM:
case spv::Op::OpImageBlockMatchWindowSSDQCOM:
case spv::Op::OpImageBlockMatchGatherSADQCOM:
case spv::Op::OpImageBlockMatchGatherSSDQCOM:
break;
default:
for (size_t i = 0; i < inst->operands().size(); ++i) {
int id = inst->GetOperandAs<int>(i);

View File

@@ -254,37 +254,24 @@ spv_result_t GetLocationsForVariable(
// equal. Also track Patch and PerTaskNV decorations.
bool has_location = false;
uint32_t location = 0;
bool has_component = false;
uint32_t component = 0;
bool has_index = false;
uint32_t index = 0;
bool has_patch = false;
bool has_per_task_nv = false;
bool has_per_vertex_khr = false;
// Duplicate Location, Component, Index are checked elsewhere.
for (auto& dec : _.id_decorations(variable->id())) {
if (dec.dec_type() == spv::Decoration::Location) {
if (has_location && dec.params()[0] != location) {
return _.diag(SPV_ERROR_INVALID_DATA, variable)
<< "Variable has conflicting location decorations";
}
has_location = true;
location = dec.params()[0];
} else if (dec.dec_type() == spv::Decoration::Component) {
if (has_component && dec.params()[0] != component) {
return _.diag(SPV_ERROR_INVALID_DATA, variable)
<< "Variable has conflicting component decorations";
}
has_component = true;
component = dec.params()[0];
} else if (dec.dec_type() == spv::Decoration::Index) {
if (!is_output || !is_fragment) {
return _.diag(SPV_ERROR_INVALID_DATA, variable)
<< "Index can only be applied to Fragment output variables";
}
if (has_index && dec.params()[0] != index) {
return _.diag(SPV_ERROR_INVALID_DATA, variable)
<< "Variable has conflicting index decorations";
}
has_index = true;
index = dec.params()[0];
} else if (dec.dec_type() == spv::Decoration::BuiltIn) {

View File

@@ -1386,10 +1386,10 @@ spv_result_t ValidateAccessChain(ValidationState_t& _,
// should be less than the number of struct members.
const int64_t num_struct_members =
static_cast<int64_t>(type_pointee->words().size() - 2);
if (cur_index >= num_struct_members) {
if (cur_index >= num_struct_members || cur_index < 0) {
return _.diag(SPV_ERROR_INVALID_ID, cur_word_instr)
<< "Index is out of bounds: " << instr_name
<< " can not find index " << cur_index
<< " cannot find index " << cur_index
<< " into the structure <id> "
<< _.getIdName(type_pointee->id()) << ". This structure has "
<< num_struct_members << " members. Largest valid index is "
@@ -1410,7 +1410,7 @@ spv_result_t ValidateAccessChain(ValidationState_t& _,
}
}
}
// At this point, we have fully walked down from the base using the indeces.
// At this point, we have fully walked down from the base using the indices.
// The type being pointed to should be the same as the result type.
if (type_pointee->id() != result_type_pointee->id()) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
@@ -1427,6 +1427,126 @@ spv_result_t ValidateAccessChain(ValidationState_t& _,
return SPV_SUCCESS;
}
spv_result_t ValidateRawAccessChain(ValidationState_t& _,
const Instruction* inst) {
std::string instr_name = "Op" + std::string(spvOpcodeString(inst->opcode()));
// The result type must be OpTypePointer.
const auto result_type = _.FindDef(inst->type_id());
if (spv::Op::OpTypePointer != result_type->opcode()) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "The Result Type of " << instr_name << " <id> "
<< _.getIdName(inst->id()) << " must be OpTypePointer. Found Op"
<< spvOpcodeString(result_type->opcode()) << '.';
}
// The pointed storage class must be valid.
const auto storage_class = result_type->GetOperandAs<spv::StorageClass>(1);
if (storage_class != spv::StorageClass::StorageBuffer &&
storage_class != spv::StorageClass::PhysicalStorageBuffer &&
storage_class != spv::StorageClass::Uniform) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "The Result Type of " << instr_name << " <id> "
<< _.getIdName(inst->id())
<< " must point to a storage class of "
"StorageBuffer, PhysicalStorageBuffer, or Uniform.";
}
// The pointed type must not be one in the list below.
const auto result_type_pointee =
_.FindDef(result_type->GetOperandAs<uint32_t>(2));
if (result_type_pointee->opcode() == spv::Op::OpTypeArray ||
result_type_pointee->opcode() == spv::Op::OpTypeMatrix ||
result_type_pointee->opcode() == spv::Op::OpTypeStruct) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "The Result Type of " << instr_name << " <id> "
<< _.getIdName(inst->id())
<< " must not point to "
"OpTypeArray, OpTypeMatrix, or OpTypeStruct.";
}
// Validate Stride is a OpConstant.
const auto stride = _.FindDef(inst->GetOperandAs<uint32_t>(3));
if (stride->opcode() != spv::Op::OpConstant) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "The Stride of " << instr_name << " <id> "
<< _.getIdName(inst->id()) << " must be OpConstant. Found Op"
<< spvOpcodeString(stride->opcode()) << '.';
}
// Stride type must be OpTypeInt
const auto stride_type = _.FindDef(stride->type_id());
if (stride_type->opcode() != spv::Op::OpTypeInt) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "The type of Stride of " << instr_name << " <id> "
<< _.getIdName(inst->id()) << " must be OpTypeInt. Found Op"
<< spvOpcodeString(stride_type->opcode()) << '.';
}
// Index and Offset type must be OpTypeInt with a width of 32
const auto ValidateType = [&](const char* name,
int operandIndex) -> spv_result_t {
const auto value = _.FindDef(inst->GetOperandAs<uint32_t>(operandIndex));
const auto value_type = _.FindDef(value->type_id());
if (value_type->opcode() != spv::Op::OpTypeInt) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "The type of " << name << " of " << instr_name << " <id> "
<< _.getIdName(inst->id()) << " must be OpTypeInt. Found Op"
<< spvOpcodeString(value_type->opcode()) << '.';
}
const auto width = value_type->GetOperandAs<uint32_t>(1);
if (width != 32) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "The integer width of " << name << " of " << instr_name
<< " <id> " << _.getIdName(inst->id()) << " must be 32. Found "
<< width << '.';
}
return SPV_SUCCESS;
};
spv_result_t result;
result = ValidateType("Index", 4);
if (result != SPV_SUCCESS) {
return result;
}
result = ValidateType("Offset", 5);
if (result != SPV_SUCCESS) {
return result;
}
uint32_t access_operands = 0;
if (inst->operands().size() >= 7) {
access_operands = inst->GetOperandAs<uint32_t>(6);
}
if (access_operands &
uint32_t(spv::RawAccessChainOperandsMask::RobustnessPerElementNV)) {
uint64_t stride_value = 0;
if (_.EvalConstantValUint64(stride->id(), &stride_value) &&
stride_value == 0) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "Stride must not be zero when per-element robustness is used.";
}
}
if (access_operands &
uint32_t(spv::RawAccessChainOperandsMask::RobustnessPerComponentNV) ||
access_operands &
uint32_t(spv::RawAccessChainOperandsMask::RobustnessPerElementNV)) {
if (storage_class == spv::StorageClass::PhysicalStorageBuffer) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "Storage class cannot be PhysicalStorageBuffer when "
"raw access chain robustness is used.";
}
}
if (access_operands &
uint32_t(spv::RawAccessChainOperandsMask::RobustnessPerComponentNV) &&
access_operands &
uint32_t(spv::RawAccessChainOperandsMask::RobustnessPerElementNV)) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "Per-component robustness and per-element robustness are "
"mutually exclusive.";
}
return SPV_SUCCESS;
}
spv_result_t ValidatePtrAccessChain(ValidationState_t& _,
const Instruction* inst) {
if (_.addressing_model() == spv::AddressingModel::Logical) {
@@ -1866,6 +1986,9 @@ spv_result_t MemoryPass(ValidationState_t& _, const Instruction* inst) {
case spv::Op::OpInBoundsPtrAccessChain:
if (auto error = ValidateAccessChain(_, inst)) return error;
break;
case spv::Op::OpRawAccessChainNV:
if (auto error = ValidateRawAccessChain(_, inst)) return error;
break;
case spv::Op::OpArrayLength:
if (auto error = ValidateArrayLength(_, inst)) return error;
break;

View File

@@ -346,6 +346,7 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _,
case spv::ExecutionMode::LocalSizeHintId:
case spv::ExecutionMode::LocalSizeId:
case spv::ExecutionMode::FPFastMathDefault:
case spv::ExecutionMode::MaximumRegistersIdINTEL:
valid_mode = true;
break;
default:
@@ -723,6 +724,25 @@ spv_result_t ValidateMemoryModel(ValidationState_t& _,
return SPV_SUCCESS;
}
bool PerEntryExecutionMode(spv::ExecutionMode mode) {
switch (mode) {
// These execution modes can be specified multiple times per entry point.
case spv::ExecutionMode::DenormPreserve:
case spv::ExecutionMode::DenormFlushToZero:
case spv::ExecutionMode::SignedZeroInfNanPreserve:
case spv::ExecutionMode::RoundingModeRTE:
case spv::ExecutionMode::RoundingModeRTZ:
case spv::ExecutionMode::FPFastMathDefault:
case spv::ExecutionMode::RoundingModeRTPINTEL:
case spv::ExecutionMode::RoundingModeRTNINTEL:
case spv::ExecutionMode::FloatingPointModeALTINTEL:
case spv::ExecutionMode::FloatingPointModeIEEEINTEL:
return false;
default:
return true;
}
}
} // namespace
spv_result_t ValidateFloatControls2(ValidationState_t& _) {
@@ -807,5 +827,52 @@ spv_result_t ModeSettingPass(ValidationState_t& _, const Instruction* inst) {
return SPV_SUCCESS;
}
spv_result_t ValidateDuplicateExecutionModes(ValidationState_t& _) {
using PerEntryKey = std::tuple<spv::ExecutionMode, uint32_t>;
using PerOperandKey = std::tuple<spv::ExecutionMode, uint32_t, uint32_t>;
std::set<PerEntryKey> seen_per_entry;
std::set<PerOperandKey> seen_per_operand;
const auto lookupMode = [&_](spv::ExecutionMode mode) -> std::string {
spv_operand_desc desc = nullptr;
if (_.grammar().lookupOperand(SPV_OPERAND_TYPE_EXECUTION_MODE,
static_cast<uint32_t>(mode),
&desc) == SPV_SUCCESS) {
return std::string(desc->name);
}
return "Unknown";
};
for (const auto& inst : _.ordered_instructions()) {
if (inst.opcode() != spv::Op::OpExecutionMode &&
inst.opcode() != spv::Op::OpExecutionModeId) {
continue;
}
const auto entry = inst.GetOperandAs<uint32_t>(0);
const auto mode = inst.GetOperandAs<spv::ExecutionMode>(1);
if (PerEntryExecutionMode(mode)) {
if (!seen_per_entry.insert(std::make_tuple(mode, entry)).second) {
return _.diag(SPV_ERROR_INVALID_ID, &inst)
<< lookupMode(mode)
<< " execution mode must not be specified multiple times per "
"entry point";
}
} else {
// Execution modes allowed multiple times all take a single operand.
const auto operand = inst.GetOperandAs<uint32_t>(2);
if (!seen_per_operand.insert(std::make_tuple(mode, entry, operand))
.second) {
return _.diag(SPV_ERROR_INVALID_ID, &inst)
<< lookupMode(mode)
<< " execution mode must not be specified multiple times for "
"the same entry point and operands";
}
}
}
return SPV_SUCCESS;
}
} // namespace val
} // namespace spvtools

View File

@@ -615,7 +615,8 @@ void ValidationState_t::RegisterQCOMImageProcessingTextureConsumer(
uint32_t texture_id, const Instruction* consumer0,
const Instruction* consumer1) {
if (HasDecoration(texture_id, spv::Decoration::WeightTextureQCOM) ||
HasDecoration(texture_id, spv::Decoration::BlockMatchTextureQCOM)) {
HasDecoration(texture_id, spv::Decoration::BlockMatchTextureQCOM) ||
HasDecoration(texture_id, spv::Decoration::BlockMatchSamplerQCOM)) {
qcom_image_processing_consumers_.insert(consumer0->id());
if (consumer1) {
qcom_image_processing_consumers_.insert(consumer1->id());