Skip to content

Commit

Permalink
added further file comments and restructured tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Berke-Ates committed Aug 10, 2023
1 parent c7f87b7 commit 7ec5e43
Show file tree
Hide file tree
Showing 126 changed files with 84 additions and 315 deletions.
2 changes: 2 additions & 0 deletions lib/SDFG/Conversion/GenericToSDFG/ConvertGenericToSDFG.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file defines a converter from builtin dialects to the SDFG dialect.

#include "SDFG/Conversion/GenericToSDFG/PassDetail.h"
#include "SDFG/Conversion/GenericToSDFG/Passes.h"
#include "SDFG/Dialect/Dialect.h"
Expand Down
2 changes: 2 additions & 0 deletions lib/SDFG/Conversion/LinalgToSDFG/ConvertLinalgToSDFG.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file defines a converter from the linalg dialect to the SDFG dialect.

#include "SDFG/Conversion/LinalgToSDFG/PassDetail.h"
#include "SDFG/Conversion/LinalgToSDFG/Passes.h"
#include "SDFG/Dialect/Dialect.h"
Expand Down
54 changes: 28 additions & 26 deletions lib/SDFG/Conversion/SDFGToGeneric/ConvertSDFGToGeneric.cpp
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

#include "SDFG/Conversion/SDFGToGeneric/OpCreators.h"
#include "SDFG/Conversion/SDFGToGeneric/PassDetail.h"
#include "SDFG/Conversion/SDFGToGeneric/Passes.h"
#include "SDFG/Conversion/SDFGToGeneric/SymbolicParser.h"
#include "SDFG/Dialect/Dialect.h"
#include "SDFG/Utils/Utils.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/Transforms/DialectConversion.h"

using namespace mlir;
using namespace sdfg;
using namespace conversion;

/// Maps state name to their generated block
llvm::StringMap<Block *> blockMap;

/// For each function scope, map symbols to values
/// Function scope is determined by the function name
llvm::StringMap<llvm::StringMap<Value>> symbolMap;

// HACK: Keeps track of processed EdgeOps
llvm::DenseSet<EdgeOp> processedEdges;
/// This file defines a converter from the SDFG dialect to the builtin dialects.

//
// SDFG -> func.func
Expand Down Expand Up @@ -53,6 +28,33 @@ llvm::DenseSet<EdgeOp> processedEdges;
// Consume -> TBD
//

#include "SDFG/Conversion/SDFGToGeneric/OpCreators.h"
#include "SDFG/Conversion/SDFGToGeneric/PassDetail.h"
#include "SDFG/Conversion/SDFGToGeneric/Passes.h"
#include "SDFG/Conversion/SDFGToGeneric/SymbolicParser.h"
#include "SDFG/Dialect/Dialect.h"
#include "SDFG/Utils/Utils.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/Transforms/DialectConversion.h"

using namespace mlir;
using namespace sdfg;
using namespace conversion;

/// Maps state name to their generated block
llvm::StringMap<Block *> blockMap;

/// For each function scope, map symbols to values
/// Function scope is determined by the function name
llvm::StringMap<llvm::StringMap<Value>> symbolMap;

// HACK: Keeps track of processed EdgeOps
llvm::DenseSet<EdgeOp> processedEdges;

//===----------------------------------------------------------------------===//
// Target & Type Converter
//===----------------------------------------------------------------------===//
Expand Down
3 changes: 3 additions & 0 deletions lib/SDFG/Conversion/SDFGToGeneric/OpCreators.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains convenience functions that build, create and insert
/// various operations.

#include "SDFG/Conversion/SDFGToGeneric/OpCreators.h"

using namespace mlir;
Expand Down
17 changes: 9 additions & 8 deletions lib/SDFG/Conversion/SDFGToGeneric/SymbolicParser.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

#include "SDFG/Conversion/SDFGToGeneric/SymbolicParser.h"
#include "SDFG/Conversion/SDFGToGeneric/OpCreators.h"
#include <regex>

using namespace mlir;
using namespace sdfg::conversion;

// Implements a simple LL(1) parser for symbolic expressions
/// This file implements a simple LL(1) parser for symbolic expressions.

/*
// Grammar
stmt ::= assignment | log_or_expr
assignment ::= IDENT ASSIGN log_or_expr
Expand Down Expand Up @@ -71,6 +65,13 @@ LETTER ::= [_a-zA-Z];
*/

#include "SDFG/Conversion/SDFGToGeneric/SymbolicParser.h"
#include "SDFG/Conversion/SDFGToGeneric/OpCreators.h"
#include <regex>

using namespace mlir;
using namespace sdfg::conversion;

