Skip to content

Conversation

@LeiWang1999
Copy link
Member

This pull request introduces enhancements to the reduction operations in the TileLang framework, focusing on enabling accumulation without clearing output buffers, improving flexibility for specific use cases. It also adds comprehensive tests for the new functionality and updates the implementation of reduction operations to support this feature.

Enhancements to Reduction Operations:

  • Support for Accumulation Without Clearing Buffers:

    • Added a clear parameter to reduce_sum and reduce_absmax functions in tilelang/language/reduce.py, allowing accumulation on existing buffer values when set to False. Updated the implementation to handle this behavior by using a temporary buffer during reduction. [1] [2] [3]
  • Changes in ReduceOp::Lower Implementation:

    • Modified the reduction logic in src/op/reduce.cc to support the new clear behavior. Introduced conditional buffer duplication and accumulation logic for kSum and kAbsSum reduction types. [1] [2] [3] [4]

Testing Improvements:

  • New Tests for clear Parameter:
    • Added test cases for reduce_sum and reduce_max operations with the clear parameter set to False. These tests validate the accumulation behavior and ensure correctness. [1] [2]

Codebase Maintenance:

  • Include Additional Utilities:
    • Included tir/transforms/ir_utils.h in src/op/reduce.cc to support the updated implementation.

… and abs sum (tile-ai#436)

* Modified reduce_sum and reduce_absmax functions to include a clear parameter, allowing for accumulation on existing values.
* Updated ReduceOp::Lower method to handle initialization and buffer duplication based on the clear flag for sum and abs sum operations.
* Added new tests for reduce_sum and reduce_max with clear functionality to ensure correctness in various scenarios.
* Enhanced documentation for reduce functions to clarify the behavior of the clear parameter.
LeiWang1999 added a commit to LeiWang1999/tilelang that referenced this pull request Apr 26, 2025
… add atomic add test (tile-ai#436)

* Removed redundant simplification step in vectorization logic to streamline performance.
* Introduced a new test for atomic addition in TileLang, validating functionality with a reference implementation using PyTorch.
@LeiWang1999 LeiWang1999 merged commit 4b5666a into tile-ai:main Apr 26, 2025
2 checks passed
LeiWang1999 added a commit that referenced this pull request Apr 26, 2025
… add atomic add test (#436) (#439)

* Removed redundant simplification step in vectorization logic to streamline performance.
* Introduced a new test for atomic addition in TileLang, validating functionality with a reference implementation using PyTorch.
LeiWang1999 added a commit to LeiWang1999/tilelang that referenced this pull request Jul 18, 2025
* [Enhancement] Update reduce operations to support clear option in sum and abs sum (tile-ai#436)

* Modified reduce_sum and reduce_absmax functions to include a clear parameter, allowing for accumulation on existing values.
* Updated ReduceOp::Lower method to handle initialization and buffer duplication based on the clear flag for sum and abs sum operations.
* Added new tests for reduce_sum and reduce_max with clear functionality to ensure correctness in various scenarios.
* Enhanced documentation for reduce functions to clarify the behavior of the clear parameter.

* lint fix

* Update tensor type annotations in test_tilelang_transform_annotate_device_regions.py from Buffer to Tensor

* Update tensor type in reduce sum tests from float16 to float32 for improved precision
LeiWang1999 added a commit to LeiWang1999/tilelang that referenced this pull request Jul 18, 2025
… add atomic add test (tile-ai#436) (tile-ai#439)

* Removed redundant simplification step in vectorization logic to streamline performance.
* Introduced a new test for atomic addition in TileLang, validating functionality with a reference implementation using PyTorch.
LeiWang1999 added a commit to LeiWang1999/tilelang that referenced this pull request Jul 20, 2025
* [Enhancement] Update reduce operations to support clear option in sum and abs sum (tile-ai#436)

* Modified reduce_sum and reduce_absmax functions to include a clear parameter, allowing for accumulation on existing values.
* Updated ReduceOp::Lower method to handle initialization and buffer duplication based on the clear flag for sum and abs sum operations.
* Added new tests for reduce_sum and reduce_max with clear functionality to ensure correctness in various scenarios.
* Enhanced documentation for reduce functions to clarify the behavior of the clear parameter.

* lint fix

* Update tensor type annotations in test_tilelang_transform_annotate_device_regions.py from Buffer to Tensor

* Update tensor type in reduce sum tests from float16 to float32 for improved precision
LeiWang1999 added a commit to LeiWang1999/tilelang that referenced this pull request Jul 20, 2025
… add atomic add test (tile-ai#436) (tile-ai#439)

* Removed redundant simplification step in vectorization logic to streamline performance.
* Introduced a new test for atomic addition in TileLang, validating functionality with a reference implementation using PyTorch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant