Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a6f092e
build: upgrade PTOAS to LLVM 21.1.8
TaoTao-real Jun 11, 2026
0655206
fix: complete LLVM 21 VPTO type migration
TaoTao-real Jun 11, 2026
5a71cf2
fix: adapt EmitC array lowering for LLVM 21
TaoTao-real Jun 11, 2026
f7c3bc9
fix: materialize EmitC branch operands as lvalues
TaoTao-real Jun 11, 2026
04f6db9
fix: rebuild control-flow tile results for LLVM 21
TaoTao-real Jun 11, 2026
abad949
test: isolate tile materialization IR check
TaoTao-real Jun 11, 2026
11852c6
fix: split PTOAS seam and EmitC pipelines
TaoTao-real Jun 11, 2026
229492f
fix: support LLVM 21 VPTO and EmitC lowering
TaoTao-real Jun 11, 2026
0e8ff20
fix: avoid LLVM 21 EmitC integer attr assertion
TaoTao-real Jun 11, 2026
df57b7e
ci: use system compiler for VPTO sim build
TaoTao-real Jun 11, 2026
6d34477
ci: install VPTO sim runner packages on demand
TaoTao-real Jun 11, 2026
2063df8
ci: avoid apt installs in VPTO sim dependency check
TaoTao-real Jun 11, 2026
1b46b0a
fix: guard EmitC integer APInt handling
TaoTao-real Jun 11, 2026
7c5f8c9
fix: lower VPTO low-precision carriers for LLVM 21
TaoTao-real Jun 11, 2026
4c48c58
fix: guard EmitC integer attr reads
TaoTao-real Jun 11, 2026
db75928
fix: guard EmitC zero-width variable init
TaoTao-real Jun 11, 2026
4875c07
fix: remove unused PTOToEmitC dataflow analysis
TaoTao-real Jun 11, 2026
0248b07
fix: lower low-precision HIVM intrinsic ABI
TaoTao-real Jun 11, 2026
1b1897e
fix: gate known CANN beta VPTO SIM gaps
TaoTao-real Jun 12, 2026
950a207
build: use LLVM21 VPTO dependency branch
TaoTao-real Jun 12, 2026
ccdab60
test: use configured Python for ptobc maskpattern check
TaoTao-real Jun 12, 2026
d8f0bac
fix: emit native lowp vcvt intrinsic types
TaoTao-real Jun 12, 2026
1789679
ci: extend vpto sim validation timeout
TaoTao-real Jun 12, 2026
e750676
ci: extend vpto sim timeout for llvm21
TaoTao-real Jun 12, 2026
d4d2ee2
fix: restore PTO entry compatibility for LLVM 21
TaoTao-real Jun 16, 2026
defcf82
test: restore Qwen3DecodeA5 left tile layouts
TaoTao-real Jun 16, 2026
30f2eca
fix: preserve explicit left tile layout
TaoTao-real Jun 16, 2026
2036678
Revert "fix: gate known CANN beta VPTO SIM gaps"
TaoTao-real Jun 16, 2026
cd707e9
Revert "fix: lower VPTO low-precision carriers for LLVM 21"
TaoTao-real Jun 16, 2026
df2a2be
Narrow VPTO LLVM21 upgrade changes
mouliangyu Jun 16, 2026
74ba6d2
chore: narrow LLVM21 dependency references
TaoTao-real Jun 18, 2026
98592be
fix: restore entry contract and seam IR emission
TaoTao-real Jun 18, 2026
67a0462
fix: adapt latest main A5 checks for LLVM 21
TaoTao-real Jun 22, 2026
9fe8b24
chore: keep python staging cmake unchanged
TaoTao-real Jun 22, 2026
70ae964
fix: keep ptobc LLVM21 changes minimal
TaoTao-real Jun 22, 2026
4276dd4
fix: adapt VPTO mad float8 checks for LLVM 21
TaoTao-real Jun 24, 2026
1edbae5
fix: materialize tquant mx emitc pointer operands
TaoTao-real Jun 25, 2026
8f84482
fix: address llvm21 rebase validation failures
TaoTao-real Jun 26, 2026
5e69dbb
fix: rely on generated fusion plan options ctor
TaoTao-real Jun 26, 2026
e5913eb
ci: ignore unrelated microsoft apt sources
TaoTao-real Jun 26, 2026
67bb0ba
fix: preserve simt callsite annotation check
TaoTao-real Jun 27, 2026
3eab87c
fix: rely on generated MX python bindings
TaoTao-real Jun 27, 2026
06ab30a
fix: support vpto memref stride API variants
TaoTao-real Jun 28, 2026
5c3d53e
build: require LLVM 21 at configure time
TaoTao-real Jun 29, 2026
1960a99
ci: harden llvm21 validation jobs
TaoTao-real Jun 29, 2026
70a7cb5
build: inherit LLVM compiler for PTOAS configure
TaoTao-real Jul 1, 2026
5bdc943
Merge remote-tracking branch 'hw-native-sys/main' into codex/upgrade-…
TaoTao-real Jul 1, 2026
2e74ec1
test: align llvm21 lit expectations
TaoTao-real Jul 1, 2026
605c5ef
Merge remote-tracking branch 'hw-native-sys/main' into codex/upgrade-…
TaoTao-real Jul 1, 2026
2e20a1a
test: accept llvm21 tile lvalue emitc form
TaoTao-real Jul 1, 2026
6c3dcc9
fix: address LLVM21 review comments
TaoTao-real Jul 1, 2026
b2cbfa8
Merge remote-tracking branch 'hw-native-sys/main' into codex/upgrade-…
TaoTao-real Jul 1, 2026
15eb9af
test: update mgather mscatter emitc checks for LLVM21
TaoTao-real Jul 1, 2026
b655d3c
Merge remote-tracking branch 'hw-native-sys/main' into codex/upgrade-…
TaoTao-real Jul 1, 2026
ed75c36
fix: restore A5 left layout verifier contract
TaoTao-real Jul 2, 2026
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
10 changes: 8 additions & 2 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ permissions:

