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

   ## Summary
   
   Add virtual `VisitBufferDef`/`VisitBufferUse` hooks to `StmtVisitor`, 
`StmtMutator`,
   `StmtExprVisitor`, `StmtExprMutator`, and `TIRVisitorWithPath`.
   
   These centralize buffer field visiting (shape, strides, elem_offset) at 
**definition**
   sites only, and distinguish definition vs use sites so analyses like 
`UndefinedVars`
   correctly track variable scoping.
   
   ## Key Design
   
   - **`VisitBufferDef(buffer, alloc_data)`** — called at definition sites 
(AllocBuffer, DeclBuffer, SBlock alloc_buffers). Visits buffer shape, strides, 
elem_offset. `alloc_data=true` means data var is a new allocation (DEF); 
`false` means data references existing allocation (USE).
   
   - **`VisitBufferUse(buffer)`** — called at use sites (BufferLoad, 
BufferStore, SBlock reads/writes). Default is empty (no field re-visiting).
   
   - `StmtMutator::VisitBufferDef` maintains a `buffer_remap_` map so mutated 
buffers propagate to use sites automatically.
   
   - Removes duplicated buffer field visiting from ~10 subclasses by 
centralizing it in the base classes.
   
   ## Test plan
   
   - [x] `test_tir_analysis_undefined_vars.py` — new tests for def/use 
distinction
   - [x] `test_tir_transform_convert_ssa.py` — 13 tests
   - [x] `test_tir_transform_vectorize.py` — 72 tests
   - [x] `test_tir_transform_simplify.py` — new test for buffer simplification
   - [x] `test_minimal_target_codegen_llvm.py` — LLVM codegen smoke test
   - [x] `ir_functor_test.cc` — C++ functor tests


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