49 lines · cpp
1//===- TestSPIRVVectorUnrolling.cpp - Test signature conversion -===//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-exception6//7//===-------------------------------------------------------------------===//8 9#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"10#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"11#include "mlir/Dialect/UB/IR/UBOps.h"12#include "mlir/Dialect/Vector/IR/VectorOps.h"13#include "mlir/Pass/Pass.h"14#include "mlir/Pass/PassManager.h"15 16namespace mlir {17namespace {18 19struct TestSPIRVVectorUnrolling final20 : PassWrapper<TestSPIRVVectorUnrolling, OperationPass<ModuleOp>> {21 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestSPIRVVectorUnrolling)22 23 StringRef getArgument() const final { return "test-spirv-vector-unrolling"; }24 25 StringRef getDescription() const final {26 return "Test patterns that unroll vectors to types supported by SPIR-V";27 }28 29 void getDependentDialects(DialectRegistry ®istry) const override {30 registry31 .insert<spirv::SPIRVDialect, vector::VectorDialect, ub::UBDialect>();32 }33 34 void runOnOperation() override {35 Operation *op = getOperation();36 (void)spirv::unrollVectorsInSignatures(op);37 (void)spirv::unrollVectorsInFuncBodies(op);38 }39};40 41} // namespace42 43namespace test {44void registerTestSPIRVVectorUnrolling() {45 PassRegistration<TestSPIRVVectorUnrolling>();46}47} // namespace test48} // namespace mlir49