40 const auto *MatchedDecl = Result.Nodes.getNodeAs<FunctionDecl>(
"function");
41 const auto *MatchedBarrier = Result.Nodes.getNodeAs<CallExpr>(
"barrier");
42 if (AOCVersion < 1701) {
44 diag(MatchedDecl->getLocation(),
45 "kernel function %0 does not call 'get_global_id' or 'get_local_id' "
46 "and will be treated as a single work-item")
48 diag(MatchedBarrier->getBeginLoc(),
49 "barrier call is in a single work-item and may error out",
54 bool IsNDRange =
false;
55 if (MatchedDecl->hasAttr<ReqdWorkGroupSizeAttr>()) {
56 const auto *Attribute = MatchedDecl->getAttr<ReqdWorkGroupSizeAttr>();
57 auto Eval = [&](Expr *E) {
58 return E->EvaluateKnownConstInt(MatchedDecl->getASTContext())
61 if (Eval(Attribute->getXDim()) > 1 || Eval(Attribute->getYDim()) > 1 ||
62 Eval(Attribute->getZDim()) > 1)
67 diag(MatchedDecl->getLocation(),
68 "kernel function %0 does not call an ID function and may be a viable "
69 "single work-item, but will be forced to execute as an NDRange")
71 diag(MatchedBarrier->getBeginLoc(),
72 "barrier call will force NDRange execution; if single work-item "
73 "semantics are desired a mem_fence may be more efficient",