circt
circt copied to clipboard
[Scheduling] Logging via the containing op can be too verbose
@7FM noted:
I find the logging sometimes a bit too verbose, especially when the
containingOpis very large. A hacky workaround that I sometimes use OoT is something likemlir::emitError(OpBuilder{mlirContext}.getUnknownLoc()) << "Some context info:" << "your error message". Some examples that might benefit from this approach:
- https://github.com/llvm/circt/blob/main/lib/Scheduling/Problems.cpp#L124C12-L127
- https://github.com/llvm/circt/blob/main/lib/Scheduling/Problems.cpp#L183-L187
- https://github.com/llvm/circt/blob/main/lib/Scheduling/Problems.cpp#L282-L285
Most of the time, the error messages are not directly related to the containing operation itself but rather to the way the scheduling problem was constructed.
Originally posted by @7FM in https://github.com/llvm/circt/pull/7320#pullrequestreview-2198730405
FWIW FIRRTL also has had this kind of problems and basically we replaced op->emitError() with mlir::emitError(op->getLoc()).