-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add template for ReduceNoiseAnalysis
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cc_library( | ||
name = "ReduceNoiseAnalysis", | ||
srcs = ["ReduceNoiseAnalysis.cpp"], | ||
hdrs = ["ReduceNoiseAnalysis.h"], | ||
deps = [ | ||
"//lib/Dialect/Noisy", | ||
"@llvm-project//llvm:Support", | ||
"@llvm-project//mlir:IR", | ||
], | ||
) |
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,18 @@ | ||
#include "lib/Analysis/ReduceNoiseAnalysis/ReduceNoiseAnalysis.h" | ||
|
||
#include <string> | ||
|
||
#include "llvm/include/llvm/ADT/DenseMap.h" // from @llvm-project | ||
#include "llvm/include/llvm/ADT/TypeSwitch.h" // from @llvm-project | ||
#include "mlir/include/mlir/IR/Operation.h" // from @llvm-project | ||
#include "mlir/include/mlir/IR/Value.h" // from @llvm-project | ||
|
||
namespace mlir { | ||
namespace tutorial { | ||
|
||
ReduceNoiseAnalysis::ReduceNoiseAnalysis(Operation *op) { | ||
// Implement analysis here | ||
} | ||
|
||
} // namespace tutorial | ||
} // namespace mlir |
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,29 @@ | ||
#ifndef LIB_ANALYSIS_REDUCENOISEANALYSIS_REDUCENOISEANALYSIS_H_ | ||
#define LIB_ANALYSIS_REDUCENOISEANALYSIS_REDUCENOISEANALYSIS_H_ | ||
|
||
#include "llvm/include/llvm/ADT/DenseMap.h" // from @llvm-project | ||
#include "mlir/include/mlir/IR/Operation.h" // from @llvm-project | ||
#include "mlir/include/mlir/IR/Value.h" // from @llvm-project | ||
|
||
namespace mlir { | ||
namespace tutorial { | ||
|
||
class ReduceNoiseAnalysis { | ||
public: | ||
ReduceNoiseAnalysis(Operation *op); | ||
~ReduceNoiseAnalysis() = default; | ||
|
||
/// Return true if a reduce_noise op should be inserted after the given | ||
/// operation, according to the solution to the optimization problem. | ||
bool shouldInsertReduceNoise(Operation *op) const { | ||
return solution.lookup(op); | ||
} | ||
|
||
private: | ||
llvm::DenseMap<Operation *, bool> solution; | ||
}; | ||
|
||
} // namespace tutorial | ||
} // namespace mlir | ||
|
||
#endif // LIB_ANALYSIS_REDUCENOISEANALYSIS_REDUCENOISEANALYSIS_H_ |