platform/upstream/SPIRV-Tools.git
7 years agoMove spv_instruction_t's into vector
Chris Forbes [Tue, 27 Jun 2017 21:21:00 +0000 (14:21 -0700)]
Move spv_instruction_t's into vector

No need to incur another copy here. These guys have embedded vectors
we'd rather not copy.

7 years agoReserve expected length of instructions vector
Chris Forbes [Tue, 27 Jun 2017 18:55:14 +0000 (11:55 -0700)]
Reserve expected length of instructions vector

7 years agoMove some temp vectors into parser state
Chris Forbes [Tue, 27 Jun 2017 18:00:06 +0000 (11:00 -0700)]
Move some temp vectors into parser state

We don't need to churn the allocations for these every instruction.

7 years agoBlockMerge: Add BlockMergePass
GregF [Wed, 7 Jun 2017 21:28:53 +0000 (15:28 -0600)]
BlockMerge: Add BlockMergePass

Also, add BasicBlock::tail()

7 years agoUpdate CHANGES
David Neto [Thu, 22 Jun 2017 14:22:55 +0000 (10:22 -0400)]
Update CHANGES

- Describe support for AMD extensions
- Describe recently added optimizer passes

7 years agoAdd support for SPV AMD extensions
Rex Xu [Wed, 21 Jun 2017 07:58:00 +0000 (15:58 +0800)]
Add support for SPV AMD extensions

7 years agomem2reg: Add InsertExtractElimPass
GregF [Fri, 26 May 2017 16:33:11 +0000 (10:33 -0600)]
mem2reg: Add InsertExtractElimPass

7 years agoTransform multiple entry points
David Neto [Tue, 20 Jun 2017 19:57:47 +0000 (15:57 -0400)]
Transform multiple entry points

Don't stop just after one because of short-circuiting logical-or.

7 years agomem2reg: Add LocalSingleStoreElimPass
GregF [Fri, 19 May 2017 23:31:28 +0000 (17:31 -0600)]
mem2reg: Add LocalSingleStoreElimPass

Eliminate function scope variables with one store, if possible.

7 years agomem2reg: Add pass to eliminate local loads and stores in single block.
GregF [Thu, 18 May 2017 20:51:55 +0000 (14:51 -0600)]
mem2reg: Add pass to eliminate local loads and stores in single block.

7 years agoDon't install googletest and googlemock
rdb [Wed, 7 Jun 2017 10:14:31 +0000 (12:14 +0200)]
Don't install googletest and googlemock

7 years agoMem2Reg: Add Local Access Chain Convert pass
GregF [Fri, 12 May 2017 23:27:21 +0000 (17:27 -0600)]
Mem2Reg: Add Local Access Chain Convert pass

- Supports OpAccessChain and OpInBoundsAccessChain
- Does not process modules with non-32-bit integer types.

7 years agoFix memory leak in ValidateBinaryUsingContextAndValidationState
Gabríel Arthúr Pétursson [Sat, 3 Jun 2017 23:08:22 +0000 (23:08 +0000)]
Fix memory leak in ValidateBinaryUsingContextAndValidationState

7 years agoBots print output from timed out tests
Andrey Tuganov [Tue, 30 May 2017 17:29:13 +0000 (13:29 -0400)]
Bots print output from timed out tests

Timeout set to 300 seconds. If no timeout, then ctest itself will be
timed out and terminated leaving no output.

7 years agoFixed misspelled ctest flag --output_on_failure
Andrey Tuganov [Mon, 29 May 2017 17:26:46 +0000 (13:26 -0400)]
Fixed misspelled ctest flag --output_on_failure

7 years agoSupport building on FreeBSD
rdb [Sun, 28 May 2017 21:19:58 +0000 (23:19 +0200)]
Support building on FreeBSD

7 years agoCFA: Move TraversalRoots and ComputeAugmentedCFG into CFA
Greg Fischer [Tue, 23 May 2017 17:31:56 +0000 (11:31 -0600)]
CFA: Move TraversalRoots and ComputeAugmentedCFG into CFA

7 years agoCFA: Pull in CalculateDominators
Greg Fischer [Tue, 9 May 2017 00:32:12 +0000 (18:32 -0600)]
CFA: Pull in CalculateDominators

7 years agoDefUseManager: Fix ReplaceAllUsesWith() to update inst_to_used_ids_
GregF [Wed, 17 May 2017 19:33:47 +0000 (13:33 -0600)]
DefUseManager: Fix ReplaceAllUsesWith() to update inst_to_used_ids_

7 years agoAdded extension SPV_VALIDATOR_ignore_type_decl_unique
Andrey Tuganov [Thu, 11 May 2017 19:32:29 +0000 (15:32 -0400)]
Added extension SPV_VALIDATOR_ignore_type_decl_unique

If extension is present in the module, validator will ignore the "type
declaration must be unique" rule.

7 years agoRemove unused this in lambda capture
Lei Zhang [Wed, 17 May 2017 18:12:25 +0000 (14:12 -0400)]
Remove unused this in lambda capture

7 years agoAdd SPIR-V 1.2 support, for OpenCL 2.2
David Neto [Tue, 14 Mar 2017 16:43:41 +0000 (12:43 -0400)]
Add SPIR-V 1.2 support, for OpenCL 2.2

7 years agoFix size_t conversion error on MinGW
David Neto [Mon, 15 May 2017 15:55:22 +0000 (11:55 -0400)]
Fix size_t conversion error on MinGW

7 years agoUpdate CHANGES: note fix of issue 629
David Neto [Fri, 12 May 2017 21:35:18 +0000 (17:35 -0400)]
Update CHANGES: note fix of issue 629

7 years agoInline: Inline early return function if no returns in loop.
Greg Fischer [Fri, 5 May 2017 02:55:53 +0000 (20:55 -0600)]
Inline: Inline early return function if no returns in loop.

7 years agoAdded bit stream utils
Andrey Tuganov [Mon, 24 Apr 2017 19:17:33 +0000 (15:17 -0400)]
Added bit stream utils

Also added generalized zigzag coding.
- Due to signed integers being mostly non-negative, improved zigzag coding
  to favor positive values.

7 years agoStats analyzer aggregates OpConstant usage
Andrey Tuganov [Thu, 4 May 2017 17:35:52 +0000 (13:35 -0400)]
Stats analyzer aggregates OpConstant usage

7 years agoStats analyzer uses validator
Andrey Tuganov [Wed, 3 May 2017 19:26:39 +0000 (15:26 -0400)]
Stats analyzer uses validator

Stats analyzer calls validator to check the instruction and update
validator state.

Fixed unit tests (validator was failing).

7 years agoAvoid snprintf warning in GCC 7.1
David Neto [Mon, 8 May 2017 19:39:30 +0000 (15:39 -0400)]
Avoid snprintf warning in GCC 7.1

Tries to fix https://github.com/KhronosGroup/SPIRV-Tools/issues/642
See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80655

7 years agoInline: Create CFA class
Greg Fischer [Fri, 28 Apr 2017 19:38:10 +0000 (13:38 -0600)]
Inline: Create CFA class

Create class to encapsulate control flow analysis and share across
validator and optimizer. A WIP. Start with DepthFirstTraversal. Next
pull in CalculateDominators.

7 years agoUpdate set_spec_const_default_value_test.cpp
Mike Lothain [Mon, 8 May 2017 12:56:45 +0000 (13:56 +0100)]
Update set_spec_const_default_value_test.cpp

Work around warning of dangling else

7 years agoAdded Markov chain analysis to stats
Andrey Tuganov [Thu, 20 Apr 2017 19:32:38 +0000 (15:32 -0400)]
Added Markov chain analysis to stats

