Skip to content

[FEAT][platforms]: integrate persistent kernel Auto-Tuning into Hardware Abstraction Layer #50

Open

Description

@Flink-ddd

Description:

Context:

Optimal Triton/CUDA grid configurations (e.g., BLOCK_M, BLOCK_N, num_warps, num_stages) vary drastically between hardware generations (e.g., Ada Lovelace vs. Hopper vs. MI300X). Hardcoding these parameters leaves significant performance on the table.

Tasks:

  1. Implement an autotuning wrapper in the HAL (rl_engine/platforms/autotuner.py) that profiles operator performance on the first execution.
  2. Cache the best-performing configurations locally (e.g., to a .kernel_align_cache file) based on the specific GPU PCIe ID and shape of the input tensors.
  3. Refactor existing Triton operators like ops/triton/base.py to inherit from this autotuning wrapper rather than using static @triton.autotune heuristics.

Activity

  1. added
    platform: cudaSpecific optimizations or bugs in NVIDIA graphics cards (such as FlashInfer, TMA optimizations)
    platform: rocmSpecific tasks specific to AMD graphics cards (such as CK, bpreshuffle/FA)
    platform: tritonCross-platform Triton kernel related tasks
    type: performancePerformance optimization tasks aimed at increasing throughput and reducing latency etc.
    on May 31, 2026
  2. fusheng-ji commented on Oct 11, 2026

    @fusheng-ji
    Contributor

    Hi, thanks for opening this issue! I wanted to let you know that I've worked on the CUDA side of it in #536, and it's ready for review whenever you have time.

    In short, it adds an opt-in persistent autotuner in rl_engine/platforms/autotuner.py, with a private on-disk cache keyed by GPU identity (UUID/PCI ID, driver and library versions), input shape/dtype and phase. The shared Triton operators are wired through it, and default and strict dispatch are unchanged.

    Because the kernels need to stay batch-invariant, candidates only vary launch parameters that keep the arithmetic order fixed. Every candidate is checked byte-for-byte against the fixed launch; all 101 kernel/config pairs match on B200. Tuning speeds up CUDA graph replay (up to about 30% on small elementwise ops) but not eager execution, so I've kept it off by default.

    I haven't been able to validate on ROCm hardware, so that part of the issue is still open. If anyone with ROCm access would like to try it, I'd be happy to help.

    Any feedback on the approach would be much appreciated. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform: cudaSpecific optimizations or bugs in NVIDIA graphics cards (such as FlashInfer, TMA optimizations)platform: rocmSpecific tasks specific to AMD graphics cards (such as CK, bpreshuffle/FA)platform: tritonCross-platform Triton kernel related taskstype: performancePerformance optimization tasks aimed at increasing throughput and reducing latency etc.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions