-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[HLSL][RootSignature] Audit RootSignatureParser
diagnostic production
#147800
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
Conversation
7d8fa5d
to
70448a3
Compare
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.
Seems fine to me.
- It has been noted more than once that this diagnostic is confusing and misleading. It can be more concise
the order of the parameters is switched as opposed to either and this was not caught in the unit tests
70448a3
to
8e55607
Compare
Hey, this seems to have broken https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-cmake-RA-expensive/4708/testReport/Clang/SemaHLSL/RootSignature_resource_ranges_err_hlsl/, would you mind looking into it? |
@guy-david Thanks for pointing this out, I have a similar report here. I am taking a look into both now, but I suspect they might be the same issue. |
…ent association (#148649) - when there are duplicate (equivalent) `RangeInfo`s created we will attempt to `llvm::sort` or `llvm::stable_sort` them, it does not appear deterministic in which order they will be sorted (because they are equivalent) - when `DLLVM_ENABLE_EXSTENSIVE_CHECKS` is enabled, it appears to deal with this tie-breaker sorting the list differently than when it is not enabled, this causes one of the test cases to fail because the diagnostic is produced, not in a different order, but with a different root element associated with an identical `RangeInfo` - functionally this makes no difference to the diagnostic being produced and the removed test-case was added just as a nicety to demonstrate how the diagnostics might look - the test above the removed will correctly demonstrate that the `SourceLocation` will be set to the correct column, and, the `-verify` portion of this testcase will ensure that we still generate a diagnostic for each duplicate - therefore, it is safe to remove this portion of the test-case that can have a non-deterministic association of root element This resolves the build issues reported [here](#147115 (comment)) and [here](#147800 (comment))
…c root element association (#148649) - when there are duplicate (equivalent) `RangeInfo`s created we will attempt to `llvm::sort` or `llvm::stable_sort` them, it does not appear deterministic in which order they will be sorted (because they are equivalent) - when `DLLVM_ENABLE_EXSTENSIVE_CHECKS` is enabled, it appears to deal with this tie-breaker sorting the list differently than when it is not enabled, this causes one of the test cases to fail because the diagnostic is produced, not in a different order, but with a different root element associated with an identical `RangeInfo` - functionally this makes no difference to the diagnostic being produced and the removed test-case was added just as a nicety to demonstrate how the diagnostics might look - the test above the removed will correctly demonstrate that the `SourceLocation` will be set to the correct column, and, the `-verify` portion of this testcase will ensure that we still generate a diagnostic for each duplicate - therefore, it is safe to remove this portion of the test-case that can have a non-deterministic association of root element This resolves the build issues reported [here](llvm/llvm-project#147115 (comment)) and [here](llvm/llvm-project#147800 (comment))
This pr audits the diagnostics produced in
RootSignatureParser
diagnostics.First, it has been noted more than once that the current
diag::err_hlsl_unexpected_end_of_params
is not direct and can be misleading. For instance, here and here.This pr address this by removing this diagnostic and replacing it with a more direct
diag::err_expected_either
. However, doing so removes the nuance between the case where it is a missing comma and when it was an invalid parameter.Hence, we introduce the
diag::err_hlsl_invalid_token
for the latter case, which does so in a direct way. Further, we can apply the same diagnostic to the parsing of parameter values.As part of this, we see that there was a test gap in testing the diagnostics produced from
diag::err_expected_after
and for the parsing of enum/flag values. As such, these are also addressed here to provide sufficient unit/sema test coverage.diag::err_hlsl_unexpected_end_of_params
inRootSigantureParser
diag::err_hlsl_invalid_token
to provide a direct diagnosticdiag::err_hlsl_invalid_token
ordiag::err_expected_either
accordinglyHLSLRootSignatureParserTest
to account for diagnostic changesHLSLRootSignatureParserTest
for enum/flag diagnosticsRootSignatures-err
for enum/flag diagnosticsdiag::err_expected_after
and add test to demonstrate usageResolves: #147799