xref: /llvm-project/mlir/lib/Dialect/Tosa/Utils/ConversionUtils.cpp (revision 310e9636caeb2f3f02f3cc5bc2f180248061bbe5)
1 //===- ConversionUtils.cpp ------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Utility functions for TOSA lowering
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "mlir/Dialect/Tosa/Utils/CoversionUtils.h"
14 
15 using namespace mlir;
16 using namespace mlir::tosa;
17 
18 SmallVector<StringRef>
19 mlir::tosa::getNParallelLoopsAttrs(unsigned nParallelLoops) {
20   return SmallVector<StringRef>(nParallelLoops, getParallelIteratorTypeName());
21 }
22 
23 SmallVector<Value>
24 mlir::tosa::condenseValues(const SmallVector<Value> &values) {
25   SmallVector<Value> condensedValues;
26   for (auto value : values)
27     if (value)
28       condensedValues.push_back(value);
29   return condensedValues;
30 }
31