Andrey Tuganov [Wed, 22 Nov 2017 21:57:37 +0000 (16:57 -0500)]
Validate OpTypeImage and OpTypeSampleImage
Added new validation rules to the validate image pass.
Daniel Schürmann [Wed, 29 Nov 2017 13:38:27 +0000 (14:38 +0100)]
Linker: Fix incorrect exit status.
Steven Perron [Fri, 24 Nov 2017 14:33:18 +0000 (09:33 -0500)]
Create CONTRIBUTING.md
This is intended to be a document that people who want to help the project
can get a quick overview of how things are done. Please comment and suggest
any changes.
GregF [Tue, 28 Nov 2017 23:18:05 +0000 (16:18 -0700)]
AggressiveDCE: Add merge and continue branches for live loop.
This ensures that an if-break is not eliminated from a loop.
This fixes issue #989
Lei Zhang [Mon, 27 Nov 2017 22:51:18 +0000 (17:51 -0500)]
Update README about the automatic master-tot relase
Diego Novillo [Mon, 27 Nov 2017 19:20:32 +0000 (14:20 -0500)]
Convert the CFG to an on-demand analysis - NFC.
This fixes some TODOs by moving the CFG into the IRContext as an
analysis.
Diego Novillo [Tue, 28 Nov 2017 13:27:10 +0000 (08:27 -0500)]
Fix windows build. unsigned vs signed comparison in EXPECT_EQ.
Diego Novillo [Fri, 17 Nov 2017 13:59:25 +0000 (08:59 -0500)]
Generic value propagation engine.
This class implements a generic value propagation algorithm based on the
conditional constant propagation algorithm proposed in
Constant propagation with conditional branches,
Wegman and Zadeck, ACM TOPLAS 13(2):181-210.
The implementation is based on
A Propagation Engine for GCC
Diego Novillo, GCC Summit 2005
http://ols.fedoraproject.org/GCC/Reprints-2005/novillo-Reprint.pdf
The purpose of this implementation is to act as a common framework for any
transformation that needs to propagate values from statements producing new
values to statements using those values.
Diego Novillo [Mon, 27 Nov 2017 19:40:03 +0000 (14:40 -0500)]
Fix windows build.
This fixes the lack of uint32_t definition in source/val/decoration.h.
Diego Novillo [Mon, 27 Nov 2017 15:16:41 +0000 (10:16 -0500)]
Re-format source tree - NFC.
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.
Andrey Tuganov [Fri, 24 Nov 2017 15:29:05 +0000 (10:29 -0500)]
Derivative opcodes require Fragment exec model
Added validator check that all derivative opcodes require Fragment
execution model.
Andrey Tuganov [Fri, 24 Nov 2017 15:55:05 +0000 (10:55 -0500)]
Relaxed OpImageWrite texel type check
David Neto [Fri, 24 Nov 2017 15:17:13 +0000 (10:17 -0500)]
Update CHANGES to mention fixes for 1007 and 1009
Andrey Tuganov [Fri, 24 Nov 2017 15:05:07 +0000 (10:05 -0500)]
Relaxed OpImageRead validation rules
Removed the check that result type of OpImageRead should be a vector4.
Will reenable/adapt once the spec is clarified on what the right
dimension should be.
Alan Baker [Fri, 24 Nov 2017 04:08:58 +0000 (23:08 -0500)]
Notify the context of instructions that are being erased.
Fixes use-after-free error in RemoveDuplicatesPass
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1004
Andrey Tuganov [Thu, 23 Nov 2017 17:11:15 +0000 (12:11 -0500)]
Add validation checks for Execution Model
Currently checks that these instructions are called from entry points
with Fragment execution model.
OpImageImplicit*
OpImageQueryLod
OpKill
David Neto [Wed, 22 Nov 2017 22:03:55 +0000 (17:03 -0500)]
Test for pollution of the global namespace
Works on Linux only for now. That's a good start.
Move ValidateBinaryUsingContextAndValidationState into anonymous
namespace in source/validate.cpp.
Steven Perron [Thu, 23 Nov 2017 17:41:10 +0000 (12:41 -0500)]
Remove derivative instructions from the list of combinators.
These instructions compute their value based the value of the immediate
neighbours of the current fragment. This means the result is not
defined purely by the operands of the instruction.
David Neto [Thu, 23 Nov 2017 23:16:41 +0000 (18:16 -0500)]
Start v2017.2-dev
David Neto [Thu, 23 Nov 2017 23:12:23 +0000 (18:12 -0500)]
Finalize 2017.1
Updated CHANGES to cover main updates since 2017.0
Lei Zhang [Fri, 17 Nov 2017 21:50:43 +0000 (16:50 -0500)]
Add RegisterLegalizationPasses() into the interface
Add note to mention the use scenario. The original list came
from Glslang.
Alan Baker [Tue, 14 Nov 2017 19:11:50 +0000 (14:11 -0500)]
Adding new def -> use mapping container
Replaced representation of uses
* Changed uses from unordered_map<uint32_t, UseList> to
set<pairInstruction*, Instruction*>>
* Replaced GetUses with ForEachUser and ForEachUse functions
* updated passes to use new functions
* partially updated tests
* lots of cleanup still todo
Adding an unique id to Instruction generated by IRContext
Each instruction is given an unique id that can be used for ordering
purposes. The ids are generated via the IRContext.
Major changes:
* Instructions now contain a uint32_t for unique id and a cached context
pointer
* Most constructors have been modified to take a context as input
* unfortunately I cannot remove the default and copy constructors, but
developers should avoid these
* Added accessors to parents of basic block and function
* Removed the copy constructors for BasicBlock and Function and replaced
them with Clone functions
* Reworked BuildModule to return an IRContext owning the built module
* Since all instructions require a context, the context now becomes the
basic unit for IR
* Added a constructor to context to create an owned module internally
* Replaced uses of Instruction's copy constructor with Clone whereever I
found them
* Reworked the linker functionality to perform clones into a different
context instead of moves
* Updated many tests to be consistent with the above changes
* Still need to add new tests to cover added functionality
* Added comparison operators to Instruction
Adding tests for Instruction, IRContext and IR loading
Fixed some header comments for BuildModule
Fixes to get tests passing again
* Reordered two linker steps to avoid use/def problems
* Fixed def/use manager uses in merge return pass
* Added early return for GetAnnotations
* Changed uses of Instruction::ToNop in passes to IRContext::KillInst
Simplifying the uses for some contexts in passes
Lei Zhang [Thu, 23 Nov 2017 20:16:48 +0000 (15:16 -0500)]
Allow derived access chain without uses in access chain conversion
Andrey Tuganov [Wed, 22 Nov 2017 17:07:23 +0000 (12:07 -0500)]
Add derivatives validation pass
Checks operands of instructions in opcode range from OpDPdx to
OpFwidthCoarse.
David Neto [Wed, 22 Nov 2017 20:18:37 +0000 (15:18 -0500)]
Move SetContextMessageConsumer into libspirv namespace
Avoid polluting the global namespace.
Steven Perron [Sat, 11 Nov 2017 01:26:55 +0000 (20:26 -0500)]
Create a local value numbering pass
Creates a pass that removes redundant instructions within the same basic
block. This will be implemented using a hash based value numbering
algorithm.
Added a number of functions that check for the Vulkan descriptor types.
These are used to determine if we are variables are read-only or not.
Implemented a function to check if loads and variables are read-only.
Implemented kernel specific and shader specific versions.
A big change is that the Combinator analysis in ADCE is factored out
into the IRContext as an analysis. This was done because it is being
reused in the value number table.
Andrey Tuganov [Thu, 26 Oct 2017 19:30:23 +0000 (15:30 -0400)]
Validator pass for image instructions
Includes validation rules for OpImageXXX and ImageOperand.
Doesn't include OpTypeImage and OpImageSparseXXX.
Disabled an invalid test.
GregF [Fri, 17 Nov 2017 23:47:11 +0000 (16:47 -0700)]
Optimize loads/stores on nested structs
Also fix LocalAccessChainConvert test: nested structs now convert
Add InsertExtractElim test for nested struct
Andrey Tuganov [Mon, 20 Nov 2017 22:56:01 +0000 (17:56 -0500)]
Fix move semantics in iterator make_range
Andrey Tuganov [Tue, 14 Nov 2017 22:02:42 +0000 (17:02 -0500)]
Add new compression algorithm and models
Add new "short descriptor" algorithm to MARK-V codec.
Add three shader compression models:
lite - fast, poor compression
mid - balanced
max - best compression
Alan Baker [Tue, 14 Nov 2017 19:11:50 +0000 (14:11 -0500)]
Adding an unique id to Instruction generated by IRContext
Each instruction is given an unique id that can be used for ordering
purposes. The ids are generated via the IRContext.
Major changes:
* Instructions now contain a uint32_t for unique id and a cached context
pointer
* Most constructors have been modified to take a context as input
* unfortunately I cannot remove the default and copy constructors, but
developers should avoid these
* Added accessors to parents of basic block and function
* Removed the copy constructors for BasicBlock and Function and replaced
them with Clone functions
* Reworked BuildModule to return an IRContext owning the built module
* Since all instructions require a context, the context now becomes the
basic unit for IR
* Added a constructor to context to create an owned module internally
* Replaced uses of Instruction's copy constructor with Clone whereever I
found them
* Reworked the linker functionality to perform clones into a different
context instead of moves
* Updated many tests to be consistent with the above changes
* Still need to add new tests to cover added functionality
* Added comparison operators to Instruction
* Added an internal option to LinkerOptions to verify merged ids are
unique
* Added a test for the linker to verify merged ids are unique
* Updated MergeReturnPass to supply a context
* Updated DecorationManager to supply a context for cloned decorations
* Reworked several portions of the def use tests in anticipation of next
set of changes
Steven Perron [Fri, 17 Nov 2017 18:03:17 +0000 (13:03 -0500)]
Add dead function elimination to -O and -Os
This pass is very useful in reducing the size of the code, and reducing
the amount of work done by other optimizations.
Lei Zhang [Fri, 17 Nov 2017 21:33:32 +0000 (16:33 -0500)]
Fix hard-coded header path
If SPIRV-Tools is used as an external project and have
googletest being kept in the same directory as it, we
won't have gmock-matchers.h in external/. This will
result in a compilation error.
Use gmock.h instead.
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.