File tree Expand file tree Collapse file tree 4 files changed +9
-2
lines changed Expand file tree Collapse file tree 4 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -55,11 +55,15 @@ class TargetDescriptionAnalysisBase {
55
55
// the map from device type to device string
56
56
static llvm::DenseMap<DeviceType, std::string> DeviceKeyMap;
57
57
58
+ // set the emit warning flag
59
+ void setEmitWarning (bool emit) { emitWarning = emit; }
60
+
58
61
private:
59
62
MLIRContext *ctx;
60
63
DeviceType device;
61
64
DataLayout layout;
62
65
Location loc;
66
+ bool emitWarning = false ;
63
67
};
64
68
65
69
class CPUTargetDescriptionAnalysis : public TargetDescriptionAnalysisBase {
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ template <typename T>
25
25
void TargetDescriptionAnalysisBase::emitNotFoundWarning (Location loc,
26
26
StringRef key,
27
27
T value) {
28
- mlir::emitWarning (loc) << key << " not found, using default value " << value;
28
+ if (emitWarning)
29
+ mlir::emitWarning (loc) << key << " not found, using default value "
30
+ << value;
29
31
}
30
32
31
33
static bool isIntegerNumber (const std::string &token) {
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ void populateLLVMPasses(mlir::OpPassManager &pm) {
134
134
135
135
void populateCPUPipeline (mlir::OpPassManager &pm) {
136
136
// verify the target description attribute
137
- pm.addNestedPass <func::FuncOp> (createVerifyTargetDescription ());
137
+ pm.addPass (createVerifyTargetDescription ());
138
138
// front-end, oneDNN graph dialect
139
139
populateFrontendPasses (pm);
140
140
// middle-end, LinalgX/Linalg/tensor dialects
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ namespace {
24
24
static LogicalResult verifyCPUTargetDescription (RewriterBase &rewriter,
25
25
Operation *op) {
26
26
CPUTargetDescriptionAnalysis cpuTargetDesc (op);
27
+ cpuTargetDesc.setEmitWarning (true );
27
28
Location loc = op->getLoc ();
28
29
29
30
// Check if the num_threads is existed and greater than 0
You can’t perform that action at this time.
0 commit comments