calyx icon indicating copy to clipboard operation
calyx copied to clipboard

[Interpreter] Verbose trace info / more robust logging

Open EclecticGriffin opened this issue 3 years ago • 6 comments

It might be useful to add more logging capabilities to the interpreter since we've added slog. This could make future internal debugging a bit easier and could potentially offer more insight for program execution, though by default these logging messages will not be present in the release mode (which means they're essentially free in some respects).

I think adding these and a verbose / very verbose flag to the interpreter could be helpful, though far from critical

EclecticGriffin avatar Dec 03 '21 16:12 EclecticGriffin

An idea I was pondering... the infamous print statement debugging. Add LOG statements directly into the Calyx program, e.g.,

group G {
  add.left = a.out;
  add.right = b.out;
  result.in = add.out;
  /// LOG_INTERPRETER("$0 + $1 = $2", add.left, add.right, add.out)
}

Each time group G is executed, this is logged.

cgyurgyik avatar Dec 04 '21 03:12 cgyurgyik

An idea I was pondering... the infamous print statement debugging. Add LOG statements directly into the Calyx program, e.g.,

I don't hate this idea but any reason why this should be in the source program and not just a command in the debugger?

rachitnigam avatar Dec 15 '21 04:12 rachitnigam

Simplicity, ease of use, print statement debugging is nice when you want to quickly iterate between changes and their effects.

cgyurgyik avatar Dec 15 '21 16:12 cgyurgyik

Let's talk about this specific example: how often should I expect the log statement to execute? Every time the value of one of the ports mentioned in it (which makes it equivalent to $monitor in Verilog) or every time the group finishes one clock tick, or once the group is done?

rachitnigam avatar Dec 15 '21 16:12 rachitnigam

Yeah I was thinking about that as well, and I'm not sure what the best answer is. I think every clock tick within the group is a good starting point, with perhaps an option to minimize this just when done is true.

cgyurgyik avatar Dec 15 '21 17:12 cgyurgyik

#815 adds the tracing crate to the IR library so this should be possible now?

rachitnigam avatar Mar 10 '22 22:03 rachitnigam

Closing this for the moment. Will re-open in the future if logging features become more relevant

EclecticGriffin avatar May 01 '23 16:05 EclecticGriffin