Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
86 changes: 86 additions & 0 deletions .github/workflows/iluvatar3.6-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Iluvatar3.6-Build-And-Test

on:
push:
branches: [ "triton_v3.6.x" ]
pull_request:
branches: [ "triton_v3.6.x" ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
iluvatar-build-and-test:
runs-on: iluvatar3.6
if: ${{ github.repository == 'FlagTree/flagtree' || github.repository == 'flagos-ai/flagtree' }}
steps:
- name: Setup environment
shell: bash
run: |
source ~/env.sh
env | grep -E '^(http_proxy|https_proxy|all_proxy|no_proxy)=' >> $GITHUB_ENV || true

- name: Smart Checkout
uses: flagos-ai/FlagTree/.github/actions/smart-checkout@main
with:
checkout_version: 'v6'

- name: Check if backend-relevant files changed
id: check_backend
uses: flagos-ai/FlagTree/.github/actions/check-backend-changed@main
with:
backend: iluvatar

- name: FlagTree Build on Iluvatar
if: steps.check_backend.outputs.should_skip != 'true'
shell: bash
run: |
set -x
export FLAGTREE_BACKEND=iluvatar
export TRITON_OFFLINE_BUILD=1
export TRITON_BUILD_PROTON=OFF
export TRITON_ILU_BUILD_GLUON=OFF
MAX_JOBS=32 python3 -m pip install . --no-build-isolation

- name: FlagTree Test on Iluvatar
if: steps.check_backend.outputs.should_skip != 'true'
shell: bash
run: |
set -x
source ~/env.sh

pip3 install "pytest==9.1.1"

for pkg in hypothesis absl-py scipy pytest-forked; do
pip3 list "$pkg" | grep "$pkg" || pip3 install "$pkg"
done

if [[ "$(uname -m)" == "aarch64" ]]; then
libgomp_path=$(find /usr/lib /usr/lib64 /lib /lib64 -type f -name 'libgomp.so*' 2>/dev/null | head -n 1)
if [[ -n "$libgomp_path" ]]; then
export LD_PRELOAD="$libgomp_path${LD_PRELOAD:+:$LD_PRELOAD}"
fi
fi

# triton unit test
UMD_CUDAMODULELOADING=0 pytest -v third_party/iluvatar/python/test/unit/language/test_core.py
pytest -v third_party/iluvatar/python/test/unit/language/test_subprocess.py
pytest -v third_party/iluvatar/python/test/unit/operators/test_blocksparse.py
pytest -v third_party/iluvatar/python/test/unit/operators/test_cross_entropy.py
pytest -v third_party/iluvatar/python/test/unit/operators/test_dot_trans.py
pytest -v third_party/iluvatar/python/test/unit/operators/test_flash_attention.py
pytest -v third_party/iluvatar/python/test/unit/operators/test_inductor.py
pytest -v third_party/iluvatar/python/test/unit/operators/test_matmul.py
pytest -v third_party/iluvatar/python/test/unit/test_debug.py

# TLE unit test
pytest -v python/test/tle/integration/test_tle_local_store.py
pytest -v python/test/tle/unit/test_tle_gpu_local_ptr.py
pytest -v python/test/tle/unit/test_extract_tile_static_index.py
pytest -v python/test/tle/unit/test_extract_tile_dynamic_index.py
pytest -v python/test/tle/unit/test_insert_tile_static_index.py
pytest -v python/test/tle/unit/test_insert_tile_dynamic_index.py

# TLE tutorials unit tests
python3 python/tutorials/tle/01-fft.py --only_unit_test
44 changes: 44 additions & 0 deletions .github/workflows/iluvatar3.6-delivery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CD-Iluvatar3.6

on:
workflow_dispatch:
inputs:
WHL_VER:
description: '0.6.0.dev1 < 0.6.0a1 < 0.6.0b1 < 0.6.0rc1 < 0.6.0 < 0.6.0.post1'
required: true
default: '0.6.0'
PYTHON_VER:
required: true
default: '3.10'
PLATFORM:
required: true
default: 'x86_64'
FLAGTREE_PYPI_KEY:
required: false
workflow_call:
inputs:
WHL_VER:
type: string
required: true
default: '0.6.0'
PYTHON_VER:
type: string
required: true
default: '3.10'
PLATFORM:
type: string
required: true
default: 'x86_64'
FLAGTREE_PYPI_KEY:
type: string
required: false

jobs:
call-delivery:
uses: flagos-ai/flagtree/.github/workflows/iluvatar3.6-delivery.yml@main
with:
WHL_VER: ${{ inputs.WHL_VER }}
PYTHON_VER: ${{ inputs.PYTHON_VER }}
PLATFORM: ${{ inputs.PLATFORM }}
FLAGTREE_PYPI_KEY: ${{ inputs.FLAGTREE_PYPI_KEY }}
secrets: inherit
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ third_party/xpu/python/*.egg-info
third_party/nvidia/backend/flagcx*
third_party/nvidia/backend/lib/libflagcx*

# Backends iluvatar
third_party/iluvatar/python/*.egg-info
third_party/iluvatar/.triton/
third_party/iluvatar/bin/FileCheck
third_party/iluvatar/logs/

# Backends copied from submodules
python/triton/backends/*
!python/triton/backends/__init__.py
Expand Down
88 changes: 68 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ if(NOT FLAGTREE_BACKEND)
add_definitions(-D__AMD__)
elseif(FLAGTREE_BACKEND STREQUAL "iluvatar")
add_definitions(-D__ILUVATAR__)
remove_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
set(FLAGTREE_TLE OFF)
set(FLAGTREE_ILUVATAR_TLE ON)
add_definitions(-D__ILUVATAR_TLE__)
remove_definitions(-D__TLE__)
list(REMOVE_ITEM LLVM_TABLEGEN_FLAGS -D__TLE__)
elseif(FLAGTREE_BACKEND STREQUAL "mthreads")
set(ENV{PATH} "$ENV{LLVM_SYSPATH}/bin:$ENV{PATH}")
set(CMAKE_C_COMPILER clang)
Expand Down Expand Up @@ -295,6 +298,8 @@ if(NOT MSVC)
# Suppress visibility warnings in gluon_ir.cc (GCC 13+ -Wattributes on pybind11 hidden types)
# Also suppress -Wcomment for generated TritonGPUAttrDefs.h.inc (ASCII diagrams in TableGen output)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-attributes -Wno-comment -Wno-error=odr")
elseif(FLAGTREE_BACKEND STREQUAL "iluvatar")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-covered-switch-default -Wno-deprecated-declarations -Wno-attributes")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-covered-switch-default")
endif()
Expand Down Expand Up @@ -349,6 +354,20 @@ if (FLAGTREE_BACKEND MATCHES "^(xpu|cambricon|aipu|tsingmicro|enflame|rpu|thrive
endif()
endforeach()
endif()
elseif(FLAGTREE_BACKEND STREQUAL "iluvatar")
set(TRITON_CORE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/iluvatar)
set(TRITON_CORE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/third_party/iluvatar)
option(TRITON_BUILD_GLUON "Build the Gluon IR Python bindings (gluon_ir.cc)" OFF)
include_directories(${TRITON_CORE_SOURCE_DIR}/include)
include_directories(${TRITON_CORE_BINARY_DIR}/include)
include_directories(${TRITON_CORE_SOURCE_DIR}/backend/include)
include_directories(${TRITON_CORE_BINARY_DIR}/backend/include)
if(FLAGTREE_ILUVATAR_TLE)
include_directories(${TRITON_CORE_SOURCE_DIR}/tle/include)
include_directories(${TRITON_CORE_BINARY_DIR}/tle/include)
endif()
add_subdirectory(${TRITON_CORE_SOURCE_DIR}/include ${TRITON_CORE_BINARY_DIR}/include)
add_subdirectory(${TRITON_CORE_SOURCE_DIR}/lib ${TRITON_CORE_BINARY_DIR}/lib)
elseif(NOT FLAGTREE_BACKEND)
add_subdirectory(include)
add_subdirectory(lib)
Expand Down Expand Up @@ -410,6 +429,11 @@ if(TRITON_BUILD_PYTHON_MODULE)
elseif(FLAGTREE_BACKEND AND FLAGTREE_BACKEND STREQUAL "mthreads")
include_directories(${PROJECT_BINARY_DIR}/third_party/${FLAGTREE_BACKEND})
add_subdirectory(third_party/mthreads/proton/Dialect)
elseif(FLAGTREE_BACKEND AND FLAGTREE_BACKEND STREQUAL "iluvatar")
if (TRITON_BUILD_PROTON)
list(APPEND TRITON_PLUGIN_NAMES "proton")
add_subdirectory(third_party/proton/Dialect)
endif()
else()
list(APPEND TRITON_PLUGIN_NAMES "proton")
add_subdirectory(third_party/proton/Dialect)
Expand Down Expand Up @@ -621,24 +645,42 @@ if(TRITON_BUILD_PYTHON_MODULE)

set(TRITON_BACKENDS_TUPLE "(${TRITON_BACKENDS_TUPLE})")
add_compile_definitions(TRITON_BACKENDS_TUPLE=${TRITON_BACKENDS_TUPLE})
add_library(triton SHARED ${PYTHON_SRC_PATH}/main.cc
${PYTHON_SRC_PATH}/ir.cc
${PYTHON_SRC_PATH}/passes.cc
${PYTHON_SRC_PATH}/interpreter.cc
${PYTHON_SRC_PATH}/llvm.cc)
if(EXISTS "${PYTHON_SRC_PATH}/gluon_ir.cc")
target_sources(triton PRIVATE ${PYTHON_SRC_PATH}/gluon_ir.cc)
endif()
if(EXISTS "${PYTHON_SRC_PATH}/linear_layout.cc")
target_sources(triton PRIVATE ${PYTHON_SRC_PATH}/linear_layout.cc)
endif()
if(EXISTS "${PYTHON_SRC_PATH}/specialize.cc")
target_sources(triton PRIVATE ${PYTHON_SRC_PATH}/specialize.cc)
endif()
if(FLAGTREE_BACKEND STREQUAL "xpu")
target_sources(triton PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/xpu/python/src/mlir_pass_abi_shim.cc)
add_dependencies(triton TritonAMDGPUTableGen TritonAMDGPUAttrDefsIncGen)
target_link_libraries(triton PRIVATE TritonAMDGPUIR TritonAMDUtils)
if(FLAGTREE_BACKEND STREQUAL "iluvatar")
set(TRITON_ILU_PYTHON_SRCS
${PYTHON_SRC_PATH}/main.cc
${PYTHON_SRC_PATH}/ir.cc
${PYTHON_SRC_PATH}/linear_layout.cc
${PYTHON_SRC_PATH}/passes.cc
${PYTHON_SRC_PATH}/interpreter.cc
${PYTHON_SRC_PATH}/llvm.cc
${PYTHON_SRC_PATH}/specialize.cc)
if(TRITON_BUILD_GLUON)
list(APPEND TRITON_ILU_PYTHON_SRCS ${PYTHON_SRC_PATH}/gluon_ir.cc)
endif()
add_library(triton SHARED ${TRITON_ILU_PYTHON_SRCS})
if(TRITON_BUILD_GLUON)
target_compile_definitions(triton PRIVATE TRITON_BUILD_GLUON)
endif()
else()
add_library(triton SHARED ${PYTHON_SRC_PATH}/main.cc
${PYTHON_SRC_PATH}/ir.cc
${PYTHON_SRC_PATH}/passes.cc
${PYTHON_SRC_PATH}/interpreter.cc
${PYTHON_SRC_PATH}/llvm.cc)
if(EXISTS "${PYTHON_SRC_PATH}/gluon_ir.cc")
target_sources(triton PRIVATE ${PYTHON_SRC_PATH}/gluon_ir.cc)
endif()
if(EXISTS "${PYTHON_SRC_PATH}/linear_layout.cc")
target_sources(triton PRIVATE ${PYTHON_SRC_PATH}/linear_layout.cc)
endif()
if(EXISTS "${PYTHON_SRC_PATH}/specialize.cc")
target_sources(triton PRIVATE ${PYTHON_SRC_PATH}/specialize.cc)
endif()
if(FLAGTREE_BACKEND STREQUAL "xpu")
target_sources(triton PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/xpu/python/src/mlir_pass_abi_shim.cc)
add_dependencies(triton TritonAMDGPUTableGen TritonAMDGPUAttrDefsIncGen)
target_link_libraries(triton PRIVATE TritonAMDGPUIR TritonAMDUtils)
endif()
endif()

# Link triton with its dependencies
Expand Down Expand Up @@ -714,6 +756,12 @@ if(NOT FLAGTREE_BACKEND OR FLAGTREE_BACKEND MATCHES "^(aipu|tsingmicro|enflame|r
flagtree_add_tle_generated_header_dependencies()
endif()
add_subdirectory(test)
elseif(FLAGTREE_BACKEND STREQUAL "iluvatar")
option(FLAGTREE_ILUVATAR_BUILD_BIN "Build third_party/iluvatar/bin tools and lit tests" OFF)
if(FLAGTREE_ILUVATAR_BUILD_BIN)
add_subdirectory(${TRITON_CORE_SOURCE_DIR}/bin ${TRITON_CORE_BINARY_DIR}/bin)
add_subdirectory(test)
endif()
endif()

if(TRITON_BUILD_UT)
Expand Down
4 changes: 2 additions & 2 deletions python/setup_tools/setup_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,9 @@ def uninstall_triton():

# iluvatar
cache.store(
file="iluvatar-llvm18-x86_64",
file="iluvatar-llvm22-x86_64",
condition=("iluvatar" == flagtree_backend),
url="https://baai-cp-web.ks3-cn-beijing.ksyuncs.com/trans/iluvatar-llvm18-x86_64_v0.3.0.tar.gz",
url="https://baai-cp-web.ks3-cn-beijing.ksyuncs.com/trans/iluvatar-llvm22-x86_64_v0.6.0.tar.gz",
pre_hook=lambda: check_env('LLVM_SYSPATH'),
post_hook=set_llvm_env,
)
Expand Down
Loading
Loading