circt icon indicating copy to clipboard operation
circt copied to clipboard

[Scheduling] Logging via the containing op can be too verbose

Open jopperm opened this issue 1 year ago • 1 comments

@7FM noted:

I find the logging sometimes a bit too verbose, especially when the containingOp is very large. A hacky workaround that I sometimes use OoT is something like mlir::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

jopperm avatar Jul 30 '24 20:07 jopperm

FWIW FIRRTL also has had this kind of problems and basically we replaced op->emitError() with mlir::emitError(op->getLoc()).

uenoku avatar Jul 31 '24 02:07 uenoku