summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-07-31Fix disassembly line for adjacency validations. (#1751)dan sinclair1-3/+3
Previously the adjacency messages would output the last line of the file as the disassembly. This is incorrect, as we have an instruction they can be attached too. This CL fixes the messages to attach to the correct line number.
2018-07-31Switch validate to use explicit diag() method. (#1750)dan sinclair2-9/+8
This CL changes validate.cpp to use diag providing an explicit instruction. This changes the result of the function end checks to not output a disassembly anymore as printing the last line of the module didn't seem to make sense.
2018-07-31Change ValidationState::diag to accept an Instruction. (#1749)dan sinclair4-40/+32
This CL changes the signature of diag() to accept an Instruction instead of the instructions position. A deprecated variant that accepts the position is available but will be removed in the near future.
2018-07-31Transform to combine consecutive access chainsAlan Baker12-4/+1299
* Combines OpAccessChain, OpInBoundsAccessChain, OpPtrAccessChain and OpInBoundsPtrAccessChain * New folding rule to fold add with 0 for integers * Converts to a bitcast if the result type does not match the operand type V
2018-07-31Fix bug determining next argAlan Baker1-1/+1
2018-07-31Wrap entire timer.cpp in SPIRV_TIMER_ENABLED.Dan Sinclair1-4/+4
This CL moves the SPIRV_TIMER_ENABLED preprocesser guard to encompass the includes along with the source. Currently we will try to pull in sys/resource.h on machines which may not have the file available and the build will fail. If we don't need timers, then we don't need the includes as well.
2018-07-31Make sure all instructions are in the ordered list.Dan Sinclair8-80/+79
Currently, some instructions will be missing from the list of ordered_instructions. This will cause issues due to the debug change which passed the last instruction into subsequent passes. This CL moves the addition to the ordered list out of the RegisterInstruction method into AddOrderedInstruction. This method is called first in ProcessInstruction and the CapabilitiesPass and IdPass are updated to take an Instruction parameter.
2018-07-31Update error messages in validate_composites. (#1743)dan sinclair2-215/+149
This CL removes the redundant operator name from the error messages in validate_composites. The operator will be printed on the next line with the disassembly.
2018-07-30Split ImagePass into individual methods. (#1742)dan sinclair2-1363/+1116
This CL splits the switch in ImagePass into individual validate functions. The error messages have been updated to drop the suffix/prefix of the opcode name since it will be displayed in the disassembly.
2018-07-30Move OpVectorShuffle check into validate_composites (#1741)dan sinclair3-166/+70
This CL moves the OpVectorShuffle ID check out of validate_id and into validate_composites with the rest of the composite checks.
2018-07-30Move CompositePass code into methods. (#1740)dan sinclair1-279/+290
This Cl splits the CompositePass switch to have one method per case label. This makes the code a lot simpler to follow.
2018-07-30Wrap bin group in conditional for BUILD.gn (#1738)dan sinclair1-6/+8
2018-07-27Add API to create passes out of a list of command-line flags.Diego Novillo4-224/+468
This re-implements the -Oconfig=<file> flag to use a new API that takes a list of command-line flags representing optimization passes. This moves the processing of flags that create new optimization passes out of spirv-opt and into the library API. Useful for other tools that want to incorporate a facility similar to -Oconfig. The main changes are: 1- Add a new public function Optimizer::RegisterPassesFromFlags. This takes a vector of strings. Each string is assumed to have the form '--pass_name[=pass_args]'. It creates and registers into the pass manager all the passes specified in the vector. Each pass is validated internally. Failure to create a pass instance causes the function to return false and a diagnostic is emitted to the registered message consumer. 2- Re-implements -Oconfig in spirv-opt to use the new API.
2018-07-24Add support for Chromium GN buildDan Sinclair11-1/+1533
Build test Add Fuzzer group Add libfuzzer
2018-07-20Handle undef literal value in vector shuffleAlan Baker3-6/+76
Fixes #1731 * Updated folding rules related to vector shuffle to account for the undef literal value: * FoldVectorShuffleFeedingShuffle * FoldVectorShuffleFeedingExtract * FoldVectorShuffleWithConstants * These rules would commit memory violations due to treating the undef literal value as an accessible composite component
2018-07-20Replace opt::Instruction type and result cache with flags. (#1718)dan sinclair2-39/+57
Currentlty opt::Instruction class holds a cache of the result_id and type_id for the instruction. That cache needs to be updated if the underlying operand values are changes. This CL changes the cache to being a flag if there is a type or result id for the instruction. We then retrieve the value if needed from the operands.
2018-07-19Add variable pointer support to IsValidBasePointerAlan Baker3-7/+472
Fixes #1729 * Adds supported opcodes to IsValidBasePointer() enable by VariablePointers and VariablePointersStorageBuffer capabilities * Added tests
2018-07-19Fix block ordering in dead branch elimAlan Baker4-7/+160
Fixes #1727 * If the pass finds any dead branches it can optimize then at the end of the pass it reorders basic blocks to ensure they satisfy block ordering requirements * Added some new tests * While investigating this issue, found and fixed a non-deterministic ordering of dominators * Now the edges used to construct the dominator tree are sorted according to posorder traversal indices
2018-07-19Don't check exports on DarwinDavid Neto1-1/+4
Android NDK build machines for OSX don't seem to have objdump.
2018-07-18Update CHANGESDavid Neto1-0/+8
2018-07-16Fixup line number for OpVectorShuffle ID error.Dan Sinclair2-5/+33
This CL updates the code to pull a valid instruction for the line number when outputting a component error in OpVectorShuffle. The error line isn't the best at this point as it points at the component, but it's better then a -1 (turning to max<size_t>) that was being output. The error messages has been updated to better reflect what the error is attempting to say. Issue 1719.
2018-07-16Fix finding constant with particular type. (#1724)Steven Perron6-62/+128
With current implementation, the constant manager does not keep around two constant with the same value but different types when the types hash to the same value. So when you start looking for that constant you will get a constant with the wrong type back. I've made a few changes to the constant manager to fix this. First off, I have changed the map from constant to ids to be an std::multimap. This way a single constant can be mapped to mutiple ids each representing a different type. Then when asking for an id of a constant, we can search all of the ids associated with that constant in order to find the one with the correct type.
2018-07-13Fix infinite loop while folding OpVectorShuffle (#1722)Steven Perron2-25/+75
When folding an OpVectorShuffle where the first operand is defined by an OpVectorShuffle, is unused, and is equal to the second, we end up with an infinite loop. This is because we think we change the instruction, but it does not actually change. So we keep trying to folding the same instruction. This commit fixes up that specific issue. When the operand is unused, we replace it with Null.
2018-07-13Fix size error when folding vector shuffle. (#1721)Steven Perron3-1/+55
When folding a vector shuffle that feeds another vector shuffle causes the size of the first operand to change, when other indices have to be adjusted reletive to the new size.
2018-07-12Remove dead code (#1720)dan sinclair1-437/+0
Remove commented out code from validate_id.
2018-07-12Cleanup extraneous namespace qualifies in source/opt. (#1716)dan sinclair144-3412/+3146
This CL follows up on the opt namespacing CLs by removing the unnecessary opt:: and opt::analysis:: namespace prefixes.
2018-07-12Remove the module from opt::Function. (#1717)dan sinclair11-28/+17
The function class provides a {Set|Get}Parent call in order to provide the context to the LoopDescriptor methods. This CL removes the module from Function and provides the needed context directly to LoopDescriptor on creation.
2018-07-12Cleanup CFG header. (#1715)dan sinclair2-16/+3
This CL removes some unused methods from CFG, makes the constructor explicit and moves the using statement to the cpp file where it's used.
2018-07-12Cleanup some pass code to get context directly. (#1714)dan sinclair3-7/+6
Instead of going through the instruction we can access the context() directly from the pass. Issue #1703
2018-07-12Remove context() method from opt::Function (#1700)dan sinclair8-29/+26
This CL removes the context() method from opt::Function. In the places where the context() was used we can retrieve, or provide, the context in another fashion.
2018-07-12Pass the IRContext into the folding rules. (#1709)dan sinclair7-91/+63
This CL updates the folding rules to receive the IRContext as a paramter instead of retrieving off of the Instruction. Issue #1703
2018-07-12use Pass::Run to set the context on each pass. (#1708)dan sinclair103-436/+309
Currently the IRContext is passed into the Pass::Process method. It is then up to the individual pass to store the context into the context_ variable. This CL changes the Run method to store the context before calling Process which no-longer receives the context as a parameter.
2018-07-11Add option to skip verifying block layoutLei Zhang7-3/+62
We need this to avoid emitting errors on DirectX layout rules.
2018-07-11Update the check-format bot. (#1710)Ehsan1-0/+6
2018-07-11Add folding rule to merge a vector shuffle feeding another one.Steven Perron2-59/+332
2018-07-11Update CHANGESDavid Neto1-1/+12
2018-07-11Enforce block layout rules even when relaxedDavid Neto4-12/+305
- Vulkan 1.0 uses strict layout rules - Vulkan 1.0 with relaxed-block-layout validator option enforces all rules except for the relaxation of vector offset. - Vulkan 1.1 and later always supports relaxed block layout Add spot check tests for the relaxed-block-layout scenarios. Fixes #1697
2018-07-11Update docs to reflect new bot status.Ehsan Nasiri2-1/+6
2018-07-11Move validation files to val/ directory (#1692)dan sinclair34-237/+236
This CL moves the various validate files into the val/ directory with the rest of the validation infrastructure. This matches how opt/ is setup with the passes with the infrastructure.
2018-07-11Move tests into namespaces (#1689)dan sinclair191-3606/+3981
This CL moves the test into namespaces based on their directories.
2018-07-10Reopen stdin for binary as neededDavid Neto1-3/+5
Fixes #1688
2018-07-10Vulkan permits non-monotonic offsets for block membersDavid Neto4-12/+117
Other environments do not. Add tests for OpenGL 4.5 and SPIR-V universal 1.0 to ensure they still check monotonic layout. For universal 1.0, we're assuming it otherwise follows Vulkan rules for block layout. Fixes #1685
2018-07-10Description for Android buildJaebaek Seo1-0/+20
2018-07-10Use spv_result_t instead of boolArseny Kapoulkine1-1/+1
Using bool is confusing here, and results in an MSVC warning about an implicit cast to bool.
2018-07-10Disable Travis bots, and Appveyor Release bots.Ehsan Nasiri2-126/+5
Kokoro bots currently cover all Travis bots: macos-clang-debug macos-clang-release ubuntu-clang-debug ubuntu-clang-release ubuntu-gcc-debug ubuntu-gcc-release ndk-build android check-format Kokoro bots also cover all Windows Release builds: windows-VS2013-release windows-VS2015-release windows-VS2017-release Due to a compiler issue on the Kokoro Windows VM, we currently do not run the Debug build on Kokoro. Therefore, I am disabling all Travis jobs and the appveyor Release jobs.
2018-07-10Fix up code to make ClangTidy happy.Steven Perron2-12/+12
Just a few changes to pass `std::function` objects by const reference instead of by value.
2018-07-10Cleanup whitespace lint warnings. (#1690)dan sinclair15-209/+204
This CL cleans up the whitespace warnings and enables the check when running 'git cl presubmit --all -uf'.
2018-07-10Fix unused param errors when Effcee not presentSean Purcell2-2/+6
2018-07-10Convert validation to use libspriv::Instruction where possible. (#1663)dan sinclair25-699/+537
For the instructions which execute after the IdPass check we can provide the Instruction instead of the spv_parsed_instruction_t. This Instruction class provides a bit more context (like the source line) that is not available from spv_parsed_instruction_t.
2018-07-09Move the validation code into the val:: namespace (#1682)dan sinclair43-113/+185
This CL moves the validation code to the val:: namespace. This makes it clearer which instance of the Instruction and other classes are being referred too.