Skip to content

Commit e20fa27

Browse files
authored
CANN: fix an issue where get_env was not fully renamed (ggml-org#18796)
* CANN: fix an issue where get_env was not fully renamed * ci: add cann with acl group * ci: define use_acl_graph using GitHub Action * ci: update cann dockerfile with acl graph
1 parent baa4ba0 commit e20fa27

4 files changed

Lines changed: 40 additions & 12 deletions

File tree

‎.devops/cann.Dockerfile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ RUN source /usr/local/Ascend/ascend-toolkit/set_env.sh --force \
4242
-DGGML_CANN=ON \
4343
-DCMAKE_BUILD_TYPE=Release \
4444
-DSOC_TYPE=ascend${CHIP_TYPE} \
45+
-DUSE_ACL_GRAPH=ON \
4546
. && \
4647
cmake --build build --config Release -j$(nproc)
4748

‎.github/workflows/build.yml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,11 @@ jobs:
13941394
arch: [x86, aarch64]
13951395
chip_type: ['910b', '310p']
13961396
build: ['Release']
1397+
use_acl_graph: ['on', 'off']
1398+
exclude:
1399+
# 310P does not support USE_ACL_GRAPH=on
1400+
- chip_type: '310p'
1401+
use_acl_graph: 'on'
13971402
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
13981403
steps:
13991404
- name: Checkout
@@ -1419,6 +1424,7 @@ jobs:
14191424
env:
14201425
BUILD_TYPE: ${{ matrix.build }}
14211426
SOC_TYPE: ascend${{ matrix.chip_type }}
1427+
USE_ACL_GRAPH: ${{ matrix.use_acl_graph }}
14221428
run: |
14231429
HOST_UID=$(id -u)
14241430
HOST_GID=$(id -g)
@@ -1428,6 +1434,7 @@ jobs:
14281434
-w /workspace \
14291435
-e SOC_TYPE=${SOC_TYPE} \
14301436
-e BUILD_TYPE=${BUILD_TYPE} \
1437+
-e USE_ACL_GRAPH=${USE_ACL_GRAPH} \
14311438
"${{ steps.cann-image.outputs.image }}" \
14321439
bash -lc '
14331440
set -e
@@ -1438,7 +1445,8 @@ jobs:
14381445
cmake -S . -B build \
14391446
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
14401447
-DGGML_CANN=on \
1441-
-DSOC_TYPE=${SOC_TYPE}
1448+
-DSOC_TYPE=${SOC_TYPE} \
1449+
-DUSE_ACL_GRAPH=${USE_ACL_GRAPH}
14421450
cmake --build build -j $(nproc)
14431451
14441452
chown -R '"${HOST_UID}"':'"${HOST_GID}"' /workspace/build

‎.github/workflows/release.yml‎

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -681,9 +681,25 @@ jobs:
681681
openEuler-cann:
682682
strategy:
683683
matrix:
684-
arch: [x86, aarch64]
685-
chip_type: ['910b', '310p']
686-
build: ['Release']
684+
include:
685+
# 910b with aclgraph (both architectures)
686+
- arch: x86
687+
chip_type: '910b'
688+
build: 'Release'
689+
use_acl_graph: 'on'
690+
- arch: aarch64
691+
chip_type: '910b'
692+
build: 'Release'
693+
use_acl_graph: 'on'
694+
# 310p without aclgraph (both architectures)
695+
- arch: x86
696+
chip_type: '310p'
697+
build: 'Release'
698+
use_acl_graph: 'off'
699+
- arch: aarch64
700+
chip_type: '310p'
701+
build: 'Release'
702+
use_acl_graph: 'off'
687703
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
688704
steps:
689705
- name: Checkout
@@ -709,6 +725,7 @@ jobs:
709725
env:
710726
BUILD_TYPE: ${{ matrix.build }}
711727
SOC_TYPE: ascend${{ matrix.chip_type }}
728+
USE_ACL_GRAPH: ${{ matrix.use_acl_graph }}
712729
run: |
713730
HOST_UID=$(id -u)
714731
HOST_GID=$(id -g)
@@ -718,6 +735,7 @@ jobs:
718735
-w /workspace \
719736
-e SOC_TYPE=${SOC_TYPE} \
720737
-e BUILD_TYPE=${BUILD_TYPE} \
738+
-e USE_ACL_GRAPH=${USE_ACL_GRAPH} \
721739
"${{ steps.cann-image.outputs.image }}" \
722740
bash -lc '
723741
set -e
@@ -728,7 +746,8 @@ jobs:
728746
cmake -S . -B build \
729747
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
730748
-DGGML_CANN=on \
731-
-DSOC_TYPE=${SOC_TYPE}
749+
-DSOC_TYPE=${SOC_TYPE} \
750+
-DUSE_ACL_GRAPH=${USE_ACL_GRAPH}
732751
cmake --build build -j $(nproc)
733752
734753
chown -R '"${HOST_UID}"':'"${HOST_GID}"' /workspace/build
@@ -741,13 +760,13 @@ jobs:
741760
- name: Pack artifacts
742761
run: |
743762
cp LICENSE ./build/bin/
744-
tar -czvf llama-${{ steps.tag.outputs.name }}-bin-${{ matrix.chip_type }}-openEuler-${{ matrix.arch }}.tar.gz --transform "s,./,llama-${{ steps.tag.outputs.name }}/," -C ./build/bin .
763+
tar -czvf llama-${{ steps.tag.outputs.name }}-bin-${{ matrix.chip_type }}-openEuler-${{ matrix.arch }}${{ matrix.use_acl_graph == 'on' && '-aclgraph' || '' }}.tar.gz --transform "s,./,llama-${{ steps.tag.outputs.name }}/," -C ./build/bin .
745764
746765
- name: Upload artifacts
747766
uses: actions/upload-artifact@v4
748767
with:
749-
path: llama-${{ steps.tag.outputs.name }}-bin-${{ matrix.chip_type }}-openEuler-${{ matrix.arch }}.tar.gz
750-
name: llama-bin-${{ matrix.chip_type }}-openEuler-${{ matrix.arch }}.tar.gz
768+
path: llama-${{ steps.tag.outputs.name }}-bin-${{ matrix.chip_type }}-openEuler-${{ matrix.arch }}${{ matrix.use_acl_graph == 'on' && '-aclgraph' || '' }}.tar.gz
769+
name: llama-bin-${{ matrix.chip_type }}-openEuler-${{ matrix.arch }}${{ matrix.use_acl_graph == 'on' && '-aclgraph' || '' }}.tar.gz
751770

752771
release:
753772
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
@@ -862,9 +881,9 @@ jobs:
862881
863882
**openEuler:**
864883
- [openEuler x86 (310p)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-310p-openEuler-x86.tar.gz)
865-
- [openEuler x86 (910b)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-910b-openEuler-x86.tar.gz)
884+
- [openEuler x86 (910b, ACL Graph)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-910b-openEuler-x86-aclgraph.tar.gz)
866885
- [openEuler aarch64 (310p)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-310p-openEuler-aarch64.tar.gz)
867-
- [openEuler aarch64 (910b)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-910b-openEuler-aarch64.tar.gz)
886+
- [openEuler aarch64 (910b, ACL Graph)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-910b-openEuler-aarch64-aclgraph.tar.gz)
868887
869888
- name: Upload release
870889
id: upload_release

‎ggml/src/ggml-cann/common.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ struct ggml_cann_graph_lru_cache {
382382

383383
std::list<ggml_cann_graph *> cache_list; /**< List storing cached graphs as raw pointers. */
384384

385-
ggml_cann_graph_lru_cache() { capacity = parse_integer(get_env("GGML_CANN_GRAPH_CACHE_CAPACITY").value_or("12")); }
385+
ggml_cann_graph_lru_cache() { capacity = parse_integer(get_env_as_lowercase("GGML_CANN_GRAPH_CACHE_CAPACITY").value_or("12")); }
386386

387387
/**
388388
* @brief Push a new graph to the front of the cache.
@@ -574,7 +574,7 @@ struct ggml_backend_cann_context {
574574
description = aclrtGetSocName();
575575

576576
#ifdef USE_ACL_GRAPH
577-
acl_graph_mode = parse_bool(get_env("GGML_CANN_ACL_GRAPH").value_or("on"));
577+
acl_graph_mode = parse_bool(get_env_as_lowercase("GGML_CANN_ACL_GRAPH").value_or("on"));
578578
GGML_LOG_INFO("%s: device %d execution mode is %s (%s)\n", __func__, device, acl_graph_mode ? "GRAPH" : "EAGER",
579579
acl_graph_mode ? "acl graph enabled" : "acl graph disabled");
580580
#endif

0 commit comments

Comments
 (0)