Skip to content

Commit 0391711

Browse files
authored
Revert "[SYCL-MLIR][NFC] Restructure Polygeist dialect" (#8356)
Reverts #8266
1 parent a1f1990 commit 0391711

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+548
-667
lines changed

mlir-sycl/include/mlir/Dialect/SYCL/Transforms/Passes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
#include "mlir/Pass/Pass.h"
1919

20-
#include "mlir/Dialect/Polygeist/IR/Polygeist.h"
20+
#include "polygeist/Dialect.h"
21+
#include "polygeist/Passes/Passes.h"
2122

2223
namespace mlir {
2324
namespace sycl {

mlir-sycl/lib/Conversion/SYCLToLLVM/SYCLToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
#include "mlir/Conversion/SYCLToLLVM/DialectBuilder.h"
1717
#include "mlir/Dialect/Func/IR/FuncOps.h"
1818
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
19-
#include "mlir/Dialect/Polygeist/Utils/Utils.h"
2019
#include "mlir/Dialect/SYCL/IR/SYCLOps.h"
2120
#include "mlir/IR/Builders.h"
2221
#include "mlir/IR/BuiltinOps.h"
2322
#include "mlir/IR/PatternMatch.h"
2423
#include "mlir/Support/LogicalResult.h"
2524
#include "mlir/Transforms/DialectConversion.h"
25+
#include "polygeist/Passes/Utils.h"
2626
#include "llvm/Support/Debug.h"
2727

2828
#define DEBUG_TYPE "sycl-to-llvm"

mlir-sycl/lib/Dialect/IR/MethodUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
#include "mlir/Dialect/Arith/IR/Arith.h"
1212
#include "mlir/Dialect/MemRef/IR/MemRef.h"
13-
#include "mlir/Dialect/Polygeist/IR/Ops.h"
1413
#include "mlir/Dialect/SYCL/IR/SYCLOps.h"
1514
#include "mlir/IR/Builders.h"
1615
#include "mlir/IR/ValueRange.h"
16+
#include "polygeist/Ops.h"
1717
#include "llvm/ADT/TypeSwitch.h"
1818

1919
#include <algorithm>

mlir-sycl/lib/Transforms/SYCLMethodToSYCLCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "mlir/Rewrite/FrozenRewritePatternSet.h"
2626
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
2727

28-
#include "mlir/Dialect/Polygeist/IR/Ops.h"
28+
#include "polygeist/Ops.h"
2929
#include "llvm/Support/Debug.h"
3030

3131
#define DEBUG_TYPE "sycl-method-to-sycl-call"

polygeist/include/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
add_subdirectory(mlir)
1+
add_subdirectory(polygeist)

polygeist/include/mlir/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

polygeist/include/mlir/Conversion/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

polygeist/include/mlir/Conversion/PolygeistPasses.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

polygeist/include/mlir/Conversion/PolygeistPasses.td

Lines changed: 0 additions & 53 deletions
This file was deleted.

polygeist/include/mlir/Conversion/PolygeistToLLVM/PolygeistToLLVMPass.h

Lines changed: 0 additions & 20 deletions
This file was deleted.

polygeist/include/mlir/Dialect/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

polygeist/include/mlir/Dialect/Polygeist/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

polygeist/include/mlir/Dialect/Polygeist/IR/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

polygeist/include/mlir/Dialect/Polygeist/IR/PolygeistBase.td

Lines changed: 0 additions & 20 deletions
This file was deleted.

polygeist/include/mlir/Dialect/Polygeist/Utils/BarrierUtils.h renamed to polygeist/include/polygeist/BarrierUtils.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
//===- BarrierUtils.h - Utilities for barrier removal ------------* C++ -*-===//
1+
//===- BarrierUtil.h - Utilities for barrier removal --------* C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef MLIR_DIALECT_POLYGEIST_UTILS_BARRIERUTILS_H_
10-
#define MLIR_DIALECT_POLYGEIST_UTILS_BARRIERUTILS_H_
9+
#ifndef MLIR_LIB_DIALECT_SCF_TRANSFORMS_BARRIERUTILS_H_
10+
#define MLIR_LIB_DIALECT_SCF_TRANSFORMS_BARRIERUTILS_H_
1111

1212
#include "mlir/Analysis/DataLayoutAnalysis.h"
1313
#include "mlir/Dialect/Func/IR/FuncOps.h"
1414
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
1515
#include "mlir/Dialect/MemRef/IR/MemRef.h"
16-
#include "mlir/Dialect/Polygeist/IR/Ops.h"
1716
#include "mlir/Dialect/SCF/IR/SCF.h"
1817
#include "mlir/IR/Block.h"
18+
#include "polygeist/Ops.h"
1919
#include "llvm/ADT/SetVector.h"
2020
#include <mlir/Dialect/Arith/IR/Arith.h>
2121

22-
namespace mlir {
2322
std::pair<mlir::Block *, mlir::Block::iterator>
2423
findInsertionPointAfterLoopOperands(mlir::scf::ParallelOp op);
2524

@@ -73,6 +72,5 @@ static T allocateTemporaryBuffer(mlir::OpBuilder &rewriter, mlir::Value value,
7372
auto type = MemRefType::get(bufferSize, ty);
7473
return rewriter.create<T>(value.getLoc(), type, iterationCounts);
7574
}
76-
} // namespace mlir
7775

78-
#endif // MLIR_DIALECT_POLYGEIST_UTILS_BARRIERUTILS_H_
76+
#endif // MLIR_LIB_DIALECT_SCF_TRANSFORMS_BARRIERUTILS_H_
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
add_mlir_dialect(PolygeistOps polygeist)
2+
add_mlir_doc(PolygeistDialect -gen-dialect-doc PolygeistDialect Polygeist/)
3+
add_mlir_doc(PolygeistOps -gen-op-doc PolygeistOps Polygeist/)
4+
5+
add_subdirectory(Passes)

polygeist/include/mlir/Dialect/Polygeist/IR/Polygeist.h renamed to polygeist/include/polygeist/Dialect.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef MLIR_DIALECT_POLYGEIST_IR_POLYGEIST_H_
10-
#define MLIR_DIALECT_POLYGEIST_IR_POLYGEIST_H_
9+
#ifndef BFV_BFVDIALECT_H
10+
#define BFV_BFVDIALECT_H
1111

1212
#include "mlir/IR/Dialect.h"
1313

14-
#include "mlir/Dialect/Polygeist/IR/PolygeistOpsDialect.h.inc"
14+
#include "polygeist/PolygeistOpsDialect.h.inc"
1515

16-
#endif // MLIR_DIALECT_POLYGEIST_IR_POLYGEIST_H_
16+
#endif // BFV_BFVDIALECT_H
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//===- BFVDialect.td - BFV dialect -----------*- tablegen -*-===//
2+
//
3+
// This file is licensed 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-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef POLYGEIST_DIALECT
10+
#define POLYGEIST_DIALECT
11+
12+
include "mlir/IR/OpBase.td"
13+
14+
//===----------------------------------------------------------------------===//
15+
// BFV dialect definition.
16+
//===----------------------------------------------------------------------===//
17+
18+
def Polygeist_Dialect : Dialect {
19+
let name = "polygeist";
20+
let description = [{}];
21+
let cppNamespace = "::mlir::polygeist";
22+
}
23+
24+
//===----------------------------------------------------------------------===//
25+
// Base BFV operation definition.
26+
//===----------------------------------------------------------------------===//
27+
28+
class Polygeist_Op<string mnemonic, list<Trait> traits = []>
29+
: Op<Polygeist_Dialect, mnemonic, traits>;
30+
31+
#endif // POLYGEIST_DIALECT

polygeist/include/mlir/Dialect/Polygeist/IR/Ops.h renamed to polygeist/include/polygeist/Ops.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef MLIR_DIALECT_POLYGEIST_IR_OPS_H_
10-
#define MLIR_DIALECT_POLYGEIST_IR_OPS_H_
9+
#ifndef POLYGEISTOPS_H
10+
#define POLYGEISTOPS_H
1111

1212
#include "mlir/Dialect/Affine/IR/AffineOps.h"
1313
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
@@ -22,7 +22,7 @@
2222
#include "llvm/Support/CommandLine.h"
2323

2424
#define GET_OP_CLASSES
25-
#include "mlir/Dialect/Polygeist/IR/PolygeistOps.h.inc"
25+
#include "polygeist/PolygeistOps.h.inc"
2626

2727
#include "mlir/Dialect/Affine/IR/AffineOps.h"
2828
#include "mlir/Dialect/SCF/IR/SCF.h"
@@ -147,4 +147,4 @@ class BarrierElim final
147147
}
148148
};
149149

150-
#endif // MLIR_DIALECT_POLYGEIST_IR_OPS_H_
150+
#endif // POLYGEISTOPS_H
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
set(LLVM_TARGET_DEFINITIONS Passes.td)
2-
mlir_tablegen(Passes.h.inc -gen-pass-decls -name Polygeist)
2+
mlir_tablegen(Passes.h.inc -gen-pass-decls -name polygeist)
33
add_public_tablegen_target(MLIRPolygeistPassIncGen)
4-
add_dependencies(mlir-headers MLIRPolygeistPassIncGen)
54

65
add_mlir_doc(Passes PolygeistPasses ./ -gen-pass-doc)
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
1-
#ifndef MLIR_DIALECT_POLYGEIST_TRANSFORMS_PASSES_H
2-
#define MLIR_DIALECT_POLYGEIST_TRANSFORMS_PASSES_H
1+
#ifndef POLYGEIST_DIALECT_POLYGEIST_PASSES_H
2+
#define POLYGEIST_DIALECT_POLYGEIST_PASSES_H
33

4+
#include "mlir/Conversion/LLVMCommon/LoweringOptions.h"
45
#include "mlir/Pass/Pass.h"
5-
66
#include <memory>
7-
87
namespace mlir {
98
class PatternRewriter;
109
class DominanceInfo;
1110
class LLVMTypeConverter;
1211
namespace polygeist {
13-
//===----------------------------------------------------------------------===//
14-
// Patterns
15-
//===----------------------------------------------------------------------===//
16-
17-
/// Collect a set of patterns to convert memory-related operations from the
18-
/// MemRef dialect to the LLVM dialect forcing a "bare pointer" calling
19-
/// convention.
20-
void populateBareMemRefToLLVMConversionPatterns(LLVMTypeConverter &converter,
21-
RewritePatternSet &patterns);
22-
23-
#define GEN_PASS_DECL
24-
#include "mlir/Dialect/Polygeist/Transforms/Passes.h.inc"
25-
2612
std::unique_ptr<Pass> createParallelLICMPass();
2713
std::unique_ptr<Pass> createMem2RegPass();
2814
std::unique_ptr<Pass> createLoopRestructurePass();
@@ -37,15 +23,49 @@ std::unique_ptr<Pass> detectReductionPass();
3723
std::unique_ptr<Pass> createRemoveTrivialUsePass();
3824
std::unique_ptr<Pass> createParallelLowerPass();
3925
std::unique_ptr<Pass> createLegalizeForSPIRVPass();
26+
std::unique_ptr<Pass>
27+
createConvertPolygeistToLLVMPass(const LowerToLLVMOptions &options);
28+
std::unique_ptr<Pass> createConvertPolygeistToLLVMPass();
4029

41-
//===----------------------------------------------------------------------===//
42-
// Registration
43-
//===----------------------------------------------------------------------===//
44-
45-
#define GEN_PASS_REGISTRATION
46-
#include "mlir/Dialect/Polygeist/Transforms/Passes.h.inc"
30+
/// Collect a set of patterns to convert memory-related operations from the
31+
/// MemRef dialect to the LLVM dialect forcing a "bare pointer" calling
32+
/// convention.
33+
void populateBareMemRefToLLVMConversionPatterns(LLVMTypeConverter &converter,
34+
RewritePatternSet &patterns);
4735

4836
} // namespace polygeist
4937
} // namespace mlir
5038

51-
#endif // MLIR_DIALECT_POLYGEIST_TRANSFORMS_PASSES_H
39+
void fully2ComposeAffineMapAndOperands(
40+
mlir::PatternRewriter &rewriter, mlir::AffineMap *map,
41+
llvm::SmallVectorImpl<mlir::Value> *operands, mlir::DominanceInfo &DI);
42+
bool isValidIndex(mlir::Value val);
43+
44+
namespace mlir {
45+
// Forward declaration from Dialect.h
46+
template <typename ConcreteDialect>
47+
void registerDialect(DialectRegistry &registry);
48+
49+
namespace scf {
50+
class SCFDialect;
51+
} // end namespace scf
52+
53+
namespace memref {
54+
class MemRefDialect;
55+
} // end namespace memref
56+
57+
namespace func {
58+
class FuncDialect;
59+
}
60+
61+
class AffineDialect;
62+
namespace LLVM {
63+
class LLVMDialect;
64+
}
65+
66+
#define GEN_PASS_REGISTRATION
67+
#include "polygeist/Passes/Passes.h.inc"
68+
69+
} // end namespace mlir
70+
71+
#endif // POLYGEIST_DIALECT_POLYGEIST_PASSES_H

0 commit comments

Comments
 (0)