//===- TensorToSPIRV.cpp - Tensor to SPIR-V Patterns ----------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements patterns to convert Tensor dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// #include "mlir/Conversion/TensorToSPIRV/TensorToSPIRV.h" #include "../SPIRVCommon/Pattern.h" #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h" #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h" #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h" #include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h" #include "mlir/Dialect/Tensor/IR/Tensor.h" #include "mlir/IR/AffineMap.h" #include "llvm/Support/Debug.h" #define DEBUG_TYPE … usingnamespacemlir; //===----------------------------------------------------------------------===// // Operation conversion //===----------------------------------------------------------------------===// namespace { /// Converts tensor.extract into loading using access chains from SPIR-V local /// variables. class TensorExtractPattern final : public OpConversionPattern<tensor::ExtractOp> { … }; } // namespace //===----------------------------------------------------------------------===// // Pattern population //===----------------------------------------------------------------------===// void mlir::populateTensorToSPIRVPatterns( const SPIRVTypeConverter &typeConverter, int64_t byteCountThreshold, RewritePatternSet &patterns) { … }