env:
LLVM_REPO: https://github.com/vpto-dev/llvm-project.git
LLVM_REF: feature-vpto
LLVM_CACHE_FLAVOR: release-hardening-v1
LLVM_REF: feature-vpto-llvm21
LLVM_CACHE_FLAVOR: llvm21-vpto-release-hardening-v1

jobs:
build_wheel:
Expand Down Expand Up @@ -143,6 +143,9 @@ jobs:
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
-DPython3_EXECUTABLE=${PY_PATH}/bin/python \
-DPython_EXECUTABLE=${PY_PATH}/bin/python \
-Dpybind11_DIR="$(${PY_PATH}/bin/python -m pybind11 --cmakedir)" \
-Dnanobind_DIR="$(${PY_PATH}/bin/python -m nanobind --cmake_dir)" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_TARGETS_TO_BUILD="host"
ninja -C $LLVM_BUILD_DIR
Expand All @@ -159,6 +162,9 @@ jobs:
- name: Build PTOAS
run: |
export PATH="${PY_PATH}/bin:$PATH"
if [ "${{ matrix.arch }}" = "aarch64" ]; then
export CMAKE_BUILD_PARALLEL_LEVEL=2
fi
PTOAS_RELEASE_VERSION_OVERRIDE="${PTOAS_VERSION}" \
pip install . --no-build-isolation
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/build_wheel_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ permissions:

env:
LLVM_REPO: https://github.com/vpto-dev/llvm-project.git
LLVM_REF: feature-vpto
LLVM_CACHE_FLAVOR: release-v2
LLVM_REF: feature-vpto-llvm21
LLVM_CACHE_FLAVOR: llvm21-vpto-release-v1

