I’ve been working on a custom Relay transformation pass and have had a great deal of difficulty debugging, because type inference will hit errors, but not tell me where they are in the source module; all I get is a stack trace.
I noticed that there’s a notion of CompileError instead of just regular Error / the ICHECK macros. When I use CompileErrors, I get a nice listing of multiple errors… still without span information, since the Relay module doesn’t have that information populated. (It’s created from an ONNX graph.)
I’ve been wondering about a few things.
-
Would there be interest in replacing the ICHECK macros with something like CCHECK macros that throw compile errors instead of regular errors? These could be used in e.g. the type relation checking code in Relay. (ICHECK would still be used in most places ofc, just wherever compile errors make sense.)
-
Would it be possible to automatically create span information for a Relay graph using the text format? I tried serializing the module and then parsing it back to populate the spans; unfortunately this doesn’t work, because some of my local variables have "."s in their names, which the parser can’t handle. I’d also be interested in fixing that unless there are objections.
CC @jroesch