| 42 | } |
| 43 | |
| 44 | llvm::SmallVector<AffineMap, 2> GetPermutationIfAvailable( |
| 45 | const Shape& shape, mlir::Builder builder) { |
| 46 | if (!shape.has_layout() || shape.layout().minor_to_major().empty()) { |
| 47 | return {}; |
| 48 | } |
| 49 | llvm::SmallVector<unsigned, 2> permutation; |
| 50 | for (auto dim : llvm::reverse(shape.layout().minor_to_major())) { |
| 51 | permutation.push_back(dim); |
| 52 | } |
| 53 | return {AffineMap::getPermutationMap(permutation, builder.getContext())}; |
| 54 | } |
| 55 | |
| 56 | } // namespace |
| 57 |
no test coverage detected