-
Notifications
You must be signed in to change notification settings - Fork 537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic SSA Validation #27
Conversation
umar456
commented
Nov 23, 2015
- Updated validation tests to assignment form
- Fixed function tests to handle multiple parameters
- Basic SSA Validation
if (SPV_OPERAND_TYPE_LITERAL_STRING == type) { | ||
spvCheckReturn(spvValidateOperandsString( | ||
words + index, wordCount - index, position, pDiagnostic)); | ||
// NOTE: String literals are always at the end of Opcodes | ||
break; | ||
} else if (SPV_OPERAND_TYPE_LITERAL_INTEGER == type) { | ||
spvCheckReturn(spvValidateOperandsLiteral( | ||
words + index, wordCount - index, 2, position, pDiagnostic)); | ||
// spvCheckReturn(spvValidateOperandsNumber( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you plan on re-enabling this code, then use:
#if 0
#endif
Around disabled code, and add a TODO(): to re-enable at some point
Otherwise just delete the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed da35d28
|
||
INSTANTIATE_TEST_CASE_P(KernelArgs, Validate, ::testing::ValuesIn(cases)); | ||
|
||
string SetOps(string &str, pair<string, bool> param) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const string &str
Ok, finished review of latest commit.
(and maybe other stuff I've forgotten by now.) |
Oh, and I forgot to thank you for making thorough checks for invalidity of each ID operand that can't be forward declared! |
|
||
if (!param.second) { | ||
regex ndrange_regex("[^\n]%ndval"); | ||
out2 = regex_replace(out, ndrange_regex, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't compile with GCC g++ 4.8.4
Validate.SSA.cpp:592:48: error: no matching function for call to ‘regex_replace(std::string&, std::regex&, const char [1])’
and later details say template argument deduction/substitution failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What compilers are we targeting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VisualStudio 2013. (e.g. no constexpr)
GCC 4.8.2 ; that's what comes with Ubunto 14.04 Trusty LTS.
A recent Clang, but I expect that will be at least as feature rich as the GCC.
I should document this in the README. :-(
FYI. The Chromium project notes gotchas with various compiler's C++11 support:
https://chromium-cpp.appspot.com/
E.g. you can see there that constexpr isn't supported in VisualStudio 2013
But we use more features of C++11 than Chromium allows, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I add a dependency to boost.regex or boost.xpressive?
* Update fixture to only run certian validation passes * Fixtures now return error codes * Fix fwd index for SpvOpEnqueueKernel * Add a SPV_VALIDATE_SSA_BIT for testing purposes * Enable several tests failing in ID validation * Fix OpEnqueueKernel usage (missing flag arg) * Formatting SPIR-V * Simplify test cases
Addressed the feedback thus far. |
|
Whoops, I was reviewing an older commit. Still looking... |
Done this round.
Recommend not adding new tests to this PR because they can potentially require further rounds of review. |
Addressed feedback so far. |
)"; | ||
CompileSuccessfully(str); | ||
ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); | ||
ASSERT_TRUE(ContainsString(getDiagnosticString(), "missing")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPTIONAL: Sorry I didn't think of this before. But we tend to use gmock matchers, so this would be:
ASSERT_THAT(getDiagnosticString(), HasSubstr("missing"));
(assuming early in the file you have:
#include "gmock/gmock.h"
using ::testing::HasSubstr
)
See https://github.com/google/googletest/blob/master/googlemock/docs/CheatSheet.md
It can be very powerful since there are so many predicates to apply. In particular, it's great at matching containers, with very good messages when things fail.
Good for future tests you write.
I'm satisfied with this for now. I plan to rebase and squash before pushing onto master. Also, I may have a few more OpPhi cases in mind. But they'll be fore later CLs. |
+2 |
Rebased, and made the following changes:
|
Squashed and pushed onto master. |