David Neto [Wed, 15 Nov 2017 18:37:52 +0000 (13:37 -0500)]
Git should ignore external repos
Ignore googletest, spirv-headers, effcee, and re2
Steven Perron [Mon, 13 Nov 2017 20:31:43 +0000 (15:31 -0500)]
Add the decoration manager to the IRContext.
To make the decoration manger available everywhere, and to reduce the
number of times it needs to be build, I add one the IRContext.
As the same time, I move code that modifies decoration instruction into
the IRContext from mempass and the decoration manager. This will make
it easier to keep everything up to date.
This should take care of issue #928.
Alan Baker [Wed, 8 Nov 2017 21:22:10 +0000 (16:22 -0500)]
Initial implementation of merge return pass.
Works with current DefUseManager infrastructure.
Added merge return to the standard opts.
Added validation to passes.
Disabled pass for shader capabilty.
Lei Zhang [Tue, 14 Nov 2017 14:18:42 +0000 (09:18 -0500)]
Appveyor: skip building tags
Lei Zhang [Mon, 13 Nov 2017 19:55:20 +0000 (14:55 -0500)]
Appveyor: Stop testing VS 2013/2015 Debug
VS2017 Debug tests should suffice for intresting Debug cases.
This will save us ~30min of waiting time for each build job.
Diego Novillo [Fri, 10 Nov 2017 14:39:00 +0000 (09:39 -0500)]
Add analysis to compute mappings between instructions and basic blocks.
This analysis builds a map from instructions to the basic block that
contains them. It is accessed via get_instr_block(). Once built, it is kept
up-to-date by the IRContext, as long as instructions are removed via
KillInst.
I have not yet marked passes that preserve this analysis. I will do it
in a separate change.
Other changes:
- Add documentation about analysis values requirement to be powers of 2.
- Force a re-build of the def-use manager in tests.
- Fix AllPreserveFirstOnlyAfterPassWithChange to use the
DummyPassPreservesFirst pass.
- Fix sentinel value for IRContext::Analysis enum.
- Fix logic for checking if the instr<->block mapping is valid in KillInst.
Daniel Schürmann [Tue, 24 Oct 2017 16:28:18 +0000 (18:28 +0200)]
Fix decorations of inlined functions.
Fixes issue #728. Currently the inliner is not generating decorations for
inlined code which corresponds to function code which has decorations. An
example of decorations that are relevant: RelaxedPrecision, NoContraction.
The solution is to replicate the decoration during inlining.
David Neto [Wed, 8 Nov 2017 05:23:42 +0000 (00:23 -0500)]
Tests: Add optional dependency on Effcee stateful matcher
Add Effcee as an optional dependency for use in tests. In future it will
be a required dependency.
Effcee is a stateful pattern matcher that has much of the functionality
of LLVM's FileCheck, except in library form. Effcee makes it much easier
to write tests for optimization passes.
Demonstrate its use in a test for the strength-reduction pass.
Update README.md with example commands of how to get sources.
Update Appveyor and Travis-CI build rules.
Also: Include test libraries if not SPIRV_SKIP_TESTS
- SPIRV_SKIP_TESTS is implied by SPIRV_SKIP_EXECUTABLES
Steven Perron [Thu, 9 Nov 2017 16:24:41 +0000 (11:24 -0500)]
Have all MemPasses preserve the def-use manager.
Originally the passes that extended from MemPass were those that are
of the def-use manager. I am assuming they would be able to preserve
it because of that.
Added a check to verify consistency of the IRContext. The IRContext
relies on the pass to tell it if something is invalidated.
It is possible that the pass lied. To help identify those situations,
we will check if the valid analyses are correct after each pass.
This will be enabled by default for the debug build, and disabled in the
production build. It can be disabled in the debug build by adding
"-DSPIRV_CHECK_CONTEXT=OFF" to the cmake command.
Lei Zhang [Thu, 9 Nov 2017 00:41:17 +0000 (19:41 -0500)]
Travis: auto deploy build artifacts to GitHub Releases
Pushing a commit to the master branch will trigger a build on
Travis. If the build is successful, the artifacts will be
collected and pushed to GitHub Releases, under the "master-tot"
release.
Lei Zhang [Wed, 8 Nov 2017 21:44:53 +0000 (16:44 -0500)]
Appveyor: auto deploy build artifacts to GitHub Releases
Pushing a commit to the master branch will trigger a build on
Appveyor. If the build is successful, the artifacts will be
collected and pushed to GitHub Releases, under the "master-tot"
release.
Diego Novillo [Wed, 8 Nov 2017 17:40:02 +0000 (12:40 -0500)]
Re-format files in source, source/opt, source/util, source/val and tools.
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')
Steven Perron [Thu, 2 Nov 2017 18:25:48 +0000 (14:25 -0400)]
Add the IRContext (part 2): Add def-use manager
This change will move the instances of the def-use manager to the
IRContext. This allows it to persists across optimization, and does
not have to be rebuilt multiple times.
Added test to ensure that the IRContext is validating and invalidating
the analyses correctly.
GregF [Mon, 6 Nov 2017 18:25:24 +0000 (11:25 -0700)]
Opt: Fix HasLoads to not report decoration as load.
GregF [Tue, 7 Nov 2017 00:00:44 +0000 (17:00 -0700)]
Opt: Remove CommonUniformElimination from -O and -Os (for now)
It is causing crashes for some drivers. Will try to re-enable it once
existing drivers are able to deal better with it.
David Neto [Wed, 4 Oct 2017 21:02:39 +0000 (17:02 -0400)]
Describe public_spirv_tools_dev@khronos.org mailing list
Nuno Subtil [Wed, 1 Nov 2017 03:08:23 +0000 (20:08 -0700)]
Validate storage class of target pointer for OpStore
Diego Novillo [Thu, 2 Nov 2017 15:51:07 +0000 (11:51 -0400)]
Move class CFG from namespace opt to namespace ir.
It makes more sense to have the CFG inside the ir name space, as it is
descriptive of the representation.
Diego Novillo [Mon, 30 Oct 2017 21:42:26 +0000 (17:42 -0400)]
Add a new class opt::CFG to represent the CFG for the module.
This class moves some of the CFG-related functionality into a new
class opt::CFG. There is some other code related to the CFG in the
inliner and in opt::LocalSingleStoreElimPass that should also be moved,
but that require more changes than this pure restructuring.
I will move those bits in a follow-up PR.
Currently, the CFG is computed every time a pass is instantiated, but
this should be later moved to the new IRContext class that @s-perron is
working on.
Other re-factoring:
- Add BasicBlock::ContinueBlockIdIfAny. Re-factored out of MergeBlockIdIfAny
- Rewrite IsLoopHeader in terms of GetLoopMergeInst.
- Run clang-format on some files.
Steven Perron [Mon, 30 Oct 2017 15:13:24 +0000 (11:13 -0400)]
Add the IRContext (part 1)
This is the first part of adding the IRContext. This class is meant to
hold the extra data that is build on top of the module that it
owns.
The first part will simply create the IRContext class and get it passed
to the passes in place of the module. For now it does not have any
functionality of its own, but it acts more as a wrapper for the module.
The functions that I added to the IRContext are those that either
traverse the headers or add to them. I did this because we may decide
to have other ways of dealing with these sections (for example adding a
type pool, or use the decoration manager).
I also added the function that add to the header because the IRContext
needs to know when an instruction is added to update other data
structures appropriately.
Note that there is still lots of work that needs to be done. There are
still many places that change the module, and do not inform the context.
That will be the next step.
Nuno Subtil [Thu, 26 Oct 2017 20:20:32 +0000 (13:20 -0700)]
Add validation for OpBranchConditional
Andrey Tuganov [Mon, 30 Oct 2017 17:17:58 +0000 (13:17 -0400)]
Lowered initial capacity of move-to-front sequence
Also fixed outdated comments.
Steven Perron [Mon, 30 Oct 2017 19:31:19 +0000 (15:31 -0400)]
Fix copyright check when the build directory is in the source directory.
The IDE I am using places the cmake build directory inside the source
directory. When that happens the copyright check fails because the
build process creates a file CMakeCXXCompilerId.cpp. That file does
not have the copyright information, so the test fails.
I want this file to be ignored, so I added its directory, CompilerIdCXX,
to the list of directories to be ignored.
GregF [Tue, 17 Oct 2017 22:33:43 +0000 (16:33 -0600)]
ADCE: Dead if elimination
Mark structured conditional branches live only if one or more instructions
in their associated construct is marked live. After closure, replace dead
structured conditional branches with a branch to its merge and remove
dead blocks.
ADCE: Dead If Elim: Remove duplicate StructuredOrder code
Also generalize ComputeStructuredOrder so that the caller can specify the
root block for the order. Phi insertion uses pseudo_entry_block and adce and
dead branch elim use the first block of the function.
ADCE: Dead If Elim: Pull redundant code out of InsertPhiInstructions
ADCE: Dead If Elim: Encapsulate CFG Cleanup Initialization
ADCE: Dead If Elim: Remove redundant code from ADCE initialization
ADCE: Dead If: Use CFGCleanup to eliminate newly dead blocks
Moved bulk of CFG Cleanup code into MemPass.
Diego Novillo [Mon, 30 Oct 2017 13:02:03 +0000 (09:02 -0400)]
More re-factoring to simplify pass initialization.
This implements two cleanups suggested by @s-perron
(https://github.com/KhronosGroup/SPIRV-Tools/pull/921):
- Move FindNamedOrDecoratedIds() into MemPass::InitializeProcessing().
- Remove FinalizeNextId(). Always call SetIdBound() from
Pass::TakeNextId().
Steven Perron [Tue, 24 Oct 2017 19:13:13 +0000 (15:13 -0400)]
Add option to relax validation of store types.
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.
Andrey Tuganov [Fri, 27 Oct 2017 15:31:39 +0000 (11:31 -0400)]
Compression: removed 'presumed index' feature
The feature used to improve compression of const integers which were
presumed to be indices. Now obsolete as descriptor-based compression
does this in a more generalized way.
Jesus Carabano [Fri, 27 Oct 2017 12:28:50 +0000 (15:28 +0300)]
Use std::lower_bound for opcode lookup
Use std::lower_bound for opcode-to-string
Stable sort the generated instruction table.
Diego Novillo [Wed, 25 Oct 2017 17:26:25 +0000 (13:26 -0400)]
Re-factor Phi insertion code out of LocalMultiStoreElimPass
Including a re-factor of common behaviour into class Pass:
The following functions are now in class Pass:
- IsLoopHeader.
- ComputeStructuredOrder
- ComputeStructuredSuccessors (annoyingly, I could not re-factor all
instances of this function, the copy in common_uniform_elim_pass.cpp
is slightly different and fails with the common implementation).
- GetPointeeTypeId
- TakeNextId
- FinalizeNextId
- MergeBlockIdIfAny
This is a NFC (non-functional change)
Steven Perron [Fri, 13 Oct 2017 18:25:21 +0000 (14:25 -0400)]
Change the sections in the module to use the InstructionList class.
This change will replace a number of the
std::vector<std::unique_ptr<Instruction>> member of the module to
InstructionList. This is for consistency and to make it easier to
delete instructions that are no longer needed.
Lei Zhang [Wed, 25 Oct 2017 16:15:51 +0000 (12:15 -0400)]
Turn all function static non-POD variables into global POD variables
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.
Józef Kucia [Fri, 13 Oct 2017 19:53:58 +0000 (21:53 +0200)]
Validate SpvOpVectorShuffle
Jesus Carabano [Sat, 21 Oct 2017 16:39:32 +0000 (19:39 +0300)]
restrict opcodes targeting OpDecorationGroup
Daniel Schürmann [Tue, 24 Oct 2017 11:24:08 +0000 (13:24 +0200)]
Fixed --eliminate-common-uniform so that it does not eliminate loads of volatile variables.
David Neto [Mon, 23 Oct 2017 14:53:28 +0000 (10:53 -0400)]
Optimizer: Line and NoLine are not debug1 or debug2
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/911
Andrey Tuganov [Tue, 17 Oct 2017 21:38:04 +0000 (17:38 -0400)]
Refactored compression debugger
Markv codec now receives two optional callbacks:
LogConsumer for internal codec logging
DebugConsumer for testing if encoding->decoding produces the original
results.
Steven Perron [Mon, 23 Oct 2017 19:48:29 +0000 (15:48 -0400)]
Run dead variable elimination when using -O and -Os
We want to run the optimization when using -O and -Os, but it was not
added at part of https://github.com/KhronosGroup/SPIRV-Tools/pull/905.
This change will add that a well as some minor formatting changes
requested in that same pull request.
GregF [Mon, 16 Oct 2017 23:30:52 +0000 (17:30 -0600)]
DeadBranchElim: Fix dead block elimination
The previous algorithm would leave invalid code in the case of unreachable
blocks pointing into a dead branch. It would leave the unreachable blocks
branching to labels that no longer exist. The previous algorithm also left
unreachable blocks in some cases (a loop following an orphaned merge block).
This fix also addresses that.
This code will soon be replaced with the coming CFG cleanup.
Steven Perron [Fri, 20 Oct 2017 16:17:41 +0000 (12:17 -0400)]
Add pass to remove dead variables at the module level.
There does not seem to be any pass that remove global variables. I
think we could use one. This pass will look specifically for global
variables that are not referenced and are not exported. Any decoration
associated with the variable will also be removed. However, this could
cause types or constants to become unreferenced. They will not be
removed. Another pass will have to be called to remove those.
David Neto [Fri, 20 Oct 2017 22:04:20 +0000 (18:04 -0400)]
Optimizer: OpModuleProcessed is in its own layout section
This is a recent decision from the SPIR WG. The spec update
has not yet been published.
Khronos SPIR-V internal issue 199
Andrey Tuganov [Thu, 19 Oct 2017 20:02:47 +0000 (16:02 -0400)]
Add Android.mk build to Travis CI
Added NDK_LIBS_OUT
Andrey Tuganov [Fri, 20 Oct 2017 18:34:32 +0000 (14:34 -0400)]
Added dummy android test application
The application is needed to test Android.mk build.
David Neto [Fri, 20 Oct 2017 20:51:20 +0000 (16:51 -0400)]
Fix cfg_cleanup.cpp. My bad.
David Neto [Thu, 19 Oct 2017 19:56:23 +0000 (15:56 -0400)]
Remove coding redundancy in cfg_cleanup_pass.cpp
Andrey Tuganov [Fri, 20 Oct 2017 18:38:50 +0000 (14:38 -0400)]
Add instruction_list to Android.mk
Andrey Tuganov [Thu, 28 Sep 2017 18:53:24 +0000 (14:53 -0400)]
Add validation pass for conversion instructions
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.
Steven Perron [Fri, 13 Oct 2017 18:25:21 +0000 (14:25 -0400)]
Change BasicBlock to use InstructionList to hold instructions.
This is the first step in replacing the std::vector of Instruction
pointers to using and intrusive linked list.
To this end, we created the InstructionList class. It inherites from
the IntrusiveList class, but add the extra concept of ownership. An
InstructionList owns the instruction that are in it. This is to be
consistent with the current ownership rules where the vector owns the
instruction that are in it.
The other larger change is that the inst_ member of the BasicBlock class
was changed to using the InstructionList class.
Added test for the InsertBefore functions, and making sure that the
InstructionList destructor will delete the elements that it contains.
I've also add extra comments to explain ownership a little better.
Andrey Tuganov [Thu, 19 Oct 2017 17:00:52 +0000 (13:00 -0400)]
Removed todos from validate_id.cpp
Removed todos for validation of opcodes handles in other passes.
David Neto [Thu, 12 Oct 2017 16:21:26 +0000 (12:21 -0400)]
DeadBranchElim: Slightly more defensive coding
David Neto [Thu, 19 Oct 2017 19:22:02 +0000 (15:22 -0400)]
The reviewed cfg_cleanup optimize pass
Diego Novillo [Wed, 6 Sep 2017 12:56:41 +0000 (08:56 -0400)]
CFG cleanup pass - Remove unreachable blocks.
- Adds a new pass CFGCleanupPass. This serves as an umbrella pass to
remove unnecessary cruft from a CFG.
- Currently, the only cleanup operation done is the removal of
unreachable basic blocks.
- Adds unit tests.
- Adds a flag to spirvopt to execute the pass (--cfg-cleanup).
David Neto [Wed, 18 Oct 2017 14:28:12 +0000 (10:28 -0400)]
Android.mk: add source/opt/fold.cpp
Diego Novillo [Wed, 18 Oct 2017 12:37:00 +0000 (08:37 -0400)]
Merge pull request #885 from dnovillo/const-prop
Re-factor generic constant folding code out of fold spec constants pass
Diego Novillo [Tue, 17 Oct 2017 23:41:37 +0000 (19:41 -0400)]
Re-factor generic constant folding code out of FoldSpecConstantOpAndCompositePass
There are no functional changes in this patch. The generic folding
routines in FoldSpecConstantOpAndCompositePass are now inside opt/fold.{cpp,h}.
This code will be used by the upcoming constant propagation pass. In
time, we'll add more expression folding and simplification into these
two files.
GregF [Tue, 10 Oct 2017 20:35:53 +0000 (14:35 -0600)]
ADCE: Treat privates like locals in entry point with no calls
This is needed for ongoing legalization of HLSL. It allows removal
of accesses to textures/buffers that are not used.
GregF [Tue, 10 Oct 2017 23:16:50 +0000 (17:16 -0600)]
Opt: Move *NextId functionality into MemPass
David Neto [Thu, 12 Oct 2017 19:20:29 +0000 (15:20 -0400)]
Validator: Test OpReturnValue type check
The check already existed. I added a test for it.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/876
Andrey Tuganov [Wed, 11 Oct 2017 15:34:38 +0000 (11:34 -0400)]
Reenable validate type unique pass
Vulkan CTS patch fixing the instances of non-unique type declaration in
autogenerated code has recently been submitted.
Andrey Tuganov [Tue, 3 Oct 2017 21:36:37 +0000 (17:36 -0400)]
Refactored MARK-V API
- switched from C to C++
- moved MARK-V model creation from backend to frontend
- The same MARK-V model object can be used to encode/decode multiple
files
- Added MARK-V model factory (currently only one option)
- Added --validate option to spirv-markv (run validation while
encoding/decoding)
Andrey Tuganov [Wed, 11 Oct 2017 22:13:21 +0000 (18:13 -0400)]
Validator checks OpReturn called from void func
Added check into validate_cfg which checks that OpReturn is not called
from functions which are supposed to return a value.
Steven Perron [Tue, 10 Oct 2017 13:47:01 +0000 (09:47 -0400)]
Generic intrusive linked list class.
This commit is the initial implementation of the intrusive linked list
class. It includes the implementation in the header files, and unit
test.
The iterators are circular: incrementing end() gives begin() and
decrementing begin() gives end(). Also made it valid to
decrement end().
Expliticly defines move constructor and move assignment
- Visual Studio 2013 does not implicitly generate the move constructor or
move assignments. So they need to be explicit, otherwise it will try to
use the copy constructor, which we explicitly deleted.
- Can't use "= default" either.
Seems like VS2013 does not support explicitly using the default move
constructors and move assignments, so I wrote them out.
GregF [Fri, 6 Oct 2017 02:37:00 +0000 (20:37 -0600)]
DeadBranchElim: Add dead case elimination
Expands dead branch elimination to eliminate dead switch cases. It also
changes dbe to eliminate orphaned merge blocks and recursively eliminate
any blocks thereby orphaned.
Andrey Tuganov [Thu, 5 Oct 2017 23:07:31 +0000 (19:07 -0400)]
Add Android.mk to SPIRV-Tools
Android.mk was migrated from shaderc/third_party.
android_test is a stub, only builds spirv-tools libs.h to test build.
Diego Novillo [Wed, 30 Aug 2017 18:19:22 +0000 (14:19 -0400)]
Add -O, -Os and -Oconfig flags.
These flags are expanded to a series of spirv-opt flags with the
following semantics:
-O: expands to passes that attempt to improve the performance of the
generated code.
-Os: expands to passes that attempt to reduce the size of the generated
code.
-Oconfig=<file> expands to the sequence of passes determined by the
flags specified in the user-provided file.
Tim Diekmann [Tue, 10 Oct 2017 12:23:42 +0000 (14:23 +0200)]
Set cmake-policy CMP0048 to NEW
Pierre Moreau [Thu, 13 Jul 2017 00:16:51 +0000 (02:16 +0200)]
Implement Linker (module combiner)
Add extra iterators for ir::Module's sections
Add extra getters to ir::Function
Add a const version of BasicBlock::GetLabelInst()
Use the max of all inputs' version as version
Split debug in debug1 and debug2
- Debug1 instructions have to be placed before debug2 instructions.
Error out if different addressing or memory models are found
Exit early if no binaries were given
Error out if entry points are redeclared
Implement copy ctors for Function and BasicBlock
- Visual Studio ends up generating copy constructors that call deleted
functions while compiling the linker code, while GCC and clang do not.
So explicitly write those functions to avoid Visual Studio messing up.
Move removing duplicate capabilities to its own pass
Add functions running on all IDs present in an instruction
Remove duplicate SpvOpExtInstImport
Give default options value for link functions
Remove linkage capability if not making a library
Check types before allowing to link
Detect if two types/variables/functions have different decorations
Remove decorations of imported variables/functions and their types
Add a DecorationManager
Add a method for removing all decorations of id
Add methods for removing operands from instructions
Error out if one of the modules has a non-zero schema
Update README.md to talk about the linker
Do not freak out if an imported built-in variable has no export
Andrey Tuganov [Thu, 5 Oct 2017 20:26:09 +0000 (16:26 -0400)]
Remove duplicate dead branch elim pass declaration
The function had two declarations in the same header with somewhat
different comments.
Andrew Woloszyn [Thu, 5 Oct 2017 15:01:34 +0000 (11:01 -0400)]
Hack around bug in gcc-4.8.1 templates.
This keeps the previous behavior for other compilers that will
throw warnings on a negative shift operation, but works around
the internal compiler error in GCC.
GregF [Fri, 29 Sep 2017 22:22:39 +0000 (16:22 -0600)]
AggressiveDCE: Fix to not treat parameter memory refs as local
This fixes a bug that incorrectly deletes stores to parameters, which
can be used to return values from functions.
Pierre Moreau [Sun, 1 Oct 2017 19:47:44 +0000 (21:47 +0200)]
Compact-ids pass should update the header ID bound
David Neto [Sun, 1 Oct 2017 13:27:00 +0000 (09:27 -0400)]
DiagnosticStream move ctor moves output duties to new object
- Take over contents of the expiring message stream
- Prevent the expiring object from emitting anything during destruction
David Neto [Thu, 28 Sep 2017 15:14:00 +0000 (11:14 -0400)]
Cache end iterators for speed
Helps scaling of DefUseManager on modules with many thousands
of instructions.
jcaraban [Fri, 29 Sep 2017 05:55:41 +0000 (08:55 +0300)]
No use to check OpBitCount result width
Lei Zhang [Thu, 28 Sep 2017 01:22:05 +0000 (21:22 -0400)]
Skip checking copyright if SPIRV_SKIP_TESTS is enabled
David Neto [Wed, 27 Sep 2017 14:03:20 +0000 (10:03 -0400)]
Update CHANGES to reflect fix for #827
David Neto [Tue, 26 Sep 2017 22:05:27 +0000 (18:05 -0400)]
Compact-ids pass should update instruction's result_id member
Also update the result type field.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/827
Lei Zhang [Tue, 26 Sep 2017 17:55:23 +0000 (13:55 -0400)]
Remove duplicated declaration of CreateAggressiveDCEPass().
Andrey Tuganov [Mon, 18 Sep 2017 20:49:11 +0000 (16:49 -0400)]
Add bitwise operations validator pass
The pass checks correctness of operand types of all bitwise instructions
(opcode range from SpvOpShiftRightLogical to SpvOpBitCount).
Andrey Tuganov [Mon, 18 Sep 2017 17:06:40 +0000 (13:06 -0400)]
Add remaining opcodes to arithmetics validation
Add validation rules for:
- OpIAddCarry
- OpISubBorrow
- OpUMulExtended
- OpSMulExtended
Includes some refactoring of old code.
David Neto [Tue, 26 Sep 2017 15:30:57 +0000 (11:30 -0400)]
Update CHANGES with recent news
Steven Perron [Tue, 19 Sep 2017 14:12:13 +0000 (10:12 -0400)]
Create the dead function elimination pass
Creates a pass called eliminate dead functions that looks for functions
that could never be called, and deletes them from the module.
To support this change a new function was added to the Pass class to
traverse the call trees from diffent starting points.
Includes a test to ensure that annotations are removed when deleting a
dead function. They were not, so fixed that up as well.
Did some cleanup of the assembly for the test in pass_test.cpp. Trying
to make them smaller and easier to read.
Andrey Tuganov [Mon, 25 Sep 2017 18:55:44 +0000 (14:55 -0400)]
Detach MARK-V from the validator
MARK-V codec was previously dependent on the validation state.
Now it doesn't need the validator to function, but can still optionally
create it and validate every instruction once it's decoded.
Lei Zhang [Thu, 21 Sep 2017 21:24:57 +0000 (17:24 -0400)]
Avoid using global static variables
Previously we have several grammar tables defined as global static
variables and these grammar table entries contains non-POD struct
fields (CapabilitySet/ExtensionSet). The initialization of these
non-POD struct fields may require calling operator new. If used
as a library and the caller defines its own operator new, things
can screw up.
This pull request changes all global static variables into
function static variables, which is lazy evaluated in a thread
safe way as guaranteed by C++11.
Andrey Tuganov [Mon, 25 Sep 2017 16:45:48 +0000 (12:45 -0400)]
Add SPIRV_SPIRV_COMPRESSION option to cmake
The option is off by default.
cmake -DSPIRV_BUILD_COMPRESSION=ON ..
enables the compression lib, executable, and test build.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/834
Ehsan [Thu, 21 Sep 2017 22:50:09 +0000 (18:50 -0400)]
Merge pull request #829 from atgoo/fix_val_logicals
Validator: fix logicals pass for OpSelect pointers
Andrey Tuganov [Thu, 21 Sep 2017 20:12:14 +0000 (16:12 -0400)]
Validator: fix logicals pass for OpSelect pointers
OpSelect works with pointers also when capability
VariablePointersStorageBuffer is declared (before worked only with
capability VariablePointers).
David Neto [Wed, 20 Sep 2017 15:07:55 +0000 (11:07 -0400)]
elim-multi-store: only patch loop header phis that we created
There can already be OpPhi instructions in a loop header that
are unrelated to the optimization. We should not be patching those.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/826
Andrey Tuganov [Thu, 7 Sep 2017 21:27:57 +0000 (17:27 -0400)]
Add validate logicals pass to the validator
New pass checks operands of all instructions listed under
3.32.15. Relational and Logical Instructions
Andrey Tuganov [Mon, 18 Sep 2017 21:07:00 +0000 (17:07 -0400)]
Refactored validate_aritmetics.cpp
Improved error messages and readability.
Andrey Tuganov [Wed, 6 Sep 2017 20:44:15 +0000 (16:44 -0400)]
Updated markv_autogen
- now includes a table of all descriptors with coding scheme
(improves performance by 5% by allowing to avoid creation of
move-to-front sequences which will never be used)
- increased the size of markv_autogen.inc, clang doesn't seem
to have the long compilation time problem now
(probably was inadvertently fixed by using Huffman codec
serialization)
Greg Fischer [Tue, 19 Sep 2017 19:47:28 +0000 (13:47 -0600)]
ElimLocalMultiStore: Reset structured successors for each function
Steven Perron [Fri, 8 Sep 2017 16:08:03 +0000 (12:08 -0400)]
Add strength reduction; for now replace multiply by power of 2
Create a new optimization pass, strength reduction, which will replace
integer multiplication by a constant power of 2 with an equivalent bit
shift. More changes could be added later.
- Does not duplicate constants
- Adds vector |Concat| utility function to a common test header.
GregF [Wed, 13 Sep 2017 00:15:09 +0000 (18:15 -0600)]
ExtractInsert: Handle rudimentary CompositeConstruct and ConstantComposite
This optimizes a single index extract whose composite value terminates with a
CompositeConstruct (or ConstantComposite) by evaluating to the correct
component. This was needed for opaque legalization.
This highlights the need/opportunity to improve this optimization to deal
with more complex composite expressions including currently handled ops
plus Null ops and special vector composition. A TODO has been added.
David Neto [Thu, 14 Sep 2017 14:35:22 +0000 (10:35 -0400)]
Recognize SPV_AMD_shader_fragment_mask
Andrey Tuganov [Wed, 6 Sep 2017 18:30:27 +0000 (14:30 -0400)]
Add new checks to validate arithmetics pass
New operations:
- OpDot
- OpVectorTimesScalar
- OpMatrixTimesScalar
- OpVectorTimesMatrix
- OpMatrixTimesVector
- OpMatrixTimesMatrix
- OpOuterProduct
David Neto [Fri, 8 Sep 2017 13:16:15 +0000 (09:16 -0400)]
Update CHANGES for OpModuleProcessed validation rule
David Neto [Thu, 7 Sep 2017 21:38:31 +0000 (17:38 -0400)]
validator: OpModuleProcessed allowed in layout section 7c
Recent spec fix from SPIR Working group:
Allow OpModuleProcessed after debug names, but before any
annotation instructions.
Andrey Tuganov [Wed, 9 Aug 2017 18:01:12 +0000 (14:01 -0400)]
Update MARK-V to version 1.01
Includes:
- Multi-sequence move-to-front
- Coding by id descriptor
- Statistical coding of non-id words
- Joint coding of opcode and num_operands
Removed explicit form Huffman codec constructor
- The standard use case for it is to be constructed from initializer list.
Using serialization for Huffman codecs
David Neto [Fri, 1 Sep 2017 22:12:15 +0000 (18:12 -0400)]
spirv-as: Fail for unrecognized long option
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/798
David Neto [Sat, 2 Sep 2017 23:01:03 +0000 (19:01 -0400)]
Inliner: Fix LoopMerge when inline into loop header of multi block loop
This adapts the fix for the single-block loop. Split the loop like
before. But when we move the OpLoopMerge back to the loop header,
redirect the continue target only when the original loop was a single
block loop.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/800