diff --git a/mlir/include/mlir/Dialect/Tosa/Transforms/TosaFoldCommon.h b/mlir/include/mlir/Dialect/Tosa/Transforms/TosaFoldCommon.h index 5ab0c8bca523b..6582bc31fc92e 100644 --- a/mlir/include/mlir/Dialect/Tosa/Transforms/TosaFoldCommon.h +++ b/mlir/include/mlir/Dialect/Tosa/Transforms/TosaFoldCommon.h @@ -20,26 +20,26 @@ namespace mlir { namespace tosa { -// Transform a tensor with the given transformation function. +/// Transform a tensor with the given transformation function. DenseElementsAttr applyElementWise( const DenseElementsAttr &toTransform, const std::function &toApply); -/// Function that checks if arg is a dense TOSA constant float tensor +/// Function that checks if \p toCheck is a dense TOSA constant float tensor. LogicalResult notifyIfNotConstantFloatTosaTensor(TypedValue toCheck, TosaOp location, PatternRewriter &); -/// Function that checks if arg is a dense TOSA constant tensor +/// Function that checks if \p toCheck is a dense TOSA constant tensor. LogicalResult notifyIfNoTosaDenseConstantTensor(TypedValue toCheck, TosaOp location, PatternRewriter &); -/// Function that checks if the contained type is float +/// Function that checks if the type contained in \p toCheck is float. LogicalResult notifyIfNotFloat(TypedValue toCheck, TosaOp location, PatternRewriter &); -/// Function to compute the reciprocal +/// Function to compute the reciprocal. APFloat computeReciprocal(const APFloat &, Type); } // namespace tosa diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaFoldCommon.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaFoldCommon.cpp index 3188acb29948e..c4e0b6e9fa2a1 100644 --- a/mlir/lib/Dialect/Tosa/Transforms/TosaFoldCommon.cpp +++ b/mlir/lib/Dialect/Tosa/Transforms/TosaFoldCommon.cpp @@ -34,11 +34,11 @@ DenseElementsAttr mlir::tosa::applyElementWise( // all of them to avoid dynamic resizing transformedValues.reserve(toTransform.getNumElements()); for (auto val : toTransform.getValues()) { - auto recipVal = toApply(val, toTransform.getElementType()); - transformedValues.push_back(recipVal); + auto transformedVal = toApply(val, toTransform.getElementType()); + transformedValues.push_back(transformedVal); } - // Replace the current tensor with one containing the computed reciprocals + // Replace the current tensor with one containing the computed values auto newTensor = DenseElementsAttr::get(toTransform.getType(), transformedValues); return newTensor;