jobs:
build_wheel:
Expand Down Expand Up @@ -145,6 +145,9 @@ jobs:
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
-DPython3_EXECUTABLE=$(which python) \
-DPython_EXECUTABLE=$(which python) \
-Dpybind11_DIR="$(python -m pybind11 --cmakedir)" \
-Dnanobind_DIR="$(python -m nanobind --cmake_dir)" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_TARGETS_TO_BUILD="host"
ninja -C $LLVM_BUILD_DIR
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ jobs:
env:
PTOAS_CLANG_MAJOR: "15"
LLVM_REPO: https://github.com/vpto-dev/llvm-project.git
LLVM_REF: feature-vpto
LLVM_REF: feature-vpto-llvm21
LLVM_BUILD_DIR: ${{ github.workspace }}/llvm-project/llvm/build-assert
LLVM_DIR: ${{ github.workspace }}/llvm-project/llvm/build-assert
PTO_BUILD_DIR: ${{ github.workspace }}/build-assert
PTO_INSTALL_DIR: ${{ github.workspace }}/install-assert
MLIR_PYTHONPATH: ${{ github.workspace }}/llvm-project/llvm/build-assert/tools/mlir/python_packages/mlir_core
LLVM_CACHE_FLAVOR: assert-shared-mlirpy-hardening-v2
LLVM_CACHE_FLAVOR: llvm21-assert-shared-mlirpy-hardening-v1
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -114,6 +114,15 @@ jobs:

- name: Install dependencies
run: |
# GitHub-hosted runners may include Microsoft apt sources unrelated to
# PTOAS; these can intermittently return 403 and break apt-get update.
sudo rm -f \
/etc/apt/sources.list.d/azure-cli*.list \
/etc/apt/sources.list.d/azure-cli*.sources \
/etc/apt/sources.list.d/microsoft-prod*.list \
/etc/apt/sources.list.d/microsoft-prod*.sources \
/etc/apt/sources.list.d/packages-microsoft-prod*.list \
/etc/apt/sources.list.d/packages-microsoft-prod*.sources
sudo apt-get update
sudo apt-get install -y \
cmake git ninja-build \
Expand All @@ -122,7 +131,7 @@ jobs:
libedit-dev zlib1g-dev libxml2-dev libzstd-dev
python3 -m pip install --upgrade pip
# LLVM/MLIR Python bindings are not yet compatible with pybind11 3.x.
python3 -m pip install setuptools wheel 'pybind11<3' numpy
python3 -m pip install setuptools wheel 'pybind11<3' nanobind numpy
- name: Define payload paths
shell: bash
Expand Down Expand Up @@ -200,6 +209,9 @@ jobs:
-DLLVM_ENABLE_ASSERTIONS=ON \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
-DPython3_EXECUTABLE=python3 \
-DPython_EXECUTABLE=python3 \
-Dpybind11_DIR="$(python3 -m pybind11 --cmakedir)" \
-Dnanobind_DIR="$(python3 -m nanobind --cmake_dir)" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER="${PTOAS_CMAKE_C_COMPILER}" \
-DCMAKE_CXX_COMPILER="${PTOAS_CMAKE_CXX_COMPILER}" \
Expand Down
34 changes: 31 additions & 3 deletions .github/workflows/ci_sim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
vpto-sim-validation:
needs: detect-vpto-sim-changes
runs-on: [self-hosted, Linux, X64, label-1]
timeout-minutes: 120
timeout-minutes: 300
concurrency:
group: vpto-sim-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand All @@ -108,7 +108,7 @@ jobs:
}}
env:
LLVM_REPO: https://github.com/vpto-dev/llvm-project.git
LLVM_REF: feature-vpto
LLVM_REF: feature-vpto-llvm21
PTO_INSTALL_DIR: ${{ github.workspace }}/install
VPTO_SIM_WORKSPACE: ${{ github.workspace }}/.work/vpto-sim-ci
TILELANG_DSL_WORKSPACE: ${{ github.workspace }}/.work/tilelang-dsl-ci
Expand Down Expand Up @@ -193,11 +193,12 @@ jobs:
python3 -c "import numpy" >/dev/null 2>&1 || need_pip_install=1
python3 -c "import setuptools, wheel" >/dev/null 2>&1 || need_pip_install=1
python3 -m pybind11 --cmakedir >/dev/null 2>&1 || need_pip_install=1
python3 -m nanobind --cmake_dir >/dev/null 2>&1 || need_pip_install=1
python3 -c "import ml_dtypes" >/dev/null 2>&1 || need_pip_install=1
if [[ "${need_pip_install}" -eq 1 ]]; then
python3 -m pip install --upgrade pip
python3 -m pip install setuptools wheel 'pybind11<3' numpy ml-dtypes
python3 -m pip install setuptools wheel 'pybind11<3' nanobind numpy ml-dtypes
fi
- name: Clean CI work dirs
Expand Down Expand Up @@ -251,6 +252,9 @@ jobs:
-DLLVM_ENABLE_ASSERTIONS=ON \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
-DPython3_EXECUTABLE=python3 \
-DPython_EXECUTABLE=python3 \
-Dpybind11_DIR="$(python3 -m pybind11 --cmakedir)" \
-Dnanobind_DIR="$(python3 -m nanobind --cmake_dir)" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_TARGETS_TO_BUILD="host"
Expand Down Expand Up @@ -312,6 +316,7 @@ jobs:
ref: ${{ env.PYPTO_REF }}
path: ${{ env.PYPTO_WORKSPACE }}
fetch-depth: 1
submodules: recursive
persist-credentials: false

