18 Operation *op, gpu::Dimension dim, std::optional<uint32_t> opUpperBound,
31 gpu::GPUDialect::KnownBlockSizeAttrHelper(op->
getContext());
32 if (blockHelper.isAttrPresent(funcOp))
33 funcBounds = blockHelper.getAttr(funcOp);
38 gpu::GPUDialect::KnownGridSizeAttrHelper(op->
getContext());
39 if (gridHelper.isAttrPresent(funcOp))
40 funcBounds = gridHelper.getAttr(funcOp);
45 gpu::GPUDialect::KnownClusterSizeAttrHelper(op->
getContext());
46 if (clusterHelper.isAttrPresent(funcOp))
47 funcBounds = clusterHelper.getAttr(funcOp);
57 funcBounds = gpuFunc.getKnownBlockSizeAttr();
60 funcBounds = gpuFunc.getKnownGridSizeAttr();
63 funcBounds = gpuFunc.getKnownClusterSizeAttr();
69 std::optional<uint32_t> upperBound;
71 upperBound = funcBounds.
asArrayRef()[
static_cast<uint32_t
>(dim)];
73 upperBound = *opUpperBound;
80 llvm::SaturatingAdd(*upperBound, (intrType ==
IntrType::Id ? 0u : 1u));
LLVM::ConstantRangeAttr getIndexOpRange(Operation *op, gpu::Dimension dim, std::optional< uint32_t > opUpperBound, IndexKind indexKind, IntrType intrType, unsigned bitWidth)
Returns a ConstantRangeAttr for a GPU index op, or nullptr if no bounds are found.