//===- TestMemRefDependenceCheck.cpp - Test dep analysis ------------------===// // // 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 a pass to run pair-wise memref access dependence checks. // //===----------------------------------------------------------------------===// #include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h" #include "mlir/Dialect/Affine/Analysis/AffineStructures.h" #include "mlir/Dialect/Affine/Analysis/Utils.h" #include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/IR/Builders.h" #include "mlir/Pass/Pass.h" #include "llvm/Support/Debug.h" #define DEBUG_TYPE … usingnamespacemlir; usingnamespacemlir::affine; namespace { // TODO: Add common surrounding loop depth-wise dependence checks. /// Checks dependences between all pairs of memref accesses in a Function. struct TestMemRefDependenceCheck : public PassWrapper<TestMemRefDependenceCheck, OperationPass<>> { … }; } // namespace // Returns a result string which represents the direction vector (if there was // a dependence), returns the string "false" otherwise. static std::string getDirectionVectorStr(bool ret, unsigned numCommonLoops, unsigned loopNestDepth, ArrayRef<DependenceComponent> dependenceComponents) { … } // For each access in 'loadsAndStores', runs a dependence check between this // "source" access and all subsequent "destination" accesses in // 'loadsAndStores'. Emits the result of the dependence check as a note with // the source access. static void checkDependences(ArrayRef<Operation *> loadsAndStores) { … } /// Walks the operation adding load and store ops to 'loadsAndStores'. Runs /// pair-wise dependence checks. void TestMemRefDependenceCheck::runOnOperation() { … } namespace mlir { namespace test { void registerTestMemRefDependenceCheck() { … } } // namespace test } // namespace mlir