aboutsummaryrefslogtreecommitdiff
path: root/source/val
AgeCommit message (Collapse)Author
2018-04-17Fixes #1483. Validating Vulkan 1.1 barrier execution scopesAlan Baker
* Reworked how execution model limitations are checked * Now OpFunction checks which entry points call it and checks its registered limitations instead of building a call stack in the entry point * New tests * Moving function to entry point mapping into VState
2018-04-05Fix major bug in validate_builtinsAndrey Tuganov
Fixed an early return in the loop, resulting in only one decoration being checked.
2018-04-05Execution mode/model available in validation stateAndrey Tuganov
Refactored validate built-ins to make GetExecutionModels(entry_point) and GetExecutionModes(entry_point) available in validation state. Entry points are allowed to have multiple execution modes and execution models. Finished the last missing feature in Vulkan built-ins validation: FragDepth requires DepthReplacing.
2018-03-23Add Vulkan validation rules for BuiltIn variablesAndrey Tuganov
Added a framework for validation of BuiltIn variables. The framework allows implementation of flexible abstract rules which are required for built-ins as the information (decoration, definition, reference) is not in one place, but is scattered all over the module. Validation rules are implemented as a map id -> list<functor(instrution)> Ids which are dependent on built-in types or objects receive a task list, such as "this id cannot be referenced from function which is called from entry point with execution model X; propagate this rule to your descendants in the global scope". Also refactored test/val/val_fixtures. All built-ins covered by tests
2018-03-22Fixes compile errors generated with -WpedanticEleni Maria Stea
This patch fixes the compile errors generated when the options SPIRV_WARN_EVERYTHING and SPIRV_WERROR (that force -Wpedantic) are set to cmake.
2018-03-07AMD_gpu_shader_half_float enables float16Andrey Tuganov
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1375 Hardcoded float16 feature enabling if extension SPV_AMD_gpu_shader_half_float is present.
2018-03-05Support SPV_GOOGLE_decorate_string and SPV_GOOGLE_hlsl_functionality1David Neto
This commit add assembling, disassembling, and basic validation for two Google extensions to better support HLSL translation.
2018-02-07Add Vulkan-specific validation rules for atomicsAndrey Tuganov
Added atomic instructions validation rules from https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#spirvenv-module-validation
2018-02-05Add barrier instructions validation passAndrey Tuganov
2017-12-14Refactor include of latest spir-v header versionsAndrey Tuganov
2017-11-30Fix validation of group ops in SPV_AMD_shader_ballotDavid Neto
This needs custom code since the rules from the extension are not encoded in the grammar. Changes are: - The new group instructions don't require Group capability when the extension is declared. - The Reduce, InclusiveScan, ExclusiveScan normally require the Kernel capability, but don't when the extension is declared. Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/991
2017-11-27Fix windows build.Diego Novillo
This fixes the lack of uint32_t definition in source/val/decoration.h.
2017-11-27Re-format source tree - NFC.Diego Novillo
Re-formatted the source tree with the command: $ /usr/bin/clang-format -style=file -i \ $(find include source tools test utils -name '*.cpp' -or -name '*.h') This required a fix to source/val/decoration.h. It was not including spirv.h, which broke builds when the #include headers were re-ordered by clang-format.
2017-11-23Add validation checks for Execution ModelAndrey Tuganov
Currently checks that these instructions are called from entry points with Fragment execution model. OpImageImplicit* OpImageQueryLod OpKill
2017-11-22Validator pass for image instructionsAndrey Tuganov
Includes validation rules for OpImageXXX and ImageOperand. Doesn't include OpTypeImage and OpImageSparseXXX. Disabled an invalid test.
2017-11-08Re-format files in source, source/opt, source/util, source/val and tools.Diego Novillo
NFC. This just makes sure every file is formatted following the formatting definition in .clang-format. Re-formatted with: $ clang-format -i $(find source tools include -name '*.cpp') $ clang-format -i $(find source tools include -name '*.h')
2017-10-28Add option to relax validation of store types.Steven Perron
There are a number of users of spriv-opt that are hitting errors because of stores with different types. In general, this is wrong, but, in these cases, the types are the exact same except for decorations. The options is "--relax-store-struct", and it can be used with the validator or the optimizer. We assume that if layout information is missing it is consistent. For example if one struct has a offset of one of its members, and the other one does not, we will still consider them as being layout compatible. The problem will be if both struct has and offset decoration for corresponding members, and the offset are different.
2017-10-25Turn all function static non-POD variables into global POD variablesLei Zhang
Function static non-POD data causes problems with DLL lifetime. This pull request turns all static info tables into strict POD tables. Specifically, the capabilities/extensions field of opcode/operand/extended-instruction table are turned into two fields, one for the count and the other a pointer to an array of capabilities/extensions. CapabilitySet/EnumSet are not used in the static table anymore, but they are still used for checking inclusion by constructing on the fly, which should be cheap for the majority cases. Also moves all these tables into the global namespace to avoid C++11 function static thread-safe initialization overhead.
2017-10-20Add validation pass for conversion instructionsAndrey Tuganov
The pass checks correctness of operands of instruction in opcode range OpConvertFToU - OpBitset. Disabled invalid tests Disabled UConvert validation until Vulkan CTS can catch up. Add validate_conversion to Android.mk Also remove duplicate entry in CMakeLists.txt.
2017-10-12Validator checks OpReturn called from void funcAndrey Tuganov
Added check into validate_cfg which checks that OpReturn is not called from functions which are supposed to return a value.
2017-09-26Add remaining opcodes to arithmetics validationAndrey Tuganov
Add validation rules for: - OpIAddCarry - OpISubBorrow - OpUMulExtended - OpSMulExtended Includes some refactoring of old code.
2017-09-08Add new checks to validate arithmetics passAndrey Tuganov
New operations: - OpDot - OpVectorTimesScalar - OpMatrixTimesScalar - OpVectorTimesMatrix - OpMatrixTimesVector - OpMatrixTimesMatrix - OpOuterProduct
2017-09-07validator: OpModuleProcessed allowed in layout section 7cDavid Neto
Recent spec fix from SPIR Working group: Allow OpModuleProcessed after debug names, but before any annotation instructions.
2017-09-05Add validation pass for arithmetic operationsAndrey Tuganov
The pass checks if arithmetic operations (such as OpFMul) receive correct operands.
2017-06-30Added compression tool tools/spirv-markv. Work in progress.Andrey Tuganov
Command line application is located at tools/spirv-markv API at include/spirv-tools/markv.h At the moment only very basic compression is implemented, mostly varint. Scope of supported SPIR-V opcodes is also limited. Using a simple move-to-front implementation instead of encoding mapped ids. Work in progress: - Does not cover all of SPIR-V - Does not promise compatibility of compression/decompression across different versions of the code.
2017-06-28Don't do hash lookup twice in FindDefChris Forbes
2017-05-25CFA: Move TraversalRoots and ComputeAugmentedCFG into CFAGreg Fischer
2017-05-15Add SPIR-V 1.2 support, for OpenCL 2.2David Neto
2017-05-09Stats analyzer aggregates OpConstant usageAndrey Tuganov
2017-05-09Stats analyzer uses validatorAndrey Tuganov
Stats analyzer calls validator to check the instruction and update validator state. Fixed unit tests (validator was failing).
2017-05-08Inline: Create CFA classGreg Fischer
Create class to encapsulate control flow analysis and share across validator and optimizer. A WIP. Start with DepthFirstTraversal. Next pull in CalculateDominators.
2017-04-07Support SPV_KHR_storage_buffer_storage_classDavid Neto
Includes interaction with SPV_KHR_variable_pointers TODO: Update capabilitly dependency tests for new capabilities.
2017-04-07Validator support for Variable Pointer extension.Ehsan Nasiri
If the variable_pointer extension is used: * OpLoad's pointer argument may be the result of any of the following: * OpSelect * OpPhi * OpFunctionCall * OpPtrAccessChain * OpCopyObject * OpLoad * OpConstantNull * Return value of a function may be a pointer. * It is valid to use a pointer as the return value of a function. * OpStore should allow a variable pointer argument.
2017-03-14Validator checks if operands require extensionAndrey Tuganov
If required extension is not found, returning new error SPV_ERROR_MISSING_EXTENSION.
2017-03-09Validator parses and registers OpExtensionAndrey Tuganov
Known extensions are saved in validation state. Unknown extension produce a dignostic message, but do not fail the validation. Moved extension definitions to their own file.
2017-03-01Allow using FPRoundingMode when see VK_KHR_16bit_storageLei Zhang
According to the extension, FPRoundingMode should be allowed to use without requiring Kernel capability when VK_KHR_16bit_storage is enabled.
2017-02-28Issue 559: check type declaration uniquenessAndrey Tuganov
Adds PassTypeUnique to the validator. Disallows repeated declarations of all types except for aggregates.
2017-02-28Refactored validation_state, added new typesAndrey Tuganov
- validation_state.cpp uses functions from opcode.h instead of in-place switches which need to be updated. - added new spirv 1.1 type declaration opcodes to a 'is op type declaration' switch in opcode.cpp.
2017-02-28Add command line options struct for the validatorEhsan Nasiri
The limit for the number of struct members is parameterized using command line options. Add --max-struct-depth command line option. Add --max-switch-branches command line option. Add --max-function-args command line option. Add --max-control-flow-nesting-depth option. Add --max-access-chain-indexes option.
2017-02-27Validation of type decls for SPV_KHR_16bit_storageDavid Neto
Allow declaration of 16bit int or 16bit float in the presence of capabilities from SPV_KHR_16bit_storage
2017-02-27Add a Feature struct to validation state.David Neto
For now, it is used only for checks of 16bit int and float types.
2017-02-10Check strict domination of merge blockDavid Neto
If a merge block is reachable, then it must be *strictly* dominated by its header. Until now we've allowed the header and the merge block to be the same. Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/551 Also: Use dominates and postdominates methods on BasicBlock to improve readability.
2017-01-19Check BuiltIn Decoration rules.Ehsan Nasiri
When applied to a structure-type member, all members of that structure type must also be decorated with BuiltIn. (No allowed mixing of built-in variables and non-built-in variables within a single structure.) When applied to a structure-type member, that structure type cannot be contained as a member of another structure type. There is at most one object per Storage Class that can contain a structure type containing members decorated with BuiltIn, consumed per entry-point.
2017-01-18Validation for decoration rules. Fixes issue #499.Ehsan Nasiri
Added a new file where all the decoration validation can be performed. In this change the SPIRV Spec Section 2.16.1 is implemented: "It is illegal to initialize an imported variable. This means that a module-scope OpVariable with initialization value cannot be marked with the Import Linkage Type." Also added unit tests.
2017-01-16Adding decoration class and tests.Ehsan Nasiri
* Added the decoration class as well as the code that registers the decorations for each <id> and also decorations for struct members. * Added unit tests for decorations in ValidationState as well as decoration id tests.
2017-01-13Validation of OpEntryPoint usage.Ehsan Nasiri
According to the SPIRV Spec (2.16.1): * There is at least one OpEntryPoint instruction, unless the Linkage capability is being used. * No function can be targeted by both an OpEntryPoint instruction and an OpFunctionCall instruction. Also updated unit tests to includ OpEntryPoint.
2017-01-06Fixes bug #517.Ehsan Nasiri
entry_block_to_construct_ maps an entry block to its construct. The key in this map (the entry block) is not unique, and therefore the entry for the continue construct gets overwritten when the selection construct is discovered. Since a given block may be the entry block of different types of constructs, the (basic_block, construct_type) pair should be able to uniquely identify the construct. Adds test: - In this test, a basic block is the entry block of a continue construct as well as the entry block of a selection construct. It can be shown that this unit test would crash without the fix in this PR and passes with the fix in this PR.
2016-12-23Validation code for control flow nesting depth.Ehsan Nasiri
According to Section 2.17 (Universal Limits) of the SPIR-V Spec, the control flow nesting depth may not be larger than 1023. This is checked only when we are required to have structured control flow. Otherwise it's not clear how to compute control flow nesting depth.
2016-12-07Validation for struct nesting depth.Ehsan Nasiri
According to sectin 2.17 in SPIR-V Spec, the structure nesting depth may not be larger than 255. This is interpreted as structures nested in structures. The code does not look into arrays or follow pointers to see if it reaches a structure downstream. Use memoization to avoid exponential runtime.
2016-12-01Validate the number of global and local variables.Ehsan Nasiri
According to the Universal Limits section of the SPIR-V Spec (2.17), the number of global variables may not exceed 65,535 and the number of local variables may not exceed 524,287. Also added unit tests for each one.