• Lei Wang's avatar
    [Language] Introduce `T.annotate_restrict_buffers` (#1428) · 0814b171
    Lei Wang authored
    * [Enhancement] Introduce non-restrict parameter support in code generation
    
    - Added a new PrimFunc-level attribute `tl.non_restrict_params` to specify handle Vars that should not be marked with the restrict qualifier during code generation.
    - Updated `CodeGenTileLangCPP`, `CodeGenTileLangCUDA`, and `CodeGenTileLangHIP` to handle non-restrict parameters, ensuring proper treatment of overlapping buffer aliases.
    - Implemented a new annotation function `annotate_restrict_buffers` to facilitate the marking of buffer parameters as non-restrict.
    - Enhanced the `SplitHostDevice` transformation to propagate non-restrict parameters from host to device functions.
    - Added a new transform function `HoistNonRestrictParams` to manage non-restrict parameters effectively.
    
    * [Enhancement] Improve HoistNonRestrictParams transformation
    
    - Updated the HoistNonRestrictParams function to recursively collect all `tl.non_restrict_params` annotations from nested blocks, enhancing flexibility in annotation placement.
    - Introduced a new NonRestrictCollector class to manage the collection and deduplication of non-restrict parameters.
    - Modified the SplitHostDevice transformation to remove the non-restrict attribute from the host-side PrimFunc after propagation to device kernels.
    - Adjusted the LowerAndLegalize function to directly apply the HoistNonRestrictParams transformation without exception handling, streamlining the process.
    
    * [Refactor] Simplify non-restrict parameter handling in code generation
    
    - Removed unnecessary normalization logic and associated data structures from `CodeGenTileLangCPP`, `CodeGenTileLangCUDA`, and `CodeGenTileLangHIP`.
    - Streamlined the handling of non-restrict parameters by directly inserting them into the `non_restrict` set, improving code clarity and maintainability.
    - Updated conditional checks to eliminate redundant checks against normalized names, enhancing performance and readability.
    
    * [Dependency] Update TVM subproject to latest commit 68aa8461
    
    - Updated the TVM subproject to the latest commit, ensuring compatibility with recent changes and improvements.
    - Refactored non-restrict parameter handling in `CodeGenTileLangCPP`, `CodeGenTileLangCUDA`, and `CodeGenTileLangHIP` to enhance code clarity and maintainability.
    - Adjusted the `SplitHostDevice` transformation to streamline the propagation of non-restrict parameters.
    
    * fix
    0814b171
phase.py 12.3 KB