- name: Checkout PTO-ISA
Expand Down Expand Up @@ -381,6 +386,29 @@ jobs:
# auto-detecting onboard platforms from the runner's CANN environment.
env -u ASCEND_HOME_PATH python3 -m pip install --no-build-isolation --no-deps "${PYPTO_WORKSPACE}/runtime"
python3 - <<'PY'
from pathlib import Path
from simpler_setup.environment import PROJECT_ROOT
from simpler_setup.kernel_compiler import KernelCompiler
required = PROJECT_ROOT / "src" / "common" / "task_interface" / "arg_direction.h"
if not required.is_file():
raise SystemExit(f"missing required simpler runtime header: {required}")
include_dirs = KernelCompiler(platform="a5sim").get_orchestration_include_dirs(
"tensormap_and_ringbuffer"
)
if str(required.parent) not in include_dirs:
raise SystemExit(
"simpler orchestration include dirs do not contain "
f"{required.parent}: {include_dirs}"
)
print(f"simpler PROJECT_ROOT={PROJECT_ROOT}")
print(f"simpler arg_direction.h={required}")
PY
- name: Run PyPTO PTOAS end-to-end simulator smoke
shell: bash
env:
Expand Down
99 changes: 97 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,66 @@ if(POLICY CMP0169)
set(CMAKE_POLICY_DEFAULT_CMP0169 OLD)
endif()

function(ptoas_get_cmake_cache_value cache_file variable out_var)
if(NOT EXISTS "${cache_file}")
set(${out_var} "" PARENT_SCOPE)
return()
endif()

file(STRINGS "${cache_file}" cache_lines
REGEX "^${variable}:[^=]*=")
if(cache_lines)
list(GET cache_lines 0 cache_line)
string(REGEX REPLACE "^[^=]*=" "" cache_value "${cache_line}")
set(${out_var} "${cache_value}" PARENT_SCOPE)
else()
set(${out_var} "" PARENT_SCOPE)
endif()
endfunction()

function(ptoas_get_llvm_build_dir_from_llvm_dir out_var)
if(NOT DEFINED LLVM_DIR OR LLVM_DIR STREQUAL "")
set(${out_var} "" PARENT_SCOPE)
return()
endif()

get_filename_component(llvm_cmake_dir "${LLVM_DIR}" REALPATH)
get_filename_component(llvm_build_dir "${llvm_cmake_dir}/../../.." REALPATH)
if(EXISTS "${llvm_build_dir}/CMakeCache.txt")
set(${out_var} "${llvm_build_dir}" PARENT_SCOPE)
else()
set(${out_var} "" PARENT_SCOPE)
endif()
endfunction()

function(ptoas_preseed_compilers_from_llvm_cache)
ptoas_get_llvm_build_dir_from_llvm_dir(llvm_build_dir)
if(llvm_build_dir STREQUAL "")
return()
endif()

set(llvm_cache "${llvm_build_dir}/CMakeCache.txt")
if(NOT DEFINED CMAKE_C_COMPILER AND "$ENV{CC}" STREQUAL "")
ptoas_get_cmake_cache_value("${llvm_cache}" "CMAKE_C_COMPILER"
llvm_c_compiler)
if(llvm_c_compiler AND EXISTS "${llvm_c_compiler}")
set(CMAKE_C_COMPILER "${llvm_c_compiler}" CACHE FILEPATH
"C compiler inherited from the configured LLVM build" FORCE)
endif()
endif()

