tqchen commented on PR #19722:
URL: https://github.com/apache/tvm/pull/19722#issuecomment-4674770423
### Rendered enriched-error example (TIRx module pass)
A pure-TIR module pass produces a `T.*` (TIRx) enriched error location. The
generic `ModulePassNode` catch in `src/ir/transform.cc` is IR-kind agnostic,
so a
TIR-module pass that throws a `TVM_FFI_VISIT_THROW` seeded with a node
inside the
module renders the location as TIRx TVMScript. With `num_context_lines=10`
the
small function renders in full (no `(... N lines skipped ...)` marker):
```
synthetic TIR validation failure on the function body store
Error in pass: TIRxErrorEnrichmentDemo
Location (TVMScript):
# from tvm.script import ir as I
# from tvm.script import tirx as T
# from tvm.tirx.layout import Axis
@I.ir_module
class Module:
@T.prim_func(private=True)
def main(a: T.handle):
A = T.match_buffer(a, (16,), layout=None)
i = T.int32()
A[i] = A[i] + T.float32(1.0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
This confirms `Error in pass:`, `Location (TVMScript):`, the complete
function
signature, `T.match_buffer`, `T.int32()`, the body store `T.float32(1.0)`,
and
the `^^^` underline on the offending body-store line, with no skipped-lines
marker. The cpptest
`TransformErrorEnrichmentTIR.ModulePassThrowRendersTIRxScript`
(in `tests/cpp/transform_error_enrichment_tir_test.cc`) asserts these
substrings.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]