tqchen opened a new pull request, #19722:
URL: https://github.com/apache/tvm/pull/19722

   Replace TVM's `Diagnostic` / `DiagnosticContext` machinery with the tvm-ffi
   `visit_error_context` mechanism. Validators throw an `ffi::Error` seeded 
with the
   offending node; leaf pass executors (`ModulePass` / relax `Function` /
   `DataflowBlock`) catch and rethrow `EnrichPassErrorWithContext`, which 
appends the
   failing pass name and a TVMScript-rendered, underlined source location.
   
   `relax.analysis.well_formed` now throws on the first violation; a new
   `check_well_formed` returns a bool, and all C++/Python/test callers are 
routed
   accordingly. `include/tvm/ir/diagnostic.h` and `src/ir/diagnostic.cc` are 
deleted.
   The enrichment renders with `num_context_lines=10` so a small function shows 
in
   full with no "(... N lines skipped ...)" marker, while a large module stays 
bounded.
   
   Example (a TIR module pass throws on a body store):
   
   ```
   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)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ```
   
   The generic `ModulePass` catch renders a pure-TIR (`T.*`) location, and 
positive
   well-formedness assertions are routed through the throwing `well_formed(X)` 
for
   descriptive failures. `tvm.error.DiagnosticError` (used by the TVMScript 
parser)
   is retained.
   


-- 
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]

Reply via email to