Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ module(
)

# Dependencies available in BCR
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_python", version = "1.2.0")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "rules_java", version = "8.12.0")
bazel_dep(name = "protobuf", version = "30.1")

bazel_dep(name = "apple_support", version = "1.24.1", repo_name = "build_bazel_apple_support")
bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_java", version = "9.6.1")
bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "protobuf", version = "31.1", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_android", version = "0.6.6")
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")
bazel_dep(name = "rules_python", version = "1.6.3")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "zlib-ng", version = "2.0.7", repo_name = "llvm_zlib")
bazel_dep(name = "zstd", version = "1.5.7", repo_name = "llvm_zstd")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "re2", version = "2024-07-02.bcr.1")
Expand All @@ -29,7 +36,6 @@ bazel_dep(name = "pcre2", version = "10.46-DEV")
bazel_dep(name = "glpk", version = "5.0.bcr.4")
bazel_dep(name = "bliss", version = "0.73")
bazel_dep(name = "scip", version = "9.2.0.bcr.3")
bazel_dep(name = "zlib-ng", version = "2.0.7")

# Hedron's Compile Commands Extractor for Bazel
# https://github.com/hedronvision/bazel-compile-commands-extractor
Expand All @@ -46,8 +52,6 @@ git_override(
mlir_tutorial_deps = use_extension("//:extensions.bzl", "mlir_tutorial_deps")
use_repo(mlir_tutorial_deps,
"llvm-raw",
"llvm_zstd",
"llvm_zlib"
)

# The subset of LLVM backend targets that should be compiled
Expand All @@ -58,7 +62,6 @@ _LLVM_TARGETS = [
# depends on the //llvm:NVPTXCodeGen target, which is not defined unless this
# is included. @j2kun asked the LLVM maintiners for tips on how to fix this,
# see https://github.com/llvm/llvm-project/issues/63135
"NVPTX",
# Needed for Apple M1 targets, see
# https://github.com/j2kun/mlir-tutorial/issues/11
"AArch64",
Expand All @@ -82,4 +85,4 @@ pip.parse(
python_version = "3.13",
requirements_lock = "//:requirements.txt",
)
use_repo(pip, "mlir_tutorial_pip_deps")
use_repo(pip, "mlir_tutorial_pip_deps")
27 changes: 2 additions & 25 deletions extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,9 @@ def _mlir_tutorial_deps_impl(module_ctx):
new_git_repository(
name = "llvm-raw",
build_file_content = "# empty",
commit = "d9190f8141661bd6120dea61d28ae8940fd775d0",
commit = "092c7ca38f44b25301e6566a28f52c704248e081",
init_submodules = False,
remote = "https://github.com/llvm/llvm-project.git",
)

# Optional LLVM dependencies for performance
maybe(
http_archive,
name = "llvm_zstd",
build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD",
sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0",
strip_prefix = "zstd-1.5.2",
urls = [
"https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz",
],
)

maybe(
http_archive,
name = "llvm_zlib",
build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD",
sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731",
strip_prefix = "zlib-ng-2.0.7",
urls = [
"https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip",
],
remote = "https://github.com/vimarsh6739/llvm-project.git",
)

mlir_tutorial_deps = module_extension(
Expand Down
2 changes: 1 addition & 1 deletion lib/Transform/Affine/AffineFullUnrollPatternRewrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct AffineFullUnrollPatternRewrite
patterns.add<AffineFullUnrollPattern>(&getContext());
// One could use GreedyRewriteConfig here to slightly tweak the behavior of
// the pattern application.
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
(void)applyPatternsGreedily(getOperation(), std::move(patterns));
}
};

Expand Down
2 changes: 1 addition & 1 deletion lib/Transform/Arith/MulToAdd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct MulToAdd : impl::MulToAddBase<MulToAdd> {
mlir::RewritePatternSet patterns(&getContext());
patterns.add<PowerOfTwoExpand>(&getContext());
patterns.add<PeelFromMul>(&getContext());
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
(void)applyPatternsGreedily(getOperation(), std::move(patterns));
}
};

Expand Down
2 changes: 1 addition & 1 deletion lib/Transform/Arith/MulToAddPdll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct MulToAddPdll : impl::MulToAddPdllBase<MulToAddPdll> {
mlir::RewritePatternSet patterns(&getContext());
populateGeneratedPDLLPatterns(patterns);
registerNativeConstraints(patterns);
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
(void)applyPatternsGreedily(getOperation(), std::move(patterns));
}
};

Expand Down
3 changes: 2 additions & 1 deletion tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ cc_binary(
"//lib/Transform/Affine:Passes",
"//lib/Transform/Arith:Passes",
"//lib/Transform/Noisy:Passes",
"@llvm-project//mlir:AllPassesAndDialects",
"@llvm-project//mlir:ArithToLLVM",
"@llvm-project//mlir:BufferizationPipelines",
"@llvm-project//mlir:BufferizationTransforms",
Expand All @@ -28,6 +27,8 @@ cc_binary(
"@llvm-project//mlir:MemRefTransforms",
"@llvm-project//mlir:MlirOptLib",
"@llvm-project//mlir:Pass",
"@llvm-project//mlir:RegisterAllDialects",
"@llvm-project//mlir:RegisterAllPasses",
"@llvm-project//mlir:SCFToControlFlow",
"@llvm-project//mlir:TensorToLinalg",
],
Expand Down
6 changes: 3 additions & 3 deletions tools/tutorial-opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ void polyToLLVMPipelineBuilder(mlir::OpPassManager &manager) {
manager.addPass(mlir::createConvertLinalgToLoopsPass());

// Needed to lower memref.subview
manager.addPass(mlir::memref::createExpandStridedMetadataPass());
// manager.addPass(mlir::memref::createExpandStridedMetadataPass());

manager.addPass(mlir::createSCFToControlFlowPass());
manager.addPass(mlir::createConvertControlFlowToLLVMPass());
manager.addPass(mlir::createArithToLLVMConversionPass());
manager.addPass(mlir::createConvertFuncToLLVMPass());
manager.addPass(mlir::createFinalizeMemRefToLLVMConversionPass());
manager.addPass(mlir::createReconcileUnrealizedCastsPass());
// manager.addPass(mlir::createFinalizeMemRefToLLVMConversionPass());
// manager.addPass(mlir::createReconcileUnrealizedCastsPass());

// Cleanup
manager.addPass(mlir::createCanonicalizerPass());
Expand Down
Loading