feat: optimize prefetch from kv cache store. #1088
Workflow file for this run
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
| name: xLLM Build x86_64 NPU | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - '.github/**' | |
| - 'cibuild/**' | |
| - 'cmake/**' | |
| - 'docs/**' | |
| - 'third_party/**' | |
| - 'tools/**' | |
| - '*.md' | |
| - '*.txt' | |
| - '*.yml' | |
| pull_request: | |
| branches: [main] | |
| types: [opened, synchronize, reopened] | |
| paths-ignore: | |
| - 'cmake/**' | |
| - 'docs/**' | |
| - 'third_party/**' | |
| - 'tools/**' | |
| - '*.md' | |
| - '*.txt' | |
| - '*.yml' | |
| pull_request_review: | |
| types: [submitted] | |
| paths: | |
| - '.github/**.yaml' | |
| - 'cibuild/**.sh' | |
| - 'setup.py' | |
| - 'examples/generate.py' | |
| env: | |
| JOBNAME: xllm-x86_64-npu-cibuild-${{ github.run_id }} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | |
| jobs: | |
| # need to review code first when sensitive files are modified. | |
| check-sensitive: | |
| runs-on: [self-hosted] | |
| outputs: | |
| requires_approval: ${{ steps.check_sensitive.outputs.requires_approval }} | |
| do_build: ${{ steps.decide.outputs.do_build }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Ensure we can compare commits | |
| - name: Install jq | |
| run: yum install -y jq | |
| - name: Check if sensitive files were changed | |
| id: check_sensitive | |
| run: | | |
| sensitive_files=( | |
| ".github/**.yaml" | |
| "cibuild/**.sh" | |
| "setup.py" | |
| "examples/generate.py" | |
| ) | |
| changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) | |
| requires_approval="false" | |
| while IFS= read -r changed_file; do | |
| [[ -z "$changed_file" ]] && continue | |
| for pattern in "${sensitive_files[@]}"; do | |
| if [[ "$changed_file" == $pattern ]]; then | |
| requires_approval="true" | |
| break 2 | |
| fi | |
| done | |
| done < <(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}") | |
| echo "requires_approval=$requires_approval" >> $GITHUB_OUTPUT | |
| - name: Decide whether to check build | |
| id: decide | |
| run: | | |
| event="${{ github.event_name }}" | |
| if [[ "$event" == "workflow_dispatch" || "$event" == "push" ]]; then | |
| echo "do_build=true" >> $GITHUB_OUTPUT | |
| elif [[ "$event" == "pull_request" ]]; then | |
| if [ "${{ steps.check_sensitive.outputs.requires_approval }}" == "true" ]; then | |
| echo "do_build=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "do_build=true" >> $GITHUB_OUTPUT | |
| fi | |
| elif [[ "$event" == "pull_request_review" ]]; then | |
| # Since pull_request_review now only triggers when sensitive files are modified, | |
| # we only need to check if the review is approved | |
| if [[ "${{ github.event.review.state }}" == "approved" ]]; then | |
| echo "do_build=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "do_build=false" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| echo "do_build=false" >> $GITHUB_OUTPUT | |
| fi | |
| build: | |
| needs: check-sensitive | |
| if: > | |
| (github.event_name == 'workflow_dispatch' || github.event_name == 'push') || | |
| needs.check-sensitive.outputs.do_build == 'true' | |
| runs-on: [self-hosted] | |
| steps: | |
| - name: Checkout Code | |
| timeout-minutes: 5 | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Build | |
| if: ${{ success() }} | |
| timeout-minutes: 60 | |
| run: | | |
| chmod +x ./cibuild/build_npu.sh | |
| bash cibuild/build_npu.sh 'pip install pre-commit -i https://pypi.tuna.tsinghua.edu.cn/simple; python setup.py bdist_wheel; pip install dist/* --force-reinstall; python examples/generate.py --model="/export/home/models/Qwen2-7B-Instruct" --devices="npu:7"' |