Skip to content

Conversation

@LeiWang1999
Copy link
Member

@LeiWang1999 LeiWang1999 commented Oct 22, 2025

This pull request refactors and extends the GEMV example to introduce a new block reduction kernel (gemv_alloc_reducer), reorganize autotuning configurations, and improve benchmarking and testing workflows. The changes make the codebase more modular and enable easier experimentation with different GEMV kernel variants.

New kernel and autotuning infrastructure:

  • Added a new gemv_alloc_reducer kernel using block reduction and allocation-based reduction, with its own autotuning configuration generator (get_block_template_configs) and kernel definition using tl.autotune and tl.jit decorators.
  • Refactored the thread-level autotuning configuration into a separate function (get_thread_template_configs) and updated the kernel interface to use get_autotuned_kernel for clarity and modularity.

Benchmarking and correctness improvements:

  • Updated the main benchmarking routine to test the new gemv_alloc_reducer kernel, and expanded the benchmarking logic to compare both SIMT and block reduction implementations when do_bench is set to False.

Testing improvements:

  • Modified the test entry point to call main(do_bench=False), ensuring all kernel variants are tested without running the full benchmark suite.

Code cleanup and bug fixes:

  • Fixed indentation and minor code issues in the kernel implementation to ensure correct accumulation and proper function returns. [1] [2]
  • Updated the main function signature to accept a do_bench flag for more flexible execution.

Summary by CodeRabbit

Release Notes

  • New Features

    • Redesigned GEMV example with new configuration system for enhanced autotuning and kernel optimization
    • Improved kernel computation with refined tiling and resource allocation strategies
  • Changes

    • Main function now supports optional benchmarking parameter for flexible test execution

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 22, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The GEMV example undergoes significant refactoring, replacing a single best-config system with a multi-layer autotuning approach. The changes introduce block-template and thread-template configuration generators, two new autotuned kernels (gemv_alloc_reducer and get_autotuned_kernel), and update the main function signature to support configurable benchmarking modes.

Changes

Cohort / File(s) Summary
GEMV Example Autotuning Refactor
examples/gemv/example_gemv.py
Replaced get_best_config() with new block and thread configuration systems; introduced gemv_alloc_reducer() kernel using block-level reduction; added get_autotuned_kernel() with alternative tiling strategy; updated main() signature to main(do_bench: bool = True) and refactored to call and compare both autotuned kernels.
Test Update
examples/gemv/test_example_gemv.py
Updated main() call to pass explicit do_bench=False argument.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

Poem

🐰 Hoppy hops through autotuning land,
Block templates held within my paw,
Thread configs dance, so finely planned,
Two new kernels follow GEMV's law,
Benchmarks bloom where benchmarks were!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f003f37 and 7739e39.

📒 Files selected for processing (2)
  • examples/gemv/example_gemv.py (3 hunks)
  • examples/gemv/test_example_gemv.py (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

👋 Hi! Thank you for contributing to the TileLang project.

Please remember to run pre-commit run --all-files in the root directory of the project to ensure your changes are properly linted and formatted. This will help ensure your contribution passes the format check.

We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀

@LeiWang1999 LeiWang1999 merged commit 514bdea into tile-ai:main Oct 22, 2025
2 of 4 checks passed
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