Added data structure to SpirvStats which is used to collect statistics
on opcodes following other opcodes.

Added a simple analysis print-out to spirv-stats.

7 years agoInline: Change "--inline-entry-points-all" to "-exhaustive"
Greg Fischer [Wed, 26 Apr 2017 00:07:35 +0000 (18:07 -0600)]
Inline: Change "--inline-entry-points-all" to "-exhaustive"

7 years agoInline: Fix inliner description in usage message to reflect exceptions.
Greg Fischer [Tue, 25 Apr 2017 23:47:18 +0000 (17:47 -0600)]
Inline: Fix inliner description in usage message to reflect exceptions.

7 years agoInline: Do not inline functions with multiple returns (for now)
GregF [Tue, 25 Apr 2017 19:57:20 +0000 (13:57 -0600)]
Inline: Do not inline functions with multiple returns (for now)

7 years agoAdd bit pattern interface for setting default value for spec constants
qining [Wed, 19 Apr 2017 22:10:59 +0000 (18:10 -0400)]
Add bit pattern interface for setting default value for spec constants

7 years agoUpdate CHANGES with recent news
David Neto [Thu, 20 Apr 2017 19:54:10 +0000 (15:54 -0400)]
Update CHANGES with recent news

7 years agoAdded --compact-ids to /tools/opt
Andrey Tuganov [Tue, 11 Apr 2017 19:11:04 +0000 (15:11 -0400)]
Added --compact-ids to /tools/opt

The pass remaps ids to a compact set which starts with %1 and
has no gaps.

7 years agoAdded option --preserve-numeric-ids to tools/spirv-as
Andrey Tuganov [Tue, 11 Apr 2017 23:46:15 +0000 (19:46 -0400)]
Added option --preserve-numeric-ids to tools/spirv-as

Added options to tools::Assemble

7 years agoAdded statistical analysis tool (tool/stats)
Andrey Tuganov [Thu, 6 Apr 2017 20:55:26 +0000 (16:55 -0400)]
Added statistical analysis tool (tool/stats)

Currently analyzes percentages of the following:
- version (how many 1.0 or 1.1)
- generator
- extension
- capability
- opcode prevalence

7 years agoTest source language HLSL
David Neto [Thu, 6 Apr 2017 15:04:09 +0000 (11:04 -0400)]
Test source language HLSL

7 years agoSupport SPV_KHR_storage_buffer_storage_class
David Neto [Sun, 26 Mar 2017 01:12:22 +0000 (21:12 -0400)]
Support SPV_KHR_storage_buffer_storage_class

Includes interaction with SPV_KHR_variable_pointers

TODO: Update capabilitly dependency tests for new capabilities.

7 years agoValidator support for Variable Pointer extension.
Ehsan Nasiri [Wed, 1 Feb 2017 20:37:39 +0000 (15:37 -0500)]
Validator support for Variable Pointer extension.

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.

7 years agoUpdate cap tests for SPV_KHR_16bit_storage
David Neto [Mon, 20 Mar 2017 16:28:40 +0000 (12:28 -0400)]
Update cap tests for SPV_KHR_16bit_storage

7 years agoTest asm,dis support for SPV_KHR_variable_pointers
David Neto [Wed, 8 Mar 2017 22:16:04 +0000 (17:16 -0500)]
Test asm,dis support for SPV_KHR_variable_pointers

7 years agoAdd FlattenDecoration transform
David Neto [Sat, 1 Apr 2017 20:10:16 +0000 (16:10 -0400)]
Add FlattenDecoration transform

Add --flatten-decorations to spirv-opt

Flattens decoration groups.  That is, replace OpDecorationGroup
and its uses in OpGroupDecorate and OpGroupMemberDecorate with
ordinary OpDecorate and OpMemberDecorate instructions.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/602

7 years agoGroup targets into folders
Lei Zhang [Wed, 5 Apr 2017 21:32:39 +0000 (17:32 -0400)]
Group targets into folders

