Skip to content

Generic Support for Python eDSLs#393

Open
Imke7 wants to merge 16 commits into
KernelTuner:masterfrom
Imke7:generic_python_support
Open

Generic Support for Python eDSLs#393
Imke7 wants to merge 16 commits into
KernelTuner:masterfrom
Imke7:generic_python_support

Conversation

@Imke7

@Imke7 Imke7 commented Jun 18, 2026

Copy link
Copy Markdown

This pull request introduces a generic backend for tuning Python-embedded domain-specific languages such as Triton, Numba-CUDA, and CuTe DSL. The backend can be used by supplying generic_python as the language argument in tune_kernel or run_kernel. The main changes are summarized as follows:

  • A GenericPythonFunctions backend class has been added to the backends.
  • The KernelSource class is split into two classes: KernelSourceStr and KernelSourceFn. The type of KernelSource is dynamically determined by a factory pattern. If the kernel language generic_python is chosen, an instance of KernelSourceFn is created, which employs AST manipulation to insert tunable parameters into the code instead of string manipulation. For all other languages, KernelSourceStr is used transparently.
  • The argument call_function is added to the Kernel Tuner API functions. This call function should be supplied by the user when the language generic_python is chosen and should encapsulate the launch mechanism of the DSL. Examples of call functions for various DSLs can be found under examples/generic_python/call_functions.
  • Examples of tuning kernels in Triton, Tilus, TileLang, Numba-CUDA, CuTe DSL, NVIDIA Warp, Taichi, and CuPy (using cupyx.jit) are added under examples/generic_python.
  • Unit tests for the main components of the backend are added under the test folder.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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