Skip to content

[KMCompiler]Add linalg_cross operator #11563

[KMCompiler]Add linalg_cross operator

[KMCompiler]Add linalg_cross operator #11563

Workflow file for this run

# Copyright 2026 FlagOS Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: unit-test
permissions:
contents: read
on:
workflow_dispatch:
push:
branches: [ "master" ]
types: [opened, synchronize, reopened, labeled, unlabeled]
pull_request:
branches: [ "master" ]
types: [opened, synchronize, reopened, labeled, unlabeled]
jobs:
preprocess:
runs-on: ubuntu-latest
outputs:
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
pr_id: ${{ steps.get-pr-id.outputs.PR_ID }}
labels: ${{ fromJSON(steps.get-labels.outputs.result) }}
backend_matrix: ${{ steps.build-backend-matrix.outputs.matrix }}
steps:
- id: changed-files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
- id: wait-for-triage
uses: ArcticLampyrid/action-wait-for-workflow@ff297b23789206858260877c4b83026d90c6db8c # v1.3.0
with:
workflow: .github/workflows/triage.yaml
- id: get-pr-id
shell: bash
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
PR_ID=${{ github.event.pull_request.number }}
elif [ "${{ github.event_name }}" == "push" ]; then
PR_NUMBER=$(git log -1 --pretty=format:'%s' | grep -oE '#[0-9]+' | grep -oE '[0-9]+')
PR_ID=${PR_NUMBER}
fi
echo "PR_ID=${PR_ID}" >> "$GITHUB_OUTPUT"
# NOTE: Preserve these line for debugging's purpose
echo "PR_ID: ${PR_ID}"
- id: get-labels
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
// Determine if the event is a pull request
const isPullRequest = context.eventName === 'pull_request';
if (!isPullRequest) {
return "";
}
const prNumber = context.payload.pull_request.number;
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
console.log('Labels:', labels.map(label => label.name));
return JSON.stringify(labels.map(label => label.name));
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
sparse-checkout: .github/backends.json
sparse-checkout-cone-mode: false
- id: build-backend-matrix
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const fs = require('fs');
const backends = JSON.parse(fs.readFileSync('.github/backends.json', 'utf8'));
const labels = JSON.parse(${{ steps.get-labels.outputs.result }} || '[]');
const filtered = backends.filter(b => b.enabled && labels.includes(b.label));
const matrix = {
backend: filtered.map(b => b.backend),
include: filtered.map(b => ({
backend: b.backend,
runner_label: b.runner_label,
gpu_check: b.gpu_check
}))
};
core.setOutput('matrix', JSON.stringify(matrix));
build-doc:
needs: preprocess
if: (contains(needs.preprocess.outputs.labels, 'documentation') &&
github.event.pull_request.merged == true)
uses: ./.github/workflows/sync-docs.yaml
cpp-op:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'ops/cpp')
uses: ./.github/workflows/cpp-op-test.yaml
python-op:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'tests')
concurrency:
group: python-op-${{ needs.preprocess.outputs.pr_id }}
cancel-in-progress: true
runs-on: jiuding
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
continue-on-error: true
- uses: ./.github/actions/checkout-retry
- shell: bash
run: tools/gpu_check_nvidia.sh
- shell: bash
env:
CHANGED_FILES: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
run: |
bash tools/test-op.sh ${{ needs.preprocess.outputs.pr_id }}
examples:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'examples')
concurrency:
group: examples-test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
runs-on: jiuding
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
continue-on-error: true
- uses: ./.github/actions/checkout-retry
- shell: bash
run: tools/gpu_check_nvidia.sh
- shell: bash
env:
CHANGED_FILES: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
run: |
bash tools/test-examples.sh ${{ needs.preprocess.outputs.pr_id }}
backend-tests:
needs: preprocess
if: fromJSON(needs.preprocess.outputs.backend_matrix).backend[0] != null
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.preprocess.outputs.backend_matrix) }}
uses: ./.github/workflows/backend-test.yaml
with:
backend: ${{ matrix.backend }}
runner_label: ${{ matrix.runner_label }}
gpu_check_script: ${{ matrix.gpu_check }}
changed_files: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
pr_id: ${{ needs.preprocess.outputs.pr_id }}
secrets:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
# TODO(Qiming): This job doesn't require an nvidia backend, the generic
# test-op workflow should be fine.
alpha-ops:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'ops/alpha')
uses: ./.github/workflows/backend-test.yaml
with:
backend: nvidia-cuda133
runner_label: h20
gpu_check_script: tools/gpu_check_nvidia.sh
test_script: tools/test-op-experimental.sh
changed_files: ${{ needs.preprocess.outputs.changed_files }}
secrets:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}