This plays nicer with IDEs.

7 years agoUpdate spirv-opt to use spvtools::Optimizer
David Neto [Sun, 2 Apr 2017 06:36:35 +0000 (02:36 -0400)]
Update spirv-opt to use spvtools::Optimizer

Exercises our public APIs more, and avoid including most
internal headers.  It also shortens the processing part
of the code, but does make adding passes look more complex.

Doing this exposed issue 611, a bug in spvtools::Optimizer.

7 years agoFix optimizer on when to write the binary
David Neto [Sun, 2 Apr 2017 06:17:41 +0000 (02:17 -0400)]
Fix optimizer on when to write the binary

The spvtools::Optimizer::Run method should also write the output binary
if optimization succeeds without changes but the output binary vector
does not have exactly the same contents as the input binary.
We have to check both the base pointer of the storage and the size of
the vector

Added a test for this too.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/611

7 years agoAdd /EHs for targets for MSVC
Lei Zhang [Mon, 3 Apr 2017 17:41:20 +0000 (13:41 -0400)]
Add /EHs for targets for MSVC

7 years agoFix spelling in SPV_AMD_gcn_shader support
David Neto [Mon, 3 Apr 2017 18:59:18 +0000 (14:59 -0400)]
Fix spelling in SPV_AMD_gcn_shader support

7 years agoFix typo in method name Struct::AddMemberName
David Neto [Sat, 1 Apr 2017 15:19:40 +0000 (11:19 -0400)]
Fix typo in method name Struct::AddMemberName

Also add a method comment for it.

7 years agoAvoid inlining calls to external functions
David Neto [Fri, 31 Mar 2017 14:36:58 +0000 (10:36 -0400)]
Avoid inlining calls to external functions

External functions don't have bodies to inline anyway.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/605

7 years agoopt::Function::cbegin and cend are const
David Neto [Fri, 31 Mar 2017 14:36:10 +0000 (10:36 -0400)]
opt::Function::cbegin and cend are const

7 years agoMention inliner in CHANGES
David Neto [Wed, 29 Mar 2017 21:11:51 +0000 (17:11 -0400)]
Mention inliner in CHANGES

7 years agoAdd low priority test suggestions for inliner
David Neto [Wed, 29 Mar 2017 21:11:16 +0000 (17:11 -0400)]
Add low priority test suggestions for inliner

7 years agoAdd exhaustive function call inlining to spirv-opt
Greg Fischer [Thu, 10 Nov 2016 17:11:50 +0000 (10:11 -0700)]
Add exhaustive function call inlining to spirv-opt

Inlining is done for all functions designated as entry points.

Add optional validation to test fixture method SinglePassRunAndCheck.

7 years agoAdd various accessors needed to read and edit SPIRV code.
David Srbecky [Sun, 26 Mar 2017 19:08:41 +0000 (20:08 +0100)]
Add various accessors needed to read and edit SPIRV code.

7 years agoSupport SPV_AMD_gcn_shader
David Neto [Tue, 21 Mar 2017 16:43:26 +0000 (12:43 -0400)]
Support SPV_AMD_gcn_shader

Supported in assembler, disassembler, and binary parser.

The validator does not check SPV_AMD_gcn_shader validation rules
beyond parsing the extension.

Adds generic support for generating instruction tables for vendor
extensions.

Adds generic support for extensions the validator should recognize
(but not check) but which aren't derived from the SPIR-V core
grammar file.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/594

7 years agoFix validator message for bad logical pointer
David Neto [Thu, 16 Mar 2017 20:13:47 +0000 (16:13 -0400)]
Fix validator message for bad logical pointer

Affects OpLoad and OpStore validation.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/588

7 years agoUpdate capability tests for SPV_KHR_16bit_storage rev 7
David Neto [Thu, 23 Mar 2017 19:46:08 +0000 (15:46 -0400)]
Update capability tests for SPV_KHR_16bit_storage rev 7

