forked from jmgorius/mlir-standalone-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to LLVM commit c13b7485b87909fcf739f62cfa382b55407433c0 (#10)
Co-authored-by: github-actions <[email protected]>
- Loading branch information
1 parent
c29a66e
commit 65de7a3
Showing
32 changed files
with
378 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
LLVM_COMMIT=18ddebe1a1a9bde349441631365f0472e9693520 | ||
LLVM_COMMIT=c13b7485b87909fcf739f62cfa382b55407433c0 | ||
CMAKE_FLAGS='-DCMAKE_LINKER=lld -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DMLIR_DIR=$GITHUB_WORKSPACE/llvm-project/prefix/lib/cmake/mlir/ -DLLVM_DIR=$GITHUB_WORKSPACE/llvm-project/prefix/lib/cmake/llvm/ -DLLVM_EXTERNAL_LIT=$GITHUB_WORKSPACE/llvm-project/build/bin/llvm-lit' | ||
LLVM_REF=refs/tags/llvmorg-16.0.2 | ||
LLVM_REF=refs/tags/llvmorg-18.1.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
add_mlir_dialect(StandaloneOps standalone) | ||
add_mlir_doc(StandaloneDialect StandaloneDialect Standalone/ -gen-dialect-doc) | ||
add_mlir_doc(StandaloneOps StandaloneOps Standalone/ -gen-op-doc) | ||
|
||
set(LLVM_TARGET_DEFINITIONS StandalonePasses.td) | ||
mlir_tablegen(StandalonePasses.h.inc --gen-pass-decls) | ||
add_public_tablegen_target(MLIRStandalonePassesIncGen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//===- StandalonePasses.h - Standalone passes ------------------*- C++ -*-===// | ||
// | ||
// This file is licensed 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
#ifndef STANDALONE_STANDALONEPASSES_H | ||
#define STANDALONE_STANDALONEPASSES_H | ||
|
||
#include "Standalone/StandaloneDialect.h" | ||
#include "Standalone/StandaloneOps.h" | ||
#include "mlir/Pass/Pass.h" | ||
#include <memory> | ||
|
||
namespace mlir { | ||
namespace standalone { | ||
#define GEN_PASS_DECL | ||
#include "Standalone/StandalonePasses.h.inc" | ||
|
||
#define GEN_PASS_REGISTRATION | ||
#include "Standalone/StandalonePasses.h.inc" | ||
} // namespace standalone | ||
} // namespace mlir | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//===- StandalonePsss.td - Standalone dialect passes -------*- tablegen -*-===// | ||
// | ||
// This file is licensed 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef STANDALONE_PASS | ||
#define STANDALONE_PASS | ||
|
||
include "mlir/Pass/PassBase.td" | ||
|
||
def StandaloneSwitchBarFoo: Pass<"standalone-switch-bar-foo", "::mlir::ModuleOp"> { | ||
let summary = "Switches the name of a FuncOp named `bar` to `foo` and folds."; | ||
let description = [{ | ||
Switches the name of a FuncOp named `bar` to `foo` and folds. | ||
``` | ||
func.func @bar() { | ||
return | ||
} | ||
// Gets transformed to: | ||
func.func @foo() { | ||
return | ||
} | ||
``` | ||
}]; | ||
} | ||
|
||
#endif // STANDALONE_PASS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//===- StandaloneTypes.h - Standalone dialect types -------------*- C++ -*-===// | ||
// | ||
// This file is licensed 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef STANDALONE_STANDALONETYPES_H | ||
#define STANDALONE_STANDALONETYPES_H | ||
|
||
#include "mlir/IR/BuiltinTypes.h" | ||
|
||
#define GET_TYPEDEF_CLASSES | ||
#include "Standalone/StandaloneOpsTypes.h.inc" | ||
|
||
#endif // STANDALONE_STANDALONETYPES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//===- StandaloneTypes.td - Standalone dialect types -------*- tablegen -*-===// | ||
// | ||
// This file is licensed 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef STANDALONE_TYPES | ||
#define STANDALONE_TYPES | ||
|
||
include "mlir/IR/AttrTypeBase.td" | ||
include "Standalone/StandaloneDialect.td" | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Standalone type definitions | ||
//===----------------------------------------------------------------------===// | ||
|
||
class Standalone_Type<string name, string typeMnemonic, list<Trait> traits = []> | ||
: TypeDef<Standalone_Dialect, name, traits> { | ||
let mnemonic = typeMnemonic; | ||
} | ||
|
||
def Standalone_CustomType : Standalone_Type<"Custom", "custom"> { | ||
let summary = "Standalone custom type"; | ||
let description = "Custom type in standalone dialect"; | ||
let parameters = (ins StringRefParameter<"the custom value">:$value); | ||
let assemblyFormat = "`<` $value `>`"; | ||
} | ||
|
||
#endif // STANDALONE_TYPES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
add_mlir_dialect_library(MLIRStandalone | ||
StandaloneTypes.cpp | ||
StandaloneDialect.cpp | ||
StandaloneOps.cpp | ||
StandalonePasses.cpp | ||
|
||
ADDITIONAL_HEADER_DIRS | ||
${PROJECT_SOURCE_DIR}/include/Standalone | ||
|
||
DEPENDS | ||
MLIRStandaloneOpsIncGen | ||
MLIRStandalonePassesIncGen | ||
|
||
LINK_LIBS PUBLIC | ||
MLIRIR | ||
LINK_LIBS PUBLIC | ||
MLIRIR | ||
MLIRInferTypeOpInterface | ||
) | ||
MLIRFuncDialect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//===- StandalonePasses.cpp - Standalone passes -----------------*- C++ -*-===// | ||
// | ||
// This file is licensed 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
#include "mlir/Dialect/Func/IR/FuncOps.h" | ||
#include "mlir/IR/PatternMatch.h" | ||
#include "mlir/Rewrite/FrozenRewritePatternSet.h" | ||
#include "mlir/Support/LogicalResult.h" | ||
#include "mlir/Transforms/GreedyPatternRewriteDriver.h" | ||
|
||
#include "Standalone/StandalonePasses.h" | ||
|
||
namespace mlir::standalone { | ||
#define GEN_PASS_DEF_STANDALONESWITCHBARFOO | ||
#include "Standalone/StandalonePasses.h.inc" | ||
|
||
namespace { | ||
class StandaloneSwitchBarFooRewriter : public OpRewritePattern<func::FuncOp> { | ||
public: | ||
using OpRewritePattern<func::FuncOp>::OpRewritePattern; | ||
LogicalResult matchAndRewrite(func::FuncOp op, | ||
PatternRewriter &rewriter) const final { | ||
if (op.getSymName() == "bar") { | ||
rewriter.modifyOpInPlace(op, [&op]() { op.setSymName("foo"); }); | ||
return success(); | ||
} | ||
return failure(); | ||
} | ||
}; | ||
|
||
class StandaloneSwitchBarFoo | ||
: public impl::StandaloneSwitchBarFooBase<StandaloneSwitchBarFoo> { | ||
public: | ||
using impl::StandaloneSwitchBarFooBase< | ||
StandaloneSwitchBarFoo>::StandaloneSwitchBarFooBase; | ||
void runOnOperation() final { | ||
RewritePatternSet patterns(&getContext()); | ||
patterns.add<StandaloneSwitchBarFooRewriter>(&getContext()); | ||
FrozenRewritePatternSet patternSet(std::move(patterns)); | ||
if (failed(applyPatternsAndFoldGreedily(getOperation(), patternSet))) | ||
signalPassFailure(); | ||
} | ||
}; | ||
} // namespace | ||
} // namespace mlir::standalone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//===- StandaloneTypes.cpp - Standalone dialect types -----------*- C++ -*-===// | ||
// | ||
// This file is licensed 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "Standalone/StandaloneTypes.h" | ||
|
||
#include "Standalone/StandaloneDialect.h" | ||
#include "mlir/IR/Builders.h" | ||
#include "mlir/IR/DialectImplementation.h" | ||
#include "llvm/ADT/TypeSwitch.h" | ||
|
||
using namespace mlir::standalone; | ||
|
||
#define GET_TYPEDEF_CLASSES | ||
#include "Standalone/StandaloneOpsTypes.cpp.inc" | ||
|
||
void StandaloneDialect::registerTypes() { | ||
addTypes< | ||
#define GET_TYPEDEF_LIST | ||
#include "Standalone/StandaloneOpsTypes.cpp.inc" | ||
>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.