namespace mlir::sdfg::conversion {

//===----------------------------------------------------------------------===//
Expand Down
3 changes: 3 additions & 0 deletions lib/SDFG/Dialect/Dialect.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the SDFG dialect initializer and the type definitions,
/// such as parsing, printing and utility functions.

#include "SDFG/Dialect/Dialect.h"
#include "mlir/IR/Builders.h"
#include "llvm/ADT/TypeSwitch.h"
Expand Down
3 changes: 3 additions & 0 deletions lib/SDFG/Dialect/Ops.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains SDFG operation definitions, such as parsing, printing and
/// utility functions.

#include "SDFG/Dialect/Dialect.h"
#include "SDFG/Utils/Utils.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
Expand Down
3 changes: 3 additions & 0 deletions lib/SDFG/Translate/JsonEmitter.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains a JSON emitter, which constraints the generated output
/// stream to valid JSON.

#include "SDFG/Translate/JsonEmitter.h"
#include "mlir/IR/Types.h"

Expand Down
2 changes: 2 additions & 0 deletions lib/SDFG/Translate/Node.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the nodes of the internal IR used by the translator.

#include "SDFG/Translate/Node.h"

using namespace mlir;
Expand Down
3 changes: 3 additions & 0 deletions lib/SDFG/Translate/liftToPython.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains a Python lifter, which lifts MLIR operations to Python
/// code.

#include "SDFG/Translate/liftToPython.h"
#include "SDFG/Utils/Utils.h"

Expand Down
2 changes: 2 additions & 0 deletions lib/SDFG/Translate/registration.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the translation pass registration.

#include "SDFG/Translate/Translation.h"
#include "mlir/InitAllDialects.h"
#include "mlir/Tools/mlir-translate/Translation.h"
Expand Down
4 changes: 4 additions & 0 deletions lib/SDFG/Translate/translateToSDFG.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains function to translate the SDFG dialect to the SDFG IR. It
/// performs the translation in two passes. First it collects all operations and
/// generates an internal IR, which in the second pass is used to generate JSON.

#include "SDFG/Translate/Node.h"
#include "SDFG/Translate/Translation.h"
#include "SDFG/Translate/liftToPython.h"
Expand Down
2 changes: 2 additions & 0 deletions lib/SDFG/Utils/AttributeToString.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the attribute to string utility functions.

#include "SDFG/Utils/AttributeToString.h"
#include "SDFG/Utils/Utils.h"

Expand Down
2 changes: 2 additions & 0 deletions lib/SDFG/Utils/GetParents.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the parent utility functions.

#include "SDFG/Utils/GetParents.h"

namespace mlir::sdfg::utils {
Expand Down
2 changes: 2 additions & 0 deletions lib/SDFG/Utils/GetSizedType.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the sized type utility functions.

#include "SDFG/Utils/GetSizedType.h"

namespace mlir::sdfg::utils {
Expand Down
2 changes: 2 additions & 0 deletions lib/SDFG/Utils/IDGenerator.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the ID generator utility functions.

#include "SDFG/Utils/IDGenerator.h"

namespace mlir::sdfg::utils {
Expand Down
2 changes: 2 additions & 0 deletions lib/SDFG/Utils/NameGenerator.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the name generator utility functions.

#include "SDFG/Utils/NameGenerator.h"

namespace mlir::sdfg::utils {
Expand Down
2 changes: 2 additions & 0 deletions lib/SDFG/Utils/OperationToString.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the operation to string utility functions.

#include "SDFG/Utils/OperationToString.h"
#include "SDFG/Utils/Utils.h"
#include "mlir/IR/AsmState.h"
Expand Down
2 changes: 2 additions & 0 deletions lib/SDFG/Utils/Sanitizer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the sanitizer utility functions.

#include "SDFG/Utils/Sanitizer.h"

using namespace mlir;
Expand Down
2 changes: 2 additions & 0 deletions lib/SDFG/Utils/ValueToString.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the value to string utility functions.

#include "SDFG/Utils/ValueToString.h"
#include "SDFG/Utils/Utils.h"
#include "mlir/IR/AsmState.h"
Expand Down
2 changes: 2 additions & 0 deletions sdfg-opt/sdfg-opt.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the SDFG optimizer with the conversion passes.

#include "mlir/InitAllDialects.h"
#include "mlir/InitAllPasses.h"
#include "mlir/Pass/Pass.h"
Expand Down
2 changes: 2 additions & 0 deletions sdfg-translate/sdfg-translate.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2023, Scalable Parallel Computing Lab, ETH Zurich

/// This file contains the SDFG translator with the translation passes.

#include "mlir/InitAllTranslations.h"
#include "mlir/Support/LogicalResult.h"
#include "mlir/Tools/mlir-translate/MlirTranslateMain.h"
Expand Down
6 changes: 0 additions & 6 deletions sdfg_gen/gen_all.sh

This file was deleted.

Loading

0 comments on commit 7ec5e43

Please sign in to comment.