The SPIR-V core grammar file in a recent SPIRV-Headers
applied the fix from Rev 7 of SPV_KHR_16bit_storage:
FPRoundingMode enums are now enabled by the capabilities
introduced by that extension.

Update the SPIRV-Tools tests accordingly.

7 years agoDo nothing if trying to make the current dir
David Neto [Mon, 20 Mar 2017 15:23:35 +0000 (11:23 -0400)]
Do nothing if trying to make the current dir

7 years agospirv-val prints warnings
David Neto [Thu, 16 Mar 2017 19:19:51 +0000 (15:19 -0400)]
spirv-val prints warnings

Warnings and info messages go to stdout.
Errors still go to stderr.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/568

7 years agoAdd SpirvTools::Validate that takes an options object
David Neto [Thu, 16 Mar 2017 19:06:12 +0000 (15:06 -0400)]
Add SpirvTools::Validate that takes an options object

Add spvtools::ValidatorOptions RAII wrapper around
a spv_validator_options value.

7 years agoValidator dissallows unsupported Vulkan capability
Andrey Tuganov [Mon, 6 Mar 2017 22:21:25 +0000 (17:21 -0500)]
Validator dissallows unsupported Vulkan capability

If environment is SPV_ENV_VULKAN_1_0, disallow OpCapability operands
which are not supported by Vulkan 1.0.

See https://github.com/KhronosGroup/SPIRV-Tools/issues/572

7 years agoAutogenererating enum-string mappings from grammar
Andrey Tuganov [Wed, 15 Mar 2017 21:28:24 +0000 (17:28 -0400)]
Autogenererating enum-string mappings from grammar

Autogenerating the following code:
- extension enum
- extension-to-string
- string-to-extension
- capability-to-string

Capability mapping table will not compile if incomplete.
TODO: Use "spirv-latest-version.h" instead of 1.1.

Added function to generate capability tables for tests.

7 years agoValidator checks if operands require extension
Andrey Tuganov [Fri, 10 Mar 2017 20:58:15 +0000 (15:58 -0500)]
Validator checks if operands require extension

If required extension is not found, returning new error
SPV_ERROR_MISSING_EXTENSION.

7 years agoRefactored enum_set
Andrey Tuganov [Thu, 9 Mar 2017 23:24:35 +0000 (18:24 -0500)]
Refactored enum_set

- removed forgotten file enum_set.cpp
- added IsEmpty and HasAnyOf
- hidden unsafe functions Add(uint32_t), Contains(uint32_t)
- added new tests

7 years agoFix extension grammar parsing
Andrey Tuganov [Wed, 8 Mar 2017 18:51:20 +0000 (13:51 -0500)]
Fix extension grammar parsing

Extensions were not parsed correctly due to a typo in the Python script.

7 years agoValidator parses and registers OpExtension
Andrey Tuganov [Wed, 8 Mar 2017 18:59:01 +0000 (13:59 -0500)]
Validator parses and registers OpExtension

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.

7 years agoTest SPV_KHR_multiview in assembler, disassembler
David Neto [Fri, 27 Jan 2017 01:12:15 +0000 (20:12 -0500)]
Test SPV_KHR_multiview in assembler, disassembler

7 years agoTest SPV_KHR_device_group in assembler, disassembler
David Neto [Fri, 27 Jan 2017 01:05:01 +0000 (20:05 -0500)]
Test SPV_KHR_device_group in assembler, disassembler

7 years agoTest SPV_KHR_16bit_storage in assembler, disassembler
David Neto [Fri, 27 Jan 2017 01:02:24 +0000 (20:02 -0500)]
Test SPV_KHR_16bit_storage in assembler, disassembler

