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

   # [Relax] Add Dead Parameter Elimination
   
   This PR adds dead parameter elimination to 
`src/relax/transform/dead_code_elimination.cc` to remove unused parameters from 
Relax functions.
   
   ## Motivation
   
   Functions often accumulate unused parameters due to:
   - Deprecated model architectures (e.g., unused weight tensors)
   - API evolution and backwards compatibility
   - Refactoring artifacts
   
   Eliminating these parameters reduces memory usage, speeds up compilation, 
and simplifies the IR.
   
   ## Changes
   
   - Algorithm:
     1. Collect unused parameters across all functions in the module
     2. Update signatures and call sites in topological order
     3. Repeat while changes persist
   - Tests in `tests/python/relax/test_transform_dead_param_elimination.py`
   
   ## Example Usage
   
   Before:
   ```python
   @R.function
   def forward(x: R.Tensor, unused_weights: R.Tensor):
       return x + 1
   ```
   
   After:
   ```python
   @R.function
   def forward(x: R.Tensor):
       return x + 1
   ```
   
   ## TODOs
   - [ ] CI/CD checks
   - [ ] Handle mutual recursion
   - [ ] Fully benchmark compilation time and instruction count
   - [ ] Documentation


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