-
Notifications
You must be signed in to change notification settings - Fork 697
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
HLMatrixLower: allow exceptions to propagate out #6710
Conversation
cc: @amaiorano |
…tdout Add support for 'xfailcat' in RUN: commands. It requires the prior command to fail, and also propagates stdout and stderr. This is useful for cases for parsing error messages, example // RUN: %dxc -T cs_6_0 will_fail.hlsl %s | xfailcat | FileCheck %s // CHECK: error: something blah blah This is an alternativ to supporting 'not'. Also, modify the test from microsoft#6710 to check the error message
tools/clang/test/HLSLFileCheck/passes/hl/hl_matrix_lower/dont_crash_on_invalid_cast.hlsl
Outdated
Show resolved
Hide resolved
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.
LGTM
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.
Is there a way that we can instead have an explicit report_fatal_error
call for these error cases rather than failing because an exception is thrown due to a bad cast?
I hate DXC's reliance on exceptions, so it would be preferable to make the error explicit (even if report_fatal_error does just throw an exception in DXC).
In this case it comes from a failed checked cast. There are over a dozen of them in that pass: cast<FixedVectorType>(LoweredDstTy)->getNumElements(),
cast<FixedVectorType>(LoweredVec->getType())->getNumElements(),
cast<FixedVectorType>(Result->getType())->getNumElements();
cast<PointerType>(HLMatrixType::getLoweredType(Global->getType()));
cast<PointerType>(HLMatrixType::getLoweredType(MatAlloca->getType()));
cast<VectorType>(LoweredRhs->getType()),
Constant *IdxVec = cast<Constant>(
DXASSERT(cast<ConstantInt>(*GEP->idx_begin())->isZero(),
DXASSERT(cast<FixedVectorType>(Result->getType())->getNumElements() ==
DXASSERT(cast<VectorType>(LoweredLhs->getType()) &&
Function *Func = cast<Function>(Module.getOrInsertFunction(MangledName, Ty));
IRBuilder<> Builder(cast<Instruction>(Use.getUser()));
return cast<Constant>(MatTy.emitLoweredRegToMem(Vec, DummyBuilder));
VectorType *IdxVecTy = cast<VectorType>(IdxVec->getType());
VectorType *VecTy = cast<VectorType>(LoweredVal->getType()); I don't know which one is triggered for the given test case. Do you mean something like rewriting the code to use dyn_cast and then explicitly handle the null return case? So the error is in apparent from the code? The exception is thrown from https://github.com/microsoft/DirectXShaderCompiler/blame/b197bec653c11d50103c6971a9ccde7fa3cacc93/lib/Support/ErrorHandling.cpp#L143 |
If an exception is thrown, don't block it in the TempOverloadPool destructor. Allow it to propagate out as a user-visible error. Explicitly clear the TempOverloadPool before returning from the HLMatrixLowerPass::runOnModule. In the normal case, when no exception is thrown, that will still verify that all the overloads actually have been lowered, and will assert out if they aren't.
It needs to be in the Clang tree because it uses dxopt. Add a TODO in the test pointing at the bug for the permanent fix.
I rebased, and moved the test so it's lit-based and uses dxopt. |
If an exception is thrown, don't block it in the TempOverloadPool destructor. Allow it to propagate out as a user-visible error.
Explicitly clear the TempOverloadPool before returning from the HLMatrixLowerPass::runOnModule. In the normal case, when no exception is thrown, that will still verify that all the overloads actually have been lowered, and will assert out if they aren't.