David Neto [Wed, 24 Aug 2016 15:18:16 +0000 (11:18 -0400)]
Start v2016.4-dev
David Neto [Wed, 24 Aug 2016 15:17:07 +0000 (11:17 -0400)]
Finalize v2016.3
David Neto [Mon, 22 Aug 2016 15:38:18 +0000 (11:38 -0400)]
Add spirv-lesspipe.sh
Idea suggested by @steve-lunarg in issue 359.
David Neto [Wed, 24 Aug 2016 13:47:49 +0000 (09:47 -0400)]
Mere mention of PointSize BuiltIn does not require Shader capability
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/365 which
was reopened for this.
Lei Zhang [Fri, 19 Aug 2016 03:16:21 +0000 (23:16 -0400)]
Add a home brewed make_unique to ease creating unique_ptrs.
Lei Zhang [Sat, 20 Aug 2016 15:12:57 +0000 (11:12 -0400)]
Remove some unused macros and functions.
David Neto [Tue, 23 Aug 2016 22:44:26 +0000 (18:44 -0400)]
CHANGES captures fix for issue 365
David Neto [Tue, 23 Aug 2016 22:18:17 +0000 (18:18 -0400)]
Relax ClipDistance, CullDistance capability check in all environments
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/365
David Neto [Sat, 20 Aug 2016 09:51:15 +0000 (05:51 -0400)]
Add opt::ir::Module::SetIdBound
qining [Tue, 23 Aug 2016 15:34:24 +0000 (11:34 -0400)]
Get the number of elements for Vector and Matrix type
qining [Tue, 16 Aug 2016 17:06:03 +0000 (13:06 -0400)]
Refine the DefUseManager
* Fix the behavior when analyzing an individual instruction:
* exisiting instruction:
Clear the original records and re-analyze it as a new instruction.
* new instruction with exisiting result id:
Clear the original records of the exisiting result id. This means
the records of the analyzed result-id-defining instruction will be
overwritten by the record of the new instruction with the same
result id.
* new instruction with new result id or without result id:
Just update the internal records to incorperate the new
instruction.
* Add tests for analyzing individual instruction w/o an exisiting module.
* Refactor ClearInst() implementation
* Remove ClearDef() function.
* Fixed a bug in DefUseManager::ReplaceAllUsesWith() that OpName
instruction may trigger the assertion incorrectly.
* update the blurbs for EraseUseRecordsOfOperandIds()
qining [Wed, 17 Aug 2016 20:44:38 +0000 (16:44 -0400)]
Get the width from integer and float type
qining [Tue, 16 Aug 2016 15:04:32 +0000 (11:04 -0400)]
Replace the SetOperand() with SetInOperand() and SetResultType()
Lei Zhang [Tue, 16 Aug 2016 15:19:34 +0000 (11:19 -0400)]
Make clear that we are using ptrdiff_t as the iterator difference type.
And ptrdiff_t is a implementation defined signed type. Comparing it
with unsigned number literal causes compiler warnings.
Lei Zhang [Mon, 15 Aug 2016 15:13:25 +0000 (11:13 -0400)]
Derive iterator from std::iterator to reap standarad algorithms.
By deriving from std::iterator, iterator_traits will be properly
set up for our custom iterator type, thus we can use algorithms
from STL with our custom iterators.
Lei Zhang [Mon, 15 Aug 2016 17:41:47 +0000 (13:41 -0400)]
Make analyses RAII-like and turn disable copy/move constructors.
David Neto [Mon, 15 Aug 2016 15:27:13 +0000 (11:27 -0400)]
Avoid integer modulo by 1, to avoid warning
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/349
David Neto [Fri, 12 Aug 2016 18:19:17 +0000 (14:19 -0400)]
Avoid race on mkdir
Should fix https://github.com/KhronosGroup/SPIRV-Tools/issues/340
Lei Zhang [Fri, 12 Aug 2016 18:59:56 +0000 (14:59 -0400)]
Allow OpUndef appearing in the type and global variable section.
Also clean up API functions for adding instructions into the
type and global values section.
qining [Fri, 12 Aug 2016 21:26:35 +0000 (17:26 -0400)]
Add another construtor for opt::ir::Instruction
David Neto [Fri, 12 Aug 2016 18:47:26 +0000 (14:47 -0400)]
Test INotEqual for OpSpecConstantOp in asm, disasm
qining [Fri, 12 Aug 2016 17:12:43 +0000 (13:12 -0400)]
Add iterator getter interface for types_values_
Umar Arshad [Fri, 12 Aug 2016 18:28:17 +0000 (14:28 -0400)]
OpUndef can appear in type declaration section
Lei Zhang [Thu, 11 Aug 2016 23:58:42 +0000 (19:58 -0400)]
Turn off modifying methods for const iterators.
qining [Fri, 12 Aug 2016 14:43:26 +0000 (10:43 -0400)]
Clear old def-use record when re-analyze an ID
Lei Zhang [Fri, 12 Aug 2016 14:04:23 +0000 (10:04 -0400)]
Add make_range() & make_const_range() for creating iterator ranges.
Lei Zhang [Fri, 12 Aug 2016 13:13:04 +0000 (09:13 -0400)]
Avoid non-oneliner definition in class and add missing iterators.
qining [Fri, 12 Aug 2016 14:05:58 +0000 (10:05 -0400)]
Move the def-use analysis for single inst to public
qining [Thu, 11 Aug 2016 23:32:43 +0000 (19:32 -0400)]
Add getter for pointee, element type
Lei Zhang [Wed, 10 Aug 2016 14:02:28 +0000 (10:02 -0400)]
Create an iterator class for in-memory representation.
qining [Thu, 11 Aug 2016 22:19:50 +0000 (18:19 -0400)]
Make the lookup up of type id accepts const arg
David Neto [Thu, 11 Aug 2016 19:34:26 +0000 (15:34 -0400)]
Reuse the iterator on Id and type lookup
qining [Thu, 11 Aug 2016 21:13:43 +0000 (17:13 -0400)]
Add the const version of AsXXtype() interface.
qining [Thu, 11 Aug 2016 19:10:09 +0000 (15:10 -0400)]
Add GetId(Type* type) API to the type manager
David Neto [Thu, 11 Aug 2016 16:11:36 +0000 (12:11 -0400)]
Avoid double-copy of NameMapper object.
David Neto [Wed, 10 Aug 2016 19:28:11 +0000 (15:28 -0400)]
Use friendly names for Ids
David Neto [Wed, 3 Aug 2016 15:55:14 +0000 (11:55 -0400)]
Add spirv-cfg to dump a GraphViz graph of the CFG
This is experimental, and has not tests.
It's been used to debug validation of structured control flow.
- Has a legend describing special arcs to merge blocks and continue
targets.
- Labels the function entry block, with the Id of the function.
qining [Wed, 10 Aug 2016 20:02:18 +0000 (16:02 -0400)]
Add back the missing msg about --eliminate-dead-const
Lei Zhang [Wed, 10 Aug 2016 20:10:14 +0000 (16:10 -0400)]
Fix build error about passing initializer-list to constructor.
VS2013 is not happy with using initializer-list to initialize
vector parameters to explicit constructors taking one vector.
Lei Zhang [Wed, 10 Aug 2016 16:37:19 +0000 (12:37 -0400)]
Make type manager RAII-like w.r.t. the module to be analyzed.
Lei Zhang [Thu, 28 Jul 2016 16:15:14 +0000 (12:15 -0400)]
Optimization: Add type manager.
Type manager will construct a map of types gradually from
instructions.
Lei Zhang [Thu, 28 Jul 2016 16:11:01 +0000 (12:11 -0400)]
Optimization: Add type class hierarchy.
Lei Zhang [Wed, 10 Aug 2016 14:12:14 +0000 (10:12 -0400)]
Appveyor: also test on Visual Studio 2013.
David Neto [Tue, 9 Aug 2016 21:57:18 +0000 (17:57 -0400)]
Fix paths in the README.
Lei Zhang [Tue, 9 Aug 2016 23:20:35 +0000 (19:20 -0400)]
Change the interfaces of in-memory representation to use pointers.
Previously we use vectors of objects and move semantics to handle
ownership. That approach has the flaw that inserting an object into
the middle of a vector, which may trigger a vector reallocation,
can invalidate some addresses taken from instructions.
Now the in-memory representation internally uses vector of unique
pointers to handle ownership. Since objects are explicitly heap-
allocated now, pointers to them won't be invalidated by vector
resizing anymore.
David Neto [Wed, 10 Aug 2016 14:40:59 +0000 (10:40 -0400)]
Update CHANGES to say issue 288 is fixed
Andrew Woloszyn [Wed, 10 Aug 2016 13:45:15 +0000 (09:45 -0400)]
Fixed the build for MSVC.
assembly_builder was missing an include for cstdint.
Lei Zhang [Tue, 9 Aug 2016 20:57:36 +0000 (16:57 -0400)]
Manually create move the constructor/assignment for Instruction.
This is because some old visual studio versions (e.g., 2013) do
not support automatically generating move constructors/assignments.
David Neto [Tue, 9 Aug 2016 22:23:40 +0000 (18:23 -0400)]
Fix compilation. My bad
The API changed, and I forgot to submit this patch.
Umar Arshad [Sat, 6 Aug 2016 17:40:01 +0000 (13:40 -0400)]
Check dominance of OpPhi parent and variable pairs
Umar Arshad [Tue, 9 Aug 2016 18:05:03 +0000 (14:05 -0400)]
Removed dead code/const_casts/lists
qining [Tue, 9 Aug 2016 20:02:21 +0000 (16:02 -0400)]
Separate pass.h from passes.h
Future pass implementations should only need to include pass.h
Lei Zhang [Mon, 8 Aug 2016 02:49:00 +0000 (22:49 -0400)]
Use NEW behavior for policy CMP0054.
The NEW behavior is to not dereference variables or interpret keywords
that have been quoted or bracketed.
For more information, see
https://cmake.org/cmake/help/v3.1/policy/CMP0054.html.
This is to suppress a warning when using CMake 3.1.3+.
Umar Arshad [Sat, 6 Aug 2016 17:29:33 +0000 (13:29 -0400)]
Refactor Id -> Instruction
qining [Tue, 9 Aug 2016 16:09:53 +0000 (12:09 -0400)]
Fix minor mistakes in the tests of dead-const-elim
qining [Mon, 8 Aug 2016 21:09:30 +0000 (17:09 -0400)]
Print the shader when module building failed
qining [Fri, 29 Jul 2016 15:35:58 +0000 (11:35 -0400)]
Dead constant elimination
A pass to remove dead constants, including both front-end constants and spec
constants.
This pass does not handle dead variables and types.
Umar Arshad [Sat, 6 Aug 2016 17:25:02 +0000 (13:25 -0400)]
Remove unnecessary headers
Umar Arshad [Sat, 6 Aug 2016 16:24:19 +0000 (12:24 -0400)]
Remove needless copies. Delete copy constructor.
* Deletes the ValidationState_t copy constructor
* Removes needless copies of the copy constructor
David Neto [Fri, 5 Aug 2016 22:19:30 +0000 (18:19 -0400)]
Add target envs for OpenCL, OpenGL
Covers: OpenCL 2.1, OpenCL 2.2
Covers: OpenGL 4.0, OpenGL 4.1, OpenGL 4.2, OpenGL 4.3, OpenGL 4.5.
The OpenGL environments assume the use of GL_ARB_gl_spirv, of course.
David Neto [Fri, 5 Aug 2016 21:10:36 +0000 (17:10 -0400)]
Start v2016.3-dev
David Neto [Fri, 5 Aug 2016 21:07:34 +0000 (17:07 -0400)]
Finalize v2016.2
Document recently fixed bugs.
David Neto [Fri, 5 Aug 2016 19:20:59 +0000 (15:20 -0400)]
Hide implementations of BasicBlock::dominates,postdominates
David Neto [Fri, 5 Aug 2016 20:05:44 +0000 (16:05 -0400)]
Track a construct by its entry block.
David Neto [Fri, 5 Aug 2016 15:14:21 +0000 (11:14 -0400)]
Validator cfg fixes
- Find unreachable continue targets. Look for back edges
with a DFS traversal separate from the dominance traversals,
where we count the OpLoopMerge from the header to the continue
target as an edge in the graph.
- It's ok for a loop to have multiple back edges, provided
they are all from the same block, and we call that the latch block.
This may require a clarification/fix in the SPIR-V spec.
- Compute postdominance correctly for infinite loop:
Bias *predecessor* traversal root finding so that you use
a later block in the original list. This ensures that
for certain simple infinite loops in the CFG where neither
block branches to a node without successors, that we'll
compute the loop header as dominating the latch block, and the
latch block as postdominating the loop header.
David Neto [Fri, 29 Jul 2016 15:24:57 +0000 (11:24 -0400)]
Add BasicBlock methods: dominates postdominates
David Neto [Tue, 26 Jul 2016 18:59:40 +0000 (14:59 -0400)]
Rename a variable so it's consistent with spec
In the spec "continue block" is a block with a branch
to the Continue Target. It's not the Continue Target.
Lei Zhang [Fri, 5 Aug 2016 17:46:45 +0000 (13:46 -0400)]
Check configuration and gmock existence when adding unit tests.
David Neto [Fri, 5 Aug 2016 14:09:06 +0000 (10:09 -0400)]
Fix dominance calculation
Fixes dominance calculation when there is a forward arc from an
unreachable block A to a reachable block B. Before this fix, we would
say that B is not dominated by the graph entry node, and instead say
that the immediate dominator of B is the psuedo-entry node of the
augmented CFG.
The fix:
- Dominance is defined in terms of a traversal from the entry block
of the CFG. So the forward DFS should start from the function
entry block, not the pseudo-entry-block.
- When following edges backward during dominance calculations, only go to
nodes that are actually reachable in the forward traversal.
Important: the sense of reachability flips around when computing
post-dominance.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/297
qining [Fri, 5 Aug 2016 13:51:29 +0000 (09:51 -0400)]
Add blurbs for freeze-spec-const pass
Lei Zhang [Thu, 4 Aug 2016 22:26:22 +0000 (18:26 -0400)]
Create directory first if not existing and always refresh.
Lei Zhang [Thu, 4 Aug 2016 22:25:42 +0000 (18:25 -0400)]
Avoid redefining builtin dir.
qining [Tue, 2 Aug 2016 16:08:40 +0000 (12:08 -0400)]
Simple Assembly code builder for test uses
AssemblyBuilder contains boilplates.
Adds OpName instructions for all added defining instructions.
Adds OpDecorate SpecId for all spec constants added with OpSpecConstant,
OpSpecConstantTrue and OpSpecConstantFalse instructions.
David Neto [Thu, 4 Aug 2016 18:57:09 +0000 (14:57 -0400)]
Only check def dominance of reachable uses
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/295
David Neto [Tue, 2 Aug 2016 21:48:16 +0000 (17:48 -0400)]
Update CHANGES to reflect INotEqual update
qining [Tue, 26 Jul 2016 21:52:06 +0000 (17:52 -0400)]
Allow OpINotEqual in OpSpecConstantOp inst
Pendding for now until the spec is fixed.
David Neto [Tue, 2 Aug 2016 15:59:10 +0000 (11:59 -0400)]
Never generate % for a friendly disassembled Id
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/290
David Neto [Fri, 29 Jul 2016 22:05:02 +0000 (18:05 -0400)]
Add disabled test for phi variable def-use check
Disabled because doing a proper check requires much more
code, and it can wait.
David Neto [Fri, 29 Jul 2016 21:53:46 +0000 (17:53 -0400)]
Avoid checking def-use dominance for OpPhi value operands
The def-use dominance checker doesn't have enough info to know
that a particular use is in an OpPhi, so skip tracking those uses
for now. Add a TODO to do a proper OpPhi variable-argument check
in the future.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/286
Lei Zhang [Wed, 27 Jul 2016 21:37:04 +0000 (17:37 -0400)]
Optimization: Add def use analysis.
Lei Zhang [Thu, 28 Jul 2016 13:09:00 +0000 (09:09 -0400)]
Use default copy/move constructors/assignments for Instruction.
Lei Zhang [Wed, 27 Jul 2016 21:31:23 +0000 (17:31 -0400)]
Allow missing memory model instructions in modules.
David Neto [Wed, 27 Jul 2016 21:02:22 +0000 (17:02 -0400)]
Fix infinite loop in dominance calculation.
Ensure the dominance calculation visits all nodes in the CFG.
The successor list of the pseudo-entry node is augmented with
a single node in each cycle that otherwise would not be visited.
Similarly, the predecssors list of the pseduo-exit node is augmented
with the a single node in each cycle that otherwise would not
be visited.
Pulls DepthFirstSearch out so it's accessible outside of the dominator
calculation.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/279
Qining [Thu, 28 Jul 2016 19:33:16 +0000 (15:33 -0400)]
Merge pull request #284 from Qining/fix-freeze-spec-const-pass-test
Fix a test failure in pass manager test
qining [Thu, 28 Jul 2016 19:30:37 +0000 (15:30 -0400)]
Fix a test failure in pass manager test
Change "Null" to "null" in pass manager test
qining [Tue, 26 Jul 2016 16:11:03 +0000 (12:11 -0400)]
Freeze spec constants to their default values
Add a pass to freeze spec constants to their default values. This pass does
not fold the frozen spec constants and does not handle SpecConstantOp
instructions and SpecConstantComposite instructions.
qining [Wed, 27 Jul 2016 21:22:45 +0000 (17:22 -0400)]
Add an utility: in-place string replacement
qining [Wed, 27 Jul 2016 14:19:39 +0000 (10:19 -0400)]
Use friendly disassembly output
Umar Arshad [Wed, 13 Jul 2016 22:57:52 +0000 (18:57 -0400)]
Check definitions appear in dominator of use
Also address use and def of ID in same instruction
Umar Arshad [Fri, 8 Jul 2016 13:44:10 +0000 (09:44 -0400)]
Refactor IDs definition and use tracking
* Creates an ID class which manages definition and use of IDs
* Moved tracking code from validate.cpp to validate_id.cpp
* Rename and combine SsaPass and ProcessIds into IdPass
* Remove module dependency in Function
Umar Arshad [Fri, 22 Jul 2016 20:27:21 +0000 (16:27 -0400)]
Fixes segfault for loops without back-edges
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/270
Lei Zhang [Tue, 19 Jul 2016 19:04:43 +0000 (15:04 -0400)]
Start v2016.2.
Lei Zhang [Tue, 19 Jul 2016 19:03:52 +0000 (15:03 -0400)]
Finalize v2016.1.
David Neto [Fri, 8 Jul 2016 18:29:52 +0000 (14:29 -0400)]
Disassembling: map IDs to friendly names.
Add a FriendlyNameMapper to deduce friendly names for IDs based on
OpName, type structure, etc.
Lei Zhang [Mon, 18 Jul 2016 15:01:36 +0000 (11:01 -0400)]
Track changes in SPIRV-Headers for SPIR-V 1.1 rev 2.
* The `Input` StorageClass doesn't require the `Shader` capability
anymore.
* The `Sampled1D` and `SampledBuffer` capabilities don't require
the `Shader` capability anymore. So they do not indirectly
depend on the `Matrix` capability. So are the `Image1D` and
`ImageBuffer` capabilities, which depend on `Sampled1D` and
`SampledBuffer`.
A new GLSL grammar file is uploaded for SPIR-V 1.1, but it's the
same as the existing one for SPIR-V 1.0.
Now tracking commit
3814effb879ab5a98a7b9288a4b4c7849d2bc8ac in
SPIRV-Headers.
David Neto [Thu, 7 Jul 2016 21:03:22 +0000 (17:03 -0400)]
Turn off ClipDistance CullDistance cap checks for Vulkan
Turn them off until resolution of the debate over how they should be checked.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/261
Lei Zhang [Thu, 7 Jul 2016 19:04:06 +0000 (15:04 -0400)]
Mention the steps to pull dependencies when building in README.
David Neto [Tue, 5 Jul 2016 14:21:21 +0000 (10:21 -0400)]
Test v1.1 loop dependency support
For DependencyInfinite and DependencyLength, test
that they don't require a capability to be turned on.
Also, that they are assembled, binary parsed, and disassembled
correctly.
David Neto [Mon, 4 Jul 2016 19:13:08 +0000 (15:13 -0400)]
Start v2016.1-dev
David Neto [Thu, 2 Jun 2016 19:29:13 +0000 (15:29 -0400)]
Finalize v2016.0