David Neto [Fri, 4 Aug 2017 21:48:22 +0000 (17:48 -0400)]
Update CHANGES with common uniform loads pass
GregF [Thu, 3 Aug 2017 16:37:26 +0000 (10:37 -0600)]
Update README.md with new code-reduction passes
GregF [Mon, 3 Jul 2017 23:23:04 +0000 (17:23 -0600)]
Add CommonUniformElim pass
- UniformElim: Only process reachable blocks
- UniformElim: Don't reuse loads of samplers and images across blocks.
Added a second phase which only reuses loads within a block for samplers
and images.
- UniformElim: Upgrade CopyObject skipping in GetPtr
- UniformElim: Add extensions whitelist
Currently disallowing SPV_KHR_variable_pointers because it doesn't
handle extended pointer forms.
- UniformElim: Do not process shaders with GroupDecorate
- UniformElim: Bail on shaders with non-32-bit ints.
- UniformElim: Document support for only single index and add TODO.
GregF [Thu, 27 Jul 2017 19:30:12 +0000 (13:30 -0600)]
Add MemPass, move all shared functions to it.
Andrey Tuganov [Mon, 24 Jul 2017 18:29:35 +0000 (14:29 -0400)]
Add multi-sequence move-to-front implementation
Add MultiMoveToFront class which supports multiple move-to-front
sequences and allows to promote value in all sequences at once.
Added caching for last accessed sequence handle and last accessed value
in each sequence.
David Neto [Tue, 1 Aug 2017 19:33:15 +0000 (15:33 -0400)]
Update CHANGES with recently added optimizations
GregF [Tue, 1 Aug 2017 18:55:29 +0000 (12:55 -0600)]
Opt: Add new size-reduction passes to usage message.
Andrey Tuganov [Mon, 31 Jul 2017 17:08:38 +0000 (13:08 -0400)]
Added C++ code generation to spirv-stats
The tool can now generate C++ code returning some of the historgrams and
Huffman codecs generated from those historgrams.
David Neto [Tue, 1 Aug 2017 15:42:28 +0000 (11:42 -0400)]
Add Appveyor config that uses VS 2017
GregF [Wed, 26 Jul 2017 22:34:41 +0000 (18:34 -0400)]
Opt: Delete names and decorations of dead instructions
Lei Zhang [Mon, 24 Jul 2017 15:43:47 +0000 (11:43 -0400)]
Opt: HasOnlySupportedRefs should consider OpCopyObject
This fixes test failure after merging the previous pull request.
Lei Zhang [Mon, 24 Jul 2017 14:37:38 +0000 (10:37 -0400)]
Revert "Revert "Opt: LocalBlockElim: Add HasOnlySupportedRefs""
This reverts commit
df96e243c633b939690a42d89904e04f50126e86.
GregF [Wed, 19 Jul 2017 00:57:26 +0000 (18:57 -0600)]
Add extension whitelists to size-reduction passes.
Currently only SPV_KHR_variable_pointers is disallowed in passes which
do pointer analysis. Positive and negative tests of the general extensions
mechanism were added to aggressive_dce but cover all passes.
Lei Zhang [Sat, 22 Jul 2017 14:48:28 +0000 (10:48 -0400)]
Revert "Opt: LocalBlockElim: Add HasOnlySupportedRefs"
This reverts commit
2d0f7fbc1151004c4cf111b947f1070a03dfe092.
greg-lunarg [Sat, 22 Jul 2017 14:32:19 +0000 (08:32 -0600)]
Opt: LocalBlockElim: Add HasOnlySupportedRefs
Verifies that targeted variables have only access chain and direct
loads and stores as references.
GregF [Tue, 18 Jul 2017 20:42:51 +0000 (14:42 -0600)]
Fix handling of CopyObject in GetPtr and its call sites
Lenny Komow [Thu, 13 Jul 2017 17:13:14 +0000 (11:13 -0600)]
Fix Visual Studio size_t cast compiler warning
Visual Studio was complaining about possible loss of data on 64-bit
builds, due to an implicit cast from size_t to int. This changes the
data to use an int with no cast.
Greg Fischer [Tue, 11 Jul 2017 22:52:19 +0000 (16:52 -0600)]
LocalMultiStore: Always put varId for backedge on loop phi function.
And always patch the backedge operand when patching phi functions. This
approach is more correct and cleaner. The previous code was generating
incorrect phis when the backedge block had no predecessors.
GregF [Mon, 10 Jul 2017 23:20:35 +0000 (17:20 -0600)]
DeadBranchElim: Improve algorithm to only remove blocks with no predecessors
Must be careful not to remove blocks pointed at by unreachable blocks
David Neto [Mon, 10 Jul 2017 15:45:59 +0000 (11:45 -0400)]
Minor code review feedback on AggressiveDCE
GregF [Thu, 8 Jun 2017 16:37:21 +0000 (10:37 -0600)]
Add AggressiveDCEPass
Create aggressive dead code elimination pass
This pass eliminates unused code from functions. In addition,
it detects and eliminates code which may have spurious uses but which do
not contribute to the output of the function. The most common cause of
such code sequences is summations in loops whose result is no longer used
due to dead code elimination. This optimization has additional compile
time cost over standard dead code elimination.
This pass only processes entry point functions. It also only processes
shaders with logical addressing. It currently will not process functions
with function calls. It currently only supports the GLSL.std.450 extended
instruction set. It currently does not support any extensions.
This pass will be made more effective by first running passes that remove
dead control flow and inlines function calls.
This pass can be especially useful after running Local Access Chain
Conversion, which tends to cause cycles of dead code to be left after
Store/Load elimination passes are completed. These cycles cannot be
eliminated with standard dead code elimination.
Additionally: This transform uses a whitelist of instructions that it
knows do have side effects, (a.k.a. combinators). It assumes other
instructions have side effects: it will not remove them, and assumes
they have side effects via their ID operands.
GregF [Fri, 16 Jun 2017 21:37:31 +0000 (15:37 -0600)]
Add LocalMultiStoreElim pass
A SSA local variable load/store elimination pass.
For every entry point function, eliminate all loads and stores of function
scope variables only referenced with non-access-chain loads and stores.
Eliminate the variables as well.
The presence of access chain references and function calls can inhibit
the above optimization.
Only shader modules with logical addressing are currently processed.
Currently modules with any extensions enabled are not processed. This
is left for future work.
This pass is most effective if preceeded by Inlining and
LocalAccessChainConvert. LocalSingleStoreElim and LocalSingleBlockElim
will reduce the work that this pass has to do.
GregF [Fri, 2 Jun 2017 19:23:20 +0000 (13:23 -0600)]
DeadBranchElim: Add DeadBranchElimPass
David Neto [Tue, 4 Jul 2017 20:24:46 +0000 (16:24 -0400)]
Include memory and semantics IDs when iterating over inbound IDs
Fixes Instruction::ForEachInId so it covers
SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID and SPV_OPERAND_TYPE_SCOPE_ID.
Future proof a bit by using the common spvIsIdType routine.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/697
Andrey Tuganov [Fri, 30 Jun 2017 18:59:24 +0000 (14:59 -0400)]
MARK-V decoder supports extended instructions
David Neto [Tue, 4 Jul 2017 16:27:31 +0000 (12:27 -0400)]
Update CHANGES to say we use GNUIntallDirs
d3x0r [Tue, 4 Jul 2017 13:11:40 +0000 (06:11 -0700)]
Define variable to skip installation
If this is used as a static library in another project, this does not
need to be installed, and otherwise will just clutter the application's install.
To use, define SKIP_SPIRV_TOOLS_INSTALL which internally defines
ENABLE_SPIRV_TOOLS_INSTALL to control installation.
Also include GNUInstallDirs to get standard output 'lib' directory which is sometimes 'lib64' and not 'lib'
Chris Forbes [Tue, 27 Jun 2017 23:28:22 +0000 (16:28 -0700)]
Convert pattern stack from deque to vector, and share it
Also move various vector::reserve calls to State ctor
Negligible perf benefit, but more tidy.
Andrey Tuganov [Thu, 29 Jun 2017 19:05:34 +0000 (15:05 -0400)]
Added fixed width encoding to bit_stream
Fixed width encoding is intended to be used for small unsigned integers
when the upper bound is known both to the encoder and the decoder
(for example move-to-front rank).
Andrey Tuganov [Wed, 31 May 2017 17:07:51 +0000 (13:07 -0400)]
Added compression tool tools/spirv-markv. Work in progress.
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.
Andrey Tuganov [Mon, 12 Jun 2017 16:01:39 +0000 (12:01 -0400)]
Added log(n) move-to-front implementation
The implementation is based on AVL and order statistic tree.
It accepts all kinds of values and the implementation
doesn't expect the behaviour to be consistent with id coding.
Intended by SPIR-V compression algorithms.
Andrey Tuganov [Thu, 25 May 2017 15:21:12 +0000 (11:21 -0400)]
Added Huffman codec to utils
Attached ids to Huffman nodes for deterministic internal node
comparison.
Lei Zhang [Tue, 27 Jun 2017 15:20:34 +0000 (11:20 -0400)]
Travis CI: stop requiring sudo and use make instead of ninja
This gives us shorter testing time since we can use the container
based testing environment, which starts faster. Also using make
means we don't need to install ninja separately.
Chris Forbes [Tue, 27 Jun 2017 21:21:33 +0000 (14:21 -0700)]
Don't do hash lookup twice in FindDef
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.
Chris Forbes [Tue, 27 Jun 2017 18:55:14 +0000 (11:55 -0700)]
Reserve expected length of instructions vector
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.
GregF [Wed, 7 Jun 2017 21:28:53 +0000 (15:28 -0600)]
BlockMerge: Add BlockMergePass
Also, add BasicBlock::tail()
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
Rex Xu [Wed, 21 Jun 2017 07:58:00 +0000 (15:58 +0800)]
Add support for SPV AMD extensions
GregF [Fri, 26 May 2017 16:33:11 +0000 (10:33 -0600)]
mem2reg: Add InsertExtractElimPass
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.
GregF [Fri, 19 May 2017 23:31:28 +0000 (17:31 -0600)]
mem2reg: Add LocalSingleStoreElimPass
Eliminate function scope variables with one store, if possible.
GregF [Thu, 18 May 2017 20:51:55 +0000 (14:51 -0600)]
mem2reg: Add pass to eliminate local loads and stores in single block.
rdb [Wed, 7 Jun 2017 10:14:31 +0000 (12:14 +0200)]
Don't install googletest and googlemock
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.
GabrÃel Arthúr Pétursson [Sat, 3 Jun 2017 23:08:22 +0000 (23:08 +0000)]
Fix memory leak in ValidateBinaryUsingContextAndValidationState
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.
Andrey Tuganov [Mon, 29 May 2017 17:26:46 +0000 (13:26 -0400)]
Fixed misspelled ctest flag --output_on_failure
rdb [Sun, 28 May 2017 21:19:58 +0000 (23:19 +0200)]
Support building on FreeBSD
Greg Fischer [Tue, 23 May 2017 17:31:56 +0000 (11:31 -0600)]
CFA: Move TraversalRoots and ComputeAugmentedCFG into CFA
Greg Fischer [Tue, 9 May 2017 00:32:12 +0000 (18:32 -0600)]
CFA: Pull in CalculateDominators
GregF [Wed, 17 May 2017 19:33:47 +0000 (13:33 -0600)]
DefUseManager: Fix ReplaceAllUsesWith() to update inst_to_used_ids_
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.
Lei Zhang [Wed, 17 May 2017 18:12:25 +0000 (14:12 -0400)]
Remove unused this in lambda capture
David Neto [Tue, 14 Mar 2017 16:43:41 +0000 (12:43 -0400)]
Add SPIR-V 1.2 support, for OpenCL 2.2
David Neto [Mon, 15 May 2017 15:55:22 +0000 (11:55 -0400)]
Fix size_t conversion error on MinGW
David Neto [Fri, 12 May 2017 21:35:18 +0000 (17:35 -0400)]
Update CHANGES: note fix of issue 629
Greg Fischer [Fri, 5 May 2017 02:55:53 +0000 (20:55 -0600)]
Inline: Inline early return function if no returns in loop.
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.
Andrey Tuganov [Thu, 4 May 2017 17:35:52 +0000 (13:35 -0400)]
Stats analyzer aggregates OpConstant usage
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).
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
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.
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
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.
Greg Fischer [Wed, 26 Apr 2017 00:07:35 +0000 (18:07 -0600)]
Inline: Change "--inline-entry-points-all" to "-exhaustive"
Greg Fischer [Tue, 25 Apr 2017 23:47:18 +0000 (17:47 -0600)]
Inline: Fix inliner description in usage message to reflect exceptions.
GregF [Tue, 25 Apr 2017 19:57:20 +0000 (13:57 -0600)]
Inline: Do not inline functions with multiple returns (for now)
qining [Wed, 19 Apr 2017 22:10:59 +0000 (18:10 -0400)]
Add bit pattern interface for setting default value for spec constants
David Neto [Thu, 20 Apr 2017 19:54:10 +0000 (15:54 -0400)]
Update CHANGES with recent news
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.
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
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
David Neto [Thu, 6 Apr 2017 15:04:09 +0000 (11:04 -0400)]
Test source language HLSL
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.
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.
David Neto [Mon, 20 Mar 2017 16:28:40 +0000 (12:28 -0400)]
Update cap tests for SPV_KHR_16bit_storage
David Neto [Wed, 8 Mar 2017 22:16:04 +0000 (17:16 -0500)]
Test asm,dis support for SPV_KHR_variable_pointers
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
Lei Zhang [Wed, 5 Apr 2017 21:32:39 +0000 (17:32 -0400)]
Group targets into folders
This plays nicer with IDEs.
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.
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
Lei Zhang [Mon, 3 Apr 2017 17:41:20 +0000 (13:41 -0400)]
Add /EHs for targets for MSVC
David Neto [Mon, 3 Apr 2017 18:59:18 +0000 (14:59 -0400)]
Fix spelling in SPV_AMD_gcn_shader support
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.
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
David Neto [Fri, 31 Mar 2017 14:36:10 +0000 (10:36 -0400)]
opt::Function::cbegin and cend are const
David Neto [Wed, 29 Mar 2017 21:11:51 +0000 (17:11 -0400)]
Mention inliner in CHANGES
David Neto [Wed, 29 Mar 2017 21:11:16 +0000 (17:11 -0400)]
Add low priority test suggestions for inliner
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.
David Srbecky [Sun, 26 Mar 2017 19:08:41 +0000 (20:08 +0100)]
Add various accessors needed to read and edit SPIRV code.
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
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
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.
David Neto [Mon, 20 Mar 2017 15:23:35 +0000 (11:23 -0400)]
Do nothing if trying to make the current dir
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
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.
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
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.