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
Lei Zhang [Thu, 30 Jun 2016 19:44:36 +0000 (15:44 -0400)]
DRY file writing code in tools.
Lei Zhang [Thu, 30 Jun 2016 18:24:04 +0000 (14:24 -0400)]
DRY file reading code in tools.
Lei Zhang [Thu, 30 Jun 2016 17:56:34 +0000 (13:56 -0400)]
Rework CMake configuration for tools.
Lei Zhang [Wed, 29 Jun 2016 20:16:03 +0000 (16:16 -0400)]
Add the spirv-opt command line tool.
Lei Zhang [Tue, 28 Jun 2016 18:58:17 +0000 (14:58 -0400)]
Add Pass, PassManager, and StripDebugInfoPass.
David Neto [Tue, 28 Jun 2016 21:25:28 +0000 (17:25 -0400)]
Avoid capability checks on ID values. They are not literals
Works around issue 248 by weakening the test:
https://github.com/KhronosGroup/SPIRV-Tools/issues/248
The validator should try to track (32-bit) constant values, and then
for capability checks on IDs, check the referenced value, not the
raw ID number.
Lei Zhang [Tue, 28 Jun 2016 17:24:10 +0000 (13:24 -0400)]
Add tests for the cpp interface.
Lei Zhang [Tue, 28 Jun 2016 14:23:13 +0000 (10:23 -0400)]
Promote ir namespace and create draft libspirv.{h|c}pp.
Lei Zhang [Sun, 22 May 2016 18:17:39 +0000 (14:17 -0400)]
Add IrBuilder for constructing SPIR-V in-memory representation.
Lei Zhang [Mon, 27 Jun 2016 19:06:41 +0000 (15:06 -0400)]
Add an option to spvBinaryToText() to ignore header output.
Umar Arshad [Sat, 25 Jun 2016 03:45:25 +0000 (23:45 -0400)]
Fix several violations of the style guide
Lei Zhang [Sun, 22 May 2016 18:11:24 +0000 (14:11 -0400)]
Add classes for representing SPIR-V language constructs in memory.
Lei Zhang [Fri, 24 Jun 2016 19:48:34 +0000 (15:48 -0400)]
Travis CI: bump OS X and XCode version.
David Neto [Fri, 24 Jun 2016 06:14:16 +0000 (02:14 -0400)]
Use pseudo entry and pseudo exit blocks for dominance.
For dominance calculations we use an "augmented" CFG
where we always add a pseudo-entry node that is the predecessor
in the augmented CFG to any nodes that have no predecessors in the
regular CFG. Similarly, we add a pseudo-exit node that is the
predecessor in the augmented CFG that is a successor to any
node that has no successors in the regular CFG.
Pseudo entry and exit blocks live in the Function object.
Fixes a subtle problem where we were implicitly creating
the block_details for the pseudo-exit node since it didn't
appear in the idoms map, and yet we referenced it. In such a case the
contents of the block details could be garbage, or zero-initialized.
That sometimes caused incorrect calculation of immediate dominators
and post-dominators. For example, on a debug build where the details
could be zero-initialized, the dominator of an unreachable block would
be given as the pseudo-exit node. Bizarre.
Also, enforce the rule that you must have an OpFunctionEnd to close off
the last function.
Lei Zhang [Tue, 21 Jun 2016 22:29:36 +0000 (18:29 -0400)]
Use arguments for add_spvtools_unittest.
Lei Zhang [Wed, 22 Jun 2016 14:53:41 +0000 (10:53 -0400)]
Appveyor: Pull SPIRV-Headers for building and update README link.
Umar Arshad [Sat, 4 Jun 2016 01:24:24 +0000 (21:24 -0400)]
Validator structured flow checks: back-edge, constructs
Skip structured control flow chekcs for non-shader capability.
Fix infinite loop in dominator algorithm when there's an
unreachable block.
Lei Zhang [Tue, 21 Jun 2016 21:27:27 +0000 (17:27 -0400)]
Ignore Vim swap files.
David Neto [Tue, 14 Jun 2016 20:41:27 +0000 (16:41 -0400)]
Fix ExtInst parsing: no IdRef* at end
The operands following the extended instruction literal
number are determined by the extended instruction itself.
So drop the zero-or-more IdRef pattern at the end of OpExtInst.
It's arguable whether this should actually be a grammar fix. I've
chosen to patch this in SPIRV-Tools instead of in the grammar file.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/233
Also fix two test cases for OpenCL extended instructions. These
errors of supplying too many operands are now detected.
David Neto [Tue, 14 Jun 2016 15:45:35 +0000 (11:45 -0400)]
Fix OpenCL pow and pown arguments
Spec fix appeared in SPIR-V 1.0 Rev 2:
https://www.khronos.org/registry/spir-v/specs/1.0/OpenCL.ExtendedInstructionSet.100.html#_changes_from_version_1_0_revision_1
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/143
David Neto [Mon, 13 Jun 2016 21:26:09 +0000 (17:26 -0400)]
In physical addressing, functions can return pointers
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/229
Lei Zhang [Thu, 14 Apr 2016 18:05:53 +0000 (14:05 -0400)]
Use SPIR-V headers from the KhronosGroup/SPIRV-Headers repo.
David Neto [Fri, 10 Jun 2016 12:43:12 +0000 (08:43 -0400)]
std::function needs <functional>. Fixes Android build
David Neto [Fri, 10 Jun 2016 10:41:20 +0000 (06:41 -0400)]
Avoid copy of work list argument: make it const ref
Umar Arshad [Sat, 4 Jun 2016 01:14:22 +0000 (21:14 -0400)]
Refactor depth first traversal to be more generic
Refactor the way the post order vector is created. This new method
will allow for the extraction of backedges and create the post order
vector in one pass.
Umar Arshad [Thu, 9 Jun 2016 19:51:39 +0000 (15:51 -0400)]
Fix diagnostic message for layout errors
Umar Arshad [Thu, 2 Jun 2016 22:51:05 +0000 (18:51 -0400)]
Split validate_types file into multiple classes
Creates separate files for the ValidationState, Function and
BasicBlock classes.
Umar Arshad [Wed, 1 Jun 2016 22:22:57 +0000 (18:22 -0400)]
Remove redundant in_block function from Function
Same test can be done through the get_current_block function
Dejan Mircevski [Sat, 4 Jun 2016 01:46:19 +0000 (21:46 -0400)]
Avoid accessing invalid iterator.
Umar Arshad [Wed, 1 Jun 2016 22:05:28 +0000 (18:05 -0400)]
Additional CFG tests
* Empty function
* Single block loops
* Nested loops
* Nested selection
David Neto [Thu, 2 Jun 2016 19:32:28 +0000 (15:32 -0400)]
Fix CHANGES file version parsing. -dev is optional
Dejan Mircevski [Thu, 2 Jun 2016 17:13:04 +0000 (13:13 -0400)]
Make googletest regexes portable.
On Windows, test::MatchesRegex() doesn't support brackets. On Linux, \d
doesn't work. :(
Umar Arshad [Wed, 16 Mar 2016 21:20:02 +0000 (17:20 -0400)]
Control Flow Graph Validation
Lei Zhang [Sun, 22 May 2016 17:48:08 +0000 (13:48 -0400)]
Create a function for adding unittests in CMake.
Also remove unnecessary main() function for unittests.
Lei Zhang [Thu, 26 May 2016 01:01:54 +0000 (21:01 -0400)]
Travis CI: Use ctest to run all the tests.
Lei Zhang [Tue, 17 May 2016 13:02:45 +0000 (09:02 -0400)]
Add Appveyor configuration for Windows build.
Dejan Mircevski [Fri, 13 May 2016 02:06:28 +0000 (22:06 -0400)]
Test ABGR in both 1.0 and 1.1.
Dejan Mircevski [Wed, 11 May 2016 19:21:10 +0000 (15:21 -0400)]
Remove needless include dir for spirv-dis.
Dejan Mircevski [Wed, 11 May 2016 17:12:59 +0000 (13:12 -0400)]
Test ABGR image channel order.
Update include/spirv/spirv.h from SPIRV-Headers.
Dejan Mircevski [Wed, 11 May 2016 16:40:59 +0000 (12:40 -0400)]
Test OpModuleProcessed.
Dejan Mircevski [Wed, 11 May 2016 14:34:27 +0000 (10:34 -0400)]
Remove done TODOs in OpNameTest.
Simplify the instantiation by using Values() instead of ValuesIn().
Run clang-format.
Dejan Mircevski [Tue, 10 May 2016 21:02:41 +0000 (17:02 -0400)]
Test SpecId validation.
Dejan Mircevski [Wed, 11 May 2016 13:48:52 +0000 (09:48 -0400)]
Add --target-env.
commit
7648187c344cfc7847607acb2a6fa5606a3d10c1
Author: Dejan Mircevski <deki@google.com>
Date: Thu Apr 21 15:44:07 2016 -0400
Turn --vulkan into --target-env.
Dejan Mircevski [Tue, 10 May 2016 03:15:46 +0000 (23:15 -0400)]
Add tests for MaxByteOffset.
Jamie Madill [Fri, 29 Apr 2016 18:36:00 +0000 (14:36 -0400)]
Add PipeStorage tests.
Jamie Madill [Fri, 29 Apr 2016 18:36:00 +0000 (14:36 -0400)]
Fix several warnings exposed in MSVS 2015.
diagnostic.cpp:
- unreachable code
operand.cpp
- conversion between int and uint32_t
- unreachable code
hex_float.h:
- conversion from 'const int' to 'unsigned int'
- unreachable code
validate_id.cpp
- forcing value to bool 'true' or 'false'
validate_types.cpp:
- forcing value to bool 'true' or 'false'
Florian Ziesche [Wed, 2 Mar 2016 21:17:54 +0000 (22:17 +0100)]
bitcast fixes
* ValidationState_t and idUsage now store the addressing model and memory model of the SPIR-V module (this is necessary for certain instructions that need different checks depending on if the logical or physical addressing model is used)
* removed SpvOpPtrAccessChain and SpvOpInBoundsPtrAccessChain from spvOpcodeIsPointer again as these are disallowed in logical addressing mode and only allowed in physical addressing mode (which doesn't use/need spvOpcodeIsPointer in the first place)
* added SpvOpImageTexelPointer and SpvOpCopyObject to spvOpcodeIsPointer
* OpLoad/OpStore now only check if the used pointer operand originated from a valid pointer producing opcode in logical addressing mode (as per 2.16.1)
* moved bitcast pointer tests to the kernel / physical addressing model part (+cleanup)
* renamed spvOpcodeIsPointer to spvOpcodeReturnsLogicalPointer to clarify this function is only meant to be used with the logical addressing model
Dejan Mircevski [Wed, 27 Apr 2016 20:22:15 +0000 (16:22 -0400)]
Add v1.1 tests for OpLoopMerge.
Dejan Mircevski [Fri, 29 Apr 2016 17:40:01 +0000 (13:40 -0400)]
Add v1.1 capabilities validation.
Refactor the ValidateCapability test fixture.
Explain the meaning of test parameters. Factor out methods for
convenience and readability. DRY v1.0 and v1.1 tests.
Dejan Mircevski [Wed, 27 Apr 2016 21:04:37 +0000 (17:04 -0400)]
Add basic Initializer/Finalizer tests.