Skip to content

Incompatibility for torch 2.6 and triton-cpu 3.3 #233

@liuyh-beep

Description

@liuyh-beep

Describe the bug

Hi,

I have installed torch 2.6 in a python virtual environment, and I was trying to build Triton-CPU using the following command:

#!/bin/bash

TRITON_DIR="/home/triton-cpu"
LLVM_DIR="/buildSrc/llvm/llvm-project"
LLVM_BUILD_DIR="${LLVM_DIR}/build"

build_clang(){
  cd ${LLVM_DIR}
  HASH=$(cat ${TRITON_DIR}/cmake/llvm-hash.txt)
  git checkout $HASH
  mkdir build && cd build

  cmake -G Ninja \
      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DLLVM_ENABLE_ASSERTIONS=ON ../llvm \
      -DLLVM_ENABLE_PROJECTS="clang;mlir;llvm" \
      -DLLVM_TARGETS_TO_BUILD="host;RISCV;NVPTX;AMDGPU" \
      -DLLVM_ENABLE_LLD=ON \
      -DLLVM_USE_SPLIT_DWARF=ON
  ninja 
}

mlir-config(){
  cd ${LLVM_DIR}
  SOURCE_DIR=${LLVM_DIR}/llvm
  MLIR_TARGET_DIR=${LLVM_DIR}/mlir_debug_build

  cmake -GNinja \
    -S ${SOURCE_DIR} -B ${MLIR_TARGET_DIR} \
    -DCMAKE_BUILD_TYPE=Debug \
    -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
    -DCMAKE_C_COMPILER=$(which clang) -DCMAKE_CXX_COMPILER=$(which clang++) \
    -DLLVM_ENABLE_PROJECTS="llvm;mlir" \
    -DLLVM_TARGETS_TO_BUILD="host;NVPTX;AMDGPU"

  cmake --build ${MLIR_TARGET_DIR} -j4
}

build_triton(){
  MLIR_DIR="${LLVM_DIR}/mlir_debug_build"
  cd ${TRITON_DIR}
  LLVM_INCLUDE_DIRS="${MLIR_DIR}/include" \
  LLVM_LIBRARY_DIR="${MLIR_DIR}/lib" \
  LLVM_SYSPATH=${MLIR_DIR} \
  pip install -e python
}

build_clang
mlir-config
build_triton

It can install Triton 3.3 successfully, but there is an error about incompatibility between triton and torch:

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Obtaining file:///home/yuhao/triton-cpu/python
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Requirement already satisfied: setuptools>=40.8.0 in ./.venv/lib/python3.10/site-packages (from triton==3.3.0+gitd3dd504f) (59.6.0)
Building wheels for collected packages: triton
  Building editable for triton (pyproject.toml) ... done
  Created wheel for triton: filename=triton-3.3.0+gitd3dd504f-0.editable-cp310-cp310-linux_x86_64.whl size=3892 sha256=186927347f6bf6ac4bf590ce1c63ee1a158a742752d0aff16a87c1229f7eb045
  Stored in directory: /tmp/pip-ephem-wheel-cache-zxsbmi4z/wheels/e7/00/b4/8b17350469628eac588e7594311147d1c08e4a7d6b2a5d0942
Successfully built triton
Installing collected packages: triton
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torch 2.6.0 requires triton==3.2.0; platform_system == "Linux" and platform_machine == "x86_64", but you have triton 3.3.0+gitd3dd504f which is incompatible.
Successfully installed triton-3.3.0+gitd3dd504f

And I tried to run Triton as:

(triton_new) root@690a7f1fbec0:/home/triton-cpu# TRITON_CPU_BACKEND=1 MLIR_ENABLE_DUMP=1 MLIR_DUMP_PATH="tmp/mlir"  python3 python/tutorials/03-matrix-multiplication-cpu.py 
python3: /home/yuhao/triton-cpu/python/src/ir.cc:47: llvm::raw_fd_ostream& {anonymous}::mlir_dumps(): Assertion `!EC' failed.
Aborted (core dumped)

And I also tried to remove MLIR_DUMP_PATH, it can dump mlir. So how should I do? Is there something wrong during building Triton-CPU?

Thanks in advance.

Environment details

Triton-CPU: triton-3.3.0+gitd3dd504f

(triton_new) root@690a7f1fbec0:/home/triton-cpu# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions