[CI/Build][AMD] Install triton_kernels via CMake (#50328)

Signed-off-by: Ryan Rock <ryan.rock@amd.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
Co-authored-by: depthfirst-app[bot] <184448029+depthfirst-app[bot]@users.noreply.github.com>
Co-authored-by: root <root@smci355-ccs-aus-m11-05.cs-aus.dcgpu>
This commit is contained in:
Ryan Rock
2026-07-30 22:05:19 -05:00
committed by GitHub
co-authored by Andreas Karatzas depthfirst-app[bot] <184448029+depthfirst-app[bot]@users.noreply.github.com> root
parent 4689c7dd61
commit 6724051c57
3 changed files with 20 additions and 30 deletions
+11 -6
View File
@@ -1,7 +1,5 @@
# Install OpenAI triton_kernels from https://github.com/triton-lang/triton/tree/main/python/triton_kernels
set(DEFAULT_TRITON_KERNELS_TAG "v3.5.1")
# Set TRITON_KERNELS_SRC_DIR for use with local development with vLLM. We expect TRITON_KERNELS_SRC_DIR to
# be directly set to the triton_kernels python directory.
if (DEFINED ENV{TRITON_KERNELS_SRC_DIR})
@@ -12,13 +10,20 @@ if (DEFINED ENV{TRITON_KERNELS_SRC_DIR})
)
else()
set(TRITON_GIT "https://github.com/triton-lang/triton.git")
message (STATUS "[triton_kernels] Fetch from ${TRITON_GIT}:${DEFAULT_TRITON_KERNELS_TAG}")
if (VLLM_TARGET_DEVICE STREQUAL "rocm")
set(TRITON_GIT "https://github.com/ROCm/triton.git")
# Pinned from release/internal/3.6.x
set(TRITON_KERNELS_TAG "0f380657dbf3ee86eb57558ff71df24f03b5d4e7")
else()
set(TRITON_GIT "https://github.com/triton-lang/triton.git")
set(TRITON_KERNELS_TAG "v3.5.1")
endif()
message (STATUS "[triton_kernels] Fetch from ${TRITON_GIT}:${TRITON_KERNELS_TAG}")
FetchContent_Declare(
triton_kernels
# TODO (varun) : Fetch just the triton_kernels directory from Triton
GIT_REPOSITORY https://github.com/triton-lang/triton.git
GIT_TAG ${DEFAULT_TRITON_KERNELS_TAG}
GIT_REPOSITORY ${TRITON_GIT}
GIT_TAG ${TRITON_KERNELS_TAG}
GIT_PROGRESS TRUE
SOURCE_SUBDIR python/triton_kernels/triton_kernels
)
-2
View File
@@ -121,8 +121,6 @@ RUN cd triton \
&& if [ ! -f setup.py ]; then cd python; fi \
&& python3 setup.py bdist_wheel --dist-dir=dist \
&& mkdir -p /app/install && cp dist/*.whl /app/install
RUN if [ -d triton/python/triton_kernels ]; then pip install build && cd triton/python/triton_kernels \
&& python3 -m build --wheel && cp dist/*.whl /app/install; fi
###
@@ -80,28 +80,15 @@ def _patch_make_bitmatrix_metadata() -> None:
import triton.language as tl
try:
if current_platform.is_rocm():
from triton_kernels.tensor_details import bitmatrix as _bm
from triton_kernels.tensor_details.bitmatrix import (
BitmatrixMetadata,
_keyed_add,
cdiv,
)
from triton_kernels.tensor_details.bitmatrix_details.sum_bitmatrix_rows import ( # noqa: E501
sum_bitmatrix_rows,
)
else:
from vllm.third_party.triton_kernels.tensor_details import (
bitmatrix as _bm,
)
from vllm.third_party.triton_kernels.tensor_details.bitmatrix import (
BitmatrixMetadata,
_keyed_add,
cdiv,
)
from vllm.third_party.triton_kernels.tensor_details.bitmatrix_details.sum_bitmatrix_rows import ( # noqa: E501
sum_bitmatrix_rows,
)
from triton_kernels.tensor_details import bitmatrix as _bm
from triton_kernels.tensor_details.bitmatrix import (
BitmatrixMetadata,
_keyed_add,
cdiv,
)
from triton_kernels.tensor_details.bitmatrix_details.sum_bitmatrix_rows import ( # noqa: E501
sum_bitmatrix_rows,
)
except ImportError:
return