-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generate recursion predicates (.zkr) in parallel (#123)
* Add an EmitRecursion pass to wrap emitRecursion to generate zkrs that the pass manager can run in parallel * Enable parallelism in EDSL context * (Incidental change: update hedron to fix clangd indexing)
- Loading branch information
Showing
9 changed files
with
150 additions
and
10 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
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,40 @@ | ||
// Copyright 2024 RISC Zero, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include "mlir/Dialect/Func/IR/FuncOps.h" | ||
#include "mlir/Pass/Pass.h" | ||
#include "mlir/Pass/PassManager.h" | ||
#include "mlir/Transforms/GreedyPatternRewriteDriver.h" | ||
#include "mlir/Transforms/LocationSnapshot.h" | ||
#include "mlir/Transforms/ViewOpGraph.h" | ||
#include "llvm/Support/Debug.h" | ||
#include <limits> | ||
#include <memory> | ||
|
||
namespace zirgen { | ||
|
||
#define GEN_PASS_DECL_EMITRECURSION | ||
#include "zirgen/compiler/codegen/Passes.h.inc" | ||
|
||
/// Creates a pass which outputs recursion predicates to .zkr files | ||
std::unique_ptr<mlir::OperationPass<mlir::func::FuncOp>> createEmitRecursionPass(); | ||
std::unique_ptr<mlir::OperationPass<mlir::func::FuncOp>> | ||
createEmitRecursionPass(llvm::StringRef outputDir); | ||
|
||
#define GEN_PASS_REGISTRATION | ||
#include "zirgen/compiler/codegen/Passes.h.inc" | ||
|
||
} // namespace zirgen |
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 @@ | ||
// Copyright 2024 RISC Zero, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef ZIRGEN_CODEGEN_PASSSES | ||
#define ZIRGEN_CODEGEN_PASSES | ||
|
||
include "mlir/Pass/PassBase.td" | ||
include "mlir/Rewrite/PassUtil.td" | ||
|
||
def EmitRecursion : Pass<"emit-recursion", "mlir::func::FuncOp"> { | ||
let summary = "Encode a function to a recursion .zkr file, and output it"; | ||
let options = [ | ||
Option<"outputDir", "outputdir", "std::string", /*default=*/"", | ||
"Output directory to write .zkr to">, | ||
]; | ||
let constructor = "zirgen::createEmitRecursionPass()"; | ||
} | ||
|
||
#endif // ZIRGEN_CODEGEN_PASSES | ||
|
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