if(NOT DEFINED CMAKE_CXX_COMPILER AND "$ENV{CXX}" STREQUAL "")
ptoas_get_cmake_cache_value("${llvm_cache}" "CMAKE_CXX_COMPILER"
llvm_cxx_compiler)
if(llvm_cxx_compiler AND EXISTS "${llvm_cxx_compiler}")
set(CMAKE_CXX_COMPILER "${llvm_cxx_compiler}" CACHE FILEPATH
"C++ compiler inherited from the configured LLVM build" FORCE)
endif()
endif()
endfunction()

ptoas_preseed_compilers_from_llvm_cache()

project(ptoas VERSION 0.49)

option(PTOAS_VALIDATE_CMAKE4_FETCHCONTENT_COMPAT
Expand Down Expand Up @@ -72,7 +132,7 @@ endif()
message(STATUS "PTOAS CLI version: ${PTOAS_CLI_VERSION}")

# =========================================================
# [新增] 强制设置 C++17 标准 (LLVM 19 必需)
# [新增] 强制设置 C++17 标准 (LLVM/MLIR 必需)
# =========================================================
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -85,6 +145,41 @@ find_package(LLVM REQUIRED CONFIG)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "LLVM CMake Dir: ${LLVM_CMAKE_DIR}")
message(STATUS "LLVM Include Dir: ${LLVM_INCLUDE_DIRS}")
if(NOT DEFINED LLVM_VERSION_MAJOR)
string(REGEX MATCH "^[0-9]+" LLVM_VERSION_MAJOR "${LLVM_PACKAGE_VERSION}")
endif()
if(NOT LLVM_VERSION_MAJOR STREQUAL "21")
message(FATAL_ERROR
"PTOAS requires LLVM 21 after the LLVM21 upgrade, but found "
"LLVM ${LLVM_PACKAGE_VERSION}. Please point LLVM_DIR/MLIR_DIR to an "
"LLVM 21 build, for example vpto-dev/llvm-project:feature-vpto-llvm21.")
endif()
get_filename_component(PTO_LLVM_BUILD_LIBRARY_DIR
"${LLVM_BUILD_LIBRARY_DIR}" REALPATH)
ptoas_get_llvm_build_dir_from_llvm_dir(PTO_LLVM_BUILD_DIR)
if(PTO_LLVM_BUILD_DIR)
ptoas_get_cmake_cache_value("${PTO_LLVM_BUILD_DIR}/CMakeCache.txt"
"CMAKE_CXX_COMPILER"
PTO_LLVM_CXX_COMPILER)
endif()
if(PTO_LLVM_CXX_COMPILER AND EXISTS "${PTO_LLVM_CXX_COMPILER}")
execute_process(
COMMAND "${PTO_LLVM_CXX_COMPILER}" --version
OUTPUT_VARIABLE PTO_LLVM_CXX_VERSION_TEXT
ERROR_VARIABLE PTO_LLVM_CXX_VERSION_TEXT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if(PTO_LLVM_CXX_VERSION_TEXT MATCHES "[Cc]lang"
AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(FATAL_ERROR
"PTOAS is being configured with GNU C++ (${CMAKE_CXX_COMPILER}), "
"but the selected LLVM build was compiled with a Clang-compatible "
"compiler (${PTO_LLVM_CXX_COMPILER}). MLIR TypeID fallback strings are "
"compiler-family sensitive across shared libraries; use "
"-DCMAKE_CXX_COMPILER=${PTO_LLVM_CXX_COMPILER} or leave the compiler "
"unset so PTOAS can inherit it from LLVM_DIR.")
endif()
endif()

# 将 LLVM 模块路径加入 CMake 搜索路径
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
Expand Down Expand Up @@ -131,7 +226,7 @@ include_directories(${MLIR_INCLUDE_DIRS})
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_BINARY_DIR}/include)

link_directories(${LLVM_BUILD_LIBRARY_DIR})
link_directories(${PTO_LLVM_BUILD_LIBRARY_DIR})
add_definitions(${LLVM_DEFINITIONS})

# =========================================================
Expand Down
Loading
Loading