[PATCH] D72781: [Matrix] Add __builtin_matrix_column_load to Clang.
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 8 16:06:42 PDT 2020
rjmccall added inline comments.
================
Comment at: clang/lib/Sema/SemaChecking.cpp:15130
+
+ ElementTy.removeLocalConst();
+ if (!ConstantMatrixType::isValidElementType(ElementTy)) {
----------------
fhahn wrote:
> rjmccall wrote:
> > It's almost never correct to do "local" qualifier manipulation in Sema. You want to remove the `const` qualifier, which means removing it through however much type sugar might be wrapping it.
> >
> > In reality, though, you actually want to remove *all* qualifiers, not just `const`. So you should just use `getUnqualifiedType()`. (And then you need to make sure that the IRGen code works on arbitrarily-qualified pointers. It should already handle address spaces unless you're doing something very strange. To handle `volatile`, you just need to be able to pass down a `volatile` flag to your helper function. The other qualifiers should all either not require special handling or not be allowed on integer/float types.)
> > In reality, though, you actually want to remove *all* qualifiers, not just const. So you should just use getUnqualifiedType(). (And then you need to make sure that the IRGen code works on arbitrarily-qualified pointers. It should already handle address spaces unless you're doing something very strange. To handle volatile, you just need to be able to pass down a volatile flag to your helper function. The other qualifiers should all either not require special handling or not be allowed on integer/float types.)
>
> Updated. Currently volatile cannot be specified for the `@llvm.matrix.columnwise.load/store` builtins. I'll put up an update for the intrinsics, for now I added an assertion in IRGen. I recently put up a patch that allows adding nuw/nsw info to the multiply builtin using operand bundles (D81166). For volatile, we could add another bundle or a boolean argument like we have for memcpy intrinsic I think. I am leaning towards an operand bundle version for this optional argument. Do you have any preference?
The only thing I really care about is that it can't be dropped implicitly. That's not legal with a bundle, but it's maybe a little more likely as an error of omission. On the other hand, you do need to pass down an alignment, and that really shouldn't be an optional argument, so maybe that's an opportunity to add a `volatile` argument as well.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72781/new/
https://reviews.llvm.org/D72781
More information about the cfe-commits
mailing list