7 years agoTest SPV_KHR_subgroup_vote support in assembler, disassembler
David Neto [Thu, 26 Jan 2017 23:26:20 +0000 (18:26 -0500)]
Test SPV_KHR_subgroup_vote support in assembler, disassembler

7 years agoFix nullptr dereferencing in val_fixtures.cpp
Andrey Tuganov [Wed, 8 Mar 2017 17:06:31 +0000 (12:06 -0500)]
Fix nullptr dereferencing in val_fixtures.cpp

7 years agoChange Ids in tests to avoid confusion
David Neto [Tue, 7 Mar 2017 14:49:43 +0000 (09:49 -0500)]
Change Ids in tests to avoid confusion

The assembler assigns ID numbers sequentially, so it's confusing
to have a %1 in the source assembly when it isn't the first mentioned
ID.  Rewrite the ID names to avoid this situation in a few cases.

7 years agoValidate that SpecId decoration target is a OpSpecConstant instruction
Aliya Pazylbekova [Sat, 25 Feb 2017 01:43:28 +0000 (20:43 -0500)]
Validate that SpecId decoration target is a OpSpecConstant instruction
on a scalar

Fixes: https://github.com/KhronosGroup/SPIRV-Tools/issues/275

7 years agoValidator: unique type check allows runtime arrays
Andrey Tuganov [Thu, 2 Mar 2017 22:24:29 +0000 (17:24 -0500)]
Validator: unique type check allows runtime arrays

OpTypeRuntimeArray is an aggregate and therefore can have duplicate
declarations.

7 years agoUse OpenCL extinst definitions from SPIRV-Headers
David Neto [Wed, 1 Mar 2017 20:37:20 +0000 (15:37 -0500)]
Use OpenCL extinst definitions from SPIRV-Headers

Remove the local copy of that file.

7 years agoFixes issue #489.
Ehsan Nasiri [Fri, 27 Jan 2017 16:33:33 +0000 (11:33 -0500)]
Fixes issue #489.

From the SPIR-V Spec 2.16.1:

A function declaration (an OpFunction with no basic blocks), must have
a Linkage Attributes Decoration with the Import Linkage Type.

A function definition (an OpFunction with basic blocks) cannot be
decorated with the Import Linkage Type.

7 years agoAllow using FPRoundingMode when see VK_KHR_16bit_storage
Lei Zhang [Wed, 1 Mar 2017 20:51:44 +0000 (15:51 -0500)]
Allow using FPRoundingMode when see VK_KHR_16bit_storage

According to the extension, FPRoundingMode should be allowed to
use without requiring Kernel capability when VK_KHR_16bit_storage
is enabled.

7 years agoValidator: downgraded dupl type decl to warning
Andrey Tuganov [Wed, 1 Mar 2017 17:49:17 +0000 (12:49 -0500)]
Validator: downgraded dupl type decl to warning

Validator check for uniqueness of type declarations
(commit 0e9c24fdd112e7742b9b5dcff35aee32e71a66fd)
was causing failures in vulkancts tests.

Downgrading from error to warning.

7 years agoAdd a default virtual dtor to Pass and check for missing virtual dtors
Jean-Francois Roy [Tue, 28 Feb 2017 19:34:18 +0000 (11:34 -0800)]
Add a default virtual dtor to Pass and check for missing virtual dtors

7 years agoIssue 559: check type declaration uniqueness
Andrey Tuganov [Thu, 23 Feb 2017 21:07:52 +0000 (16:07 -0500)]
Issue 559: check type declaration uniqueness

Adds PassTypeUnique to the validator.
Disallows repeated declarations of all types except for aggregates.

7 years agoRefactored validation_state, added new types
Andrey Tuganov [Tue, 28 Feb 2017 16:53:47 +0000 (11:53 -0500)]
Refactored validation_state, added new types

- 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.

7 years agoAdd command line options struct for the validator
Ehsan Nasiri [Wed, 15 Feb 2017 18:29:33 +0000 (13:29 -0500)]
Add command line options struct for the validator

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.

