================
@@ -6180,10 +6180,13 @@ static void handleLaunchBoundsAttr(Sema &S, Decl *D,
const ParsedAttr &AL) {
AL.getNumArgs() > 2 ? AL.getArgAsExpr(2) : nullptr);
}
-static std::pair<Expr *, int>
+static std::pair<Expr *, uint64_t>
makeClusterDimsArgExpr(Sema &S, Expr *E, const CUDAClusterDimsAttr &AL,
const unsigned Idx) {
- if (!E || S.DiagnoseUnexpandedParameterPack(E))
+ if (!E)
+ return {nullptr, 1};
+
+ if (S.DiagnoseUnexpandedParameterPack(E))
----------------
petar-jovanovic wrote:
> I meant to ask the `!E` case, since it was `{}` before, but now it is
> `{nullptr, 1}`.
I was responding to your comment on !E. Just follow the previous path with
cluster_dims(15,15) and you will see that we would return wrong result. !E is
not a failure path; it represents an omitted dimension. Since FlatDim is
computed as a product, an omitted dimension must contribute 1, not 0.
Previously cluster_dims(15, 15) was evaluated as 15 * 15 * 0, which disabled
the flat-size check and incorrectly accepted a 225-block cluster. The change
only fixes that value; the Expr * remains nullptr and the existing caller logic
is unchanged.
https://github.com/llvm/llvm-project/pull/230186
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits