-
Notifications
You must be signed in to change notification settings - Fork 72
Feature/a2a3 llvm #908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
zhangstevenunity
merged 35 commits into
hw-native-sys:main
from
castigli:feature/a2a3-llvm
Jul 21, 2026
Merged
Feature/a2a3 llvm #908
Changes from 28 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
cbaff1f
rebased
castigli 98ced35
description of new pipeline
castigli 6c4fafb
fixes after rebase
castigli 3d30420
add binary e2e tests
castigli 3883ae6
update readme
castigli 8f4a25e
all binary ops without scratchpad
castigli 76d15b7
better tests
castigli 26aeced
roundtrip and verifyier
castigli 3ccb0de
cover unaligned tadd
castigli 5c0367b
shift ops
castigli 41ad438
fix xor
castigli b268b81
A5 allocator
castigli 65909eb
fixes for A5 allocator
castigli b8476e0
Merge pull request #1 from castigli/extend-a2a3-llvm
castigli 8ef0813
unary ops
castigli 61c34fb
addrelu
castigli fec8a73
fix
castigli 2531922
cleanup
castigli 67d947e
trecip
castigli 382bb92
tlog
castigli 9a9e269
merge main
castigli 7ba6761
address review
castigli 44bc1c6
fix a2a3 review and CI issues
castigli 616d7fb
fix ptoas target arch resolution
castigli 93332f8
restore emitc memory planning passes
castigli c80521f
trigger CI
castigli 7f54d1f
merge main
castigli 2ca1095
fix(vpto): use storage bit-width helper for low-precision CBuf loads
castigli f1012ca
Merge remote-tracking branch 'origin/main' into feature/a2a3-llvm
castigli a815184
Merge remote-tracking branch 'origin/main' into feature/a2a3-llvm
castigli 4190014
fix(vpto): address A2/A3 review findings
castigli 4d106d6
test(vpto): avoid CANN dependency in IR lit tests
castigli a29fe7a
ci: limit wheel build parallelism
castigli e3d4462
test(vpto): make wrapper expansion checks order-independent
castigli 69be84f
Merge remote-tracking branch 'origin/main' into feature/a2a3-llvm
castigli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # PTOAS development environment with NPU support (CANN 9.0.0) | ||
| # | ||
| # Usage: | ||
| # docker build -f docker/Dockerfile.dev -t ptoas-dev-cann900 . | ||
| # | ||
| # This image provides the toolchain for building and running PTOAS on NPU. | ||
| # It does NOT contain PTOAS itself -- mount PTOAS source at /workspace and | ||
| # run `pip install -e .` inside the container. | ||
|
|
||
| # ---- Base: CANN 9.0.0 (provides bisheng, CANN runtime, Python 3.12) ---- | ||
| FROM quay.io/ascend/cann:9.0.0-910b-ubuntu22.04-py3.12 | ||
|
|
||
| # ---- Build args (matching CI) ---- | ||
| ARG LLVM_REPO=https://github.com/vpto-dev/llvm-project.git | ||
| ARG LLVM_REF=feature-vpto-llvm21 | ||
| ARG PTO_ISA_REPO=https://gitcode.com/cann/pto-isa.git | ||
| ARG PTO_ISA_COMMIT=662d7f2a916d6bbde3109ce4a16ed5c28f5d900a | ||
|
|
||
| # ---- Paths ---- | ||
| ENV LLVM_SOURCE_DIR=/opt/llvm-project | ||
| ENV LLVM_BUILD_DIR=/opt/llvm-project/build | ||
| ENV LLVM_INSTALL_DIR=/usr/local/llvm | ||
| ENV ASCEND_HOME_PATH=/usr/local/Ascend/cann-9.0.0 | ||
| ENV PTO_LIB_PATH=/opt/pto-isa | ||
|
|
||
| # ========================================================================= | ||
| # 1. System dependencies | ||
| # ========================================================================= | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| cmake ninja-build git build-essential clang lld \ | ||
| libedit-dev zlib1g-dev libxml2-dev libzstd-dev \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # ========================================================================= | ||
| # 2. Python dependencies | ||
| # ========================================================================= | ||
| RUN pip install --no-cache-dir 'pybind11<3' numpy pyyaml pytest nanobind | ||
|
|
||
| # ========================================================================= | ||
| # 3. Build LLVM/MLIR (vpto fork, feature-vpto branch) | ||
| # ========================================================================= | ||
| RUN git clone --depth 1 --branch "${LLVM_REF}" "${LLVM_REPO}" "${LLVM_SOURCE_DIR}" | ||
|
|
||
| WORKDIR ${LLVM_SOURCE_DIR} | ||
|
|
||
| RUN cmake -G Ninja -S llvm -B "${LLVM_BUILD_DIR}" \ | ||
| -DLLVM_ENABLE_PROJECTS="mlir;clang" \ | ||
| -DBUILD_SHARED_LIBS=ON \ | ||
| -DLLVM_ENABLE_ASSERTIONS=ON \ | ||
| -DMLIR_ENABLE_BINDINGS_PYTHON=ON \ | ||
| -DPython3_EXECUTABLE=python3 \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DLLVM_TARGETS_TO_BUILD="host" \ | ||
| -DCMAKE_INSTALL_PREFIX="${LLVM_INSTALL_DIR}" \ | ||
| -DLLVM_INSTALL_UTILS=ON | ||
|
|
||
| RUN ninja -C "${LLVM_BUILD_DIR}" | ||
|
|
||
| RUN cmake --install "${LLVM_BUILD_DIR}" | ||
|
|
||
| # ========================================================================= | ||
| # 4. Clone pto-isa (headers for bisheng compilation of generated kernels) | ||
| # ========================================================================= | ||
| RUN git clone "${PTO_ISA_REPO}" "${PTO_LIB_PATH}" \ | ||
| && cd "${PTO_LIB_PATH}" && git checkout "${PTO_ISA_COMMIT}" | ||
|
|
||
| # ========================================================================= | ||
| # 5. Torch + torch-npu (for on-device kernel launch) | ||
| # ========================================================================= | ||
| RUN pip install --no-cache-dir torch==2.9.0 --index-url https://download.pytorch.org/whl/cpu \ | ||
| && pip install --no-cache-dir torch-npu==2.9.0.post2 | ||
|
|
||
| # ========================================================================= | ||
| # 6. Environment | ||
| # ========================================================================= | ||
| ENV PATH="${LLVM_INSTALL_DIR}/bin:${ASCEND_HOME_PATH}/compiler/bin:${PATH}" | ||
| ENV LD_LIBRARY_PATH="${LLVM_INSTALL_DIR}/lib:${ASCEND_HOME_PATH}/lib64:${ASCEND_HOME_PATH}/lib64/plugin/opskernel:${ASCEND_HOME_PATH}/lib64/plugin/nnengine:${ASCEND_HOME_PATH}/opp/built-in/op_impl/ai_core/tbe/op_tiling/lib/linux/aarch64:${LD_LIBRARY_PATH}" | ||
| ENV MLIR_PYTHON_ROOT="${LLVM_INSTALL_DIR}/python_packages/mlir_core" | ||
|
|
||
| ENV BISHENG_OPTS="-I${PTO_LIB_PATH}/include/pto -fPIC -shared -O2 -std=c++17 --npu-arch=dav-2201 -DMEMORY_BASE" | ||
|
|
||
| WORKDIR /workspace | ||
|
|
||
| CMD ["/bin/bash"] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.