7 years agoUpdate CHANGES for SPV_KHR_16bit_storage validator
David Neto [Tue, 28 Feb 2017 16:53:05 +0000 (11:53 -0500)]
Update CHANGES for SPV_KHR_16bit_storage validator

7 years agoValidation of type decls for SPV_KHR_16bit_storage
David Neto [Wed, 22 Feb 2017 23:10:05 +0000 (18:10 -0500)]
Validation of type decls for SPV_KHR_16bit_storage

Allow declaration of 16bit int or 16bit float in
the presence of capabilities from SPV_KHR_16bit_storage

7 years agoAdd a Feature struct to validation state.
David Neto [Wed, 22 Feb 2017 22:53:08 +0000 (17:53 -0500)]
Add a Feature struct to validation state.

For now, it is used only for checks of 16bit int and float types.

7 years agoFixes issue #548
Adam Van Ymeren [Wed, 15 Feb 2017 18:31:07 +0000 (13:31 -0500)]
Fixes issue #548

Add validation checks for the reserved OpImageSparseSampleProj* opcodes.

7 years agoCheck strict domination of merge block
David Neto [Thu, 9 Feb 2017 19:23:52 +0000 (14:23 -0500)]
Check strict domination of merge block

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.

7 years agoThe Signedness in OpTypeInt must always be 0.
Ehsan Nasiri [Thu, 9 Feb 2017 21:23:40 +0000 (16:23 -0500)]
The Signedness in OpTypeInt must always be 0.

When Kernel capability is used, The Signedness in OpTypeInt must always
be 0. Fixes issue #492.

7 years agoAdd vim-spirv plugin description to the README
Kenneth Benzie (Benie) [Wed, 1 Feb 2017 21:35:59 +0000 (21:35 +0000)]
Add vim-spirv plugin description to the README

Fixes #359

7 years agoEncourage use of the validator
David Neto [Fri, 27 Jan 2017 20:30:09 +0000 (15:30 -0500)]
Encourage use of the validator

7 years agoMaking the unit tests more robust.
Ehsan Nasiri [Mon, 23 Jan 2017 23:31:14 +0000 (18:31 -0500)]
Making the unit tests more robust.

It is best to check the error messages of unit tests that fail
validation. This will ensure that a validation failure is due to what we
expect and not due to some secondary reason.

Updating SPIR-V Validator unit tests with error message checks.

7 years agoFixes issue #497.
Ehsan Nasiri [Tue, 17 Jan 2017 20:10:43 +0000 (15:10 -0500)]
Fixes issue #497.

The Linkage Attributes Decoration cannot be applied to functions
targeted by an OpEntryPoint instruction.

7 years agoCheck BuiltIn Decoration rules.
Ehsan Nasiri [Mon, 16 Jan 2017 17:54:15 +0000 (12:54 -0500)]
Check BuiltIn Decoration rules.

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.

7 years agoFixes issue #532.
Ehsan Nasiri [Thu, 19 Jan 2017 16:03:04 +0000 (11:03 -0500)]
Fixes issue #532.

It is acceptable for OpAccessChain, OpInBoundsAccessChain,
OpPtrAccessChain, OpInBoundsPtrAccessChain, OpCompositeInsert, and
OpCompositeExtract to not take any indexes as arguments. In such cases,
no indexing will be done on the Base pointer/composite.

7 years agoFixes issue #493.
Ehsan Nasiri [Tue, 17 Jan 2017 21:28:59 +0000 (16:28 -0500)]
Fixes issue #493.

Check function call operands and return type agree with the called
function type.

The validation code exists. I have fixed the unit tests.

7 years agoValidation for decoration rules. Fixes issue #499.
Ehsan Nasiri [Fri, 13 Jan 2017 16:46:21 +0000 (11:46 -0500)]
Validation for decoration rules. Fixes issue #499.

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.