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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions .github/workflows/tsingmicro-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ jobs:
runs-on: tsingmicro
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: Checkout code (attempt 1)
id: checkout1
uses: actions/checkout@v6
Expand Down Expand Up @@ -61,17 +67,35 @@ jobs:
shell: bash
run: |
set -x
pip uninstall -y triton
source ~/env.sh
export FLAGTREE_BACKEND=tsingmicro
cd python
python3.11 -m pip install . --no-build-isolation -v
python3 -m pip install . --no-build-isolation

- name: FlagTree Test on Tsingmicro
if: steps.check_files.outputs.only_docs_changed != 'true'
shell: bash
run: |
set -x
source ~/env.sh
python3.11 -c 'import triton; print(triton.__path__)'
/usr/local/lib/python3.11/dist-packages/triton/backends/tsingmicro/bin/tsingmicro-opt --version
export TX8_DEPS_ROOT=~/.flagtree/tsingmicro/tx8_deps
export LLVM_SYSPATH=~/.flagtree/tsingmicro/tsingmicro-llvm21-glibc2.30-glibcxx3.4.28-python3.10-x64
export LLVM_BINARY_DIR=${LLVM_SYSPATH}/bin
export PYTHONPATH=${LLVM_SYSPATH}/python_packages/mlir_core:$PYTHONPATH
export LD_LIBRARY_PATH=$TX8_DEPS_ROOT/lib:$LD_LIBRARY_PATH

cd third_party/tsingmicro/examples
python3 bare_matmul_autotune.py >result-bare_matmul_autotune.txt
python3 embedding.py >result-embedding.txt
python3 mult_ir.py >result-mult_ir.txt
python3 profile_matmul.py >result-profile_matmul.txt
python3 quant_gptq.py >result-quant_gptq.txt
python3 test_cos.py >result-test_cos.txt
python3 test_embedding.py >result-test_embedding.txt
python3 test_flip.py >result-test_flip.txt
python3 test_layernorm.py >result-test_layernorm.txt
python3 test_matmul.py >result-test_matmul.txt
python3 test_print.py >result-test_print.txt
python3 test_softmax.py >result-test_softmax.txt
python3 test_vec_add.py >result-test_vec_add.txt
python3 time1.py >result-time1.txt
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ elseif(FLAGTREE_BACKEND STREQUAL "aipu")
add_definitions(-D__NVIDIA__)
add_definitions(-D__AMD__)
elseif(FLAGTREE_BACKEND STREQUAL "tsingmicro")
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_C_COMPILER clang-21)
set(CMAKE_CXX_COMPILER clang++-21)
set(CMAKE_LINKER lld-21)
set(CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld-21")
set(CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld-21")
set(CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld-21")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-dangling-assignment-gsl")
endif()
set(FLAGTREE_PLUGIN "$ENV{FLAGTREE_PLUGIN}")
if(FLAGTREE_PLUGIN)
Expand Down
8 changes: 4 additions & 4 deletions python/setup_tools/setup_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,21 +414,21 @@ def uninstall_triton():

# tsingmicro
cache.store(
file="tsingmicro-llvm21-glibc2.30-glibcxx3.4.28-python3.11-x64",
file="tsingmicro-llvm21-glibc2.30-glibcxx3.4.28-python3.10-x64",
condition=("tsingmicro" == flagtree_backend),
url=
"https://baai-cp-web.ks3-cn-beijing.ksyuncs.com/trans/tsingmicro-llvm21-glibc2.30-glibcxx3.4.28-python3.11-x64_v0.2.0.tar.gz",
"https://baai-cp-web.ks3-cn-beijing.ksyuncs.com/trans/tsingmicro-llvm21-glibc2.30-glibcxx3.4.28-python3.10-x64_v0.4.0.tar.gz",
pre_hock=lambda: check_env('LLVM_SYSPATH'),
post_hock=set_llvm_env,
)

cache.store(
file="tx8_deps",
condition=("tsingmicro" == flagtree_backend),
url="https://baai-cp-web.ks3-cn-beijing.ksyuncs.com/trans/tx8_depends_release_20250814_195126_v0.2.0.tar.gz",
url="https://baai-cp-web.ks3-cn-beijing.ksyuncs.com/trans/tx8_depends_dev_20251218_164108_v0.4.0.tar.gz",
pre_hock=lambda: check_env('TX8_DEPS_ROOT'),
post_hock=lambda path: set_env({
'LLVM_SYSPATH': path,
'TX8_DEPS_ROOT': path,
}),
)

Expand Down
2 changes: 1 addition & 1 deletion third_party/tsingmicro/examples/test_flip.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import triton.language as tl
import benchmark

benchmark.select_cpu_backend()
# benchmark.select_cpu_backend()
from triton._internal_testing import numpy_random


Expand Down