-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[CI] Enable assertions for CI #987
Conversation
I don't think we should switch to debug mode in the CI. This will slow down compilation too much and make it untractable. is RelWithDebInfo somehow insufficient? |
@ptillet @Superjomn The commit passed CI but however it can not compile on my own machine, with an error (also seen as current CI results):
This is because template <typename To, typename From>
[[nodiscard]] inline decltype(auto) cast(From *Val) {
assert(isa<To>(Val) && "cast<Ty>() argument of incompatible type!");
return CastInfo<To, From *>::doCast(Val);
} , while But the problem is that the commit can pass CI because |
Another thing worth to mention is that the I suggest that we at least align the assertion behaviors. |
it seems like the solution would be to define |
LGTM, I'll change to that. |
@@ -223,7 +223,7 @@ struct TritonDotPattern : public OpConversionPattern<triton::DotOp> { | |||
ConversionPatternRewriter &rewriter) const override { | |||
RankedTensorType origType = op.getType().cast<RankedTensorType>(); | |||
auto origShape = origType.getShape(); | |||
auto typeConverter = cast<TritonGPUTypeConverter>(getTypeConverter()); | |||
auto typeConverter = static_cast<TritonGPUTypeConverter*>(getTypeConverter()); |
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 this bypass the classof
check? Seems not safe.
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.
Same comment here. Isn't cast
safer than static_cast
here?
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.
@ptillet
Yes, I agree. I've changed to auto typeConverter = getTypeConverter<TritonGPUTypeConverter>()
, which leverages the MLIR interface and looks better.
The official implement of this interface is:
template <typename ConverterTy>
std::enable_if_t<std::is_base_of<TypeConverter, ConverterTy>::value,
ConverterTy *>
getTypeConverter() const {
return static_cast<ConverterTy *>(typeConverter);
}
, which is also static_cast
but safely checks using std::is_base_of
.
Enable assertions by a new CMake build type
TRITON_REL_BUILD_WITH_ASSERTS
.