Merge remote-tracking branch 'origin/develop' into preserved/rocdecode

Esse commit está contido em:
Ameya Keshava Mallya
2026-01-30 20:37:24 +00:00
13538 arquivos alterados com 3331389 adições e 0 exclusões
+45
Ver Arquivo
@@ -0,0 +1,45 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/amdsmi
exclude:
- projects/amdsmi/.github/
- projects/amdsmi/docs/
- 'projects/amdsmi/.*.y*ml'
- 'projects/amdsmi/*.md'
- projects/amdsmi/LICENSE
pr: none
stages:
- stage: amdsmi
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/amdsmi.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/amdsmi
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+42
Ver Arquivo
@@ -0,0 +1,42 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/aqlprofile
exclude:
- projects/aqlprofile/.github
- projects/aqlprofile/*.md
pr: none
stages:
- stage: aqlprofile
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/aqlprofile.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/aqlprofile
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+57
Ver Arquivo
@@ -0,0 +1,57 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/clr
- projects/hip
- projects/hipother
exclude:
- projects/clr/CODEOWNERS
- projects/clr/LICENCE
- projects/clr/**/*.md
- projects/hip/docs
- projects/hip/.github
- projects/hip/.jenkins
- projects/hip/.*.yaml
- projects/hip/CODEOWNERS
- projects/hip/Jenkinsfile
- projects/hip/LICENSE.txt
- projects/hip/**/*.md
- projects/hip/VERSION
- projects/hipother/.github
- projects/hipother/CODEOWNERS
- projects/hipother/LICENSE.txt
- projects/hipother/**/*.md
pr: none
stages:
- stage: hip_clr
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/HIP.yml@pipelines_repo
parameters:
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+44
Ver Arquivo
@@ -0,0 +1,44 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/hip-tests
exclude:
- projects/hip-tests/.jenkins
- projects/hip-tests/CODEOWNERS
- projects/hip-tests/LICENSE.txt
- projects/hip-tests/**/*.md
pr: none
stages:
- stage: hip_tests
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/hip-tests.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/hip-tests
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+45
Ver Arquivo
@@ -0,0 +1,45 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/rdc
exclude:
- projects/rdc/.github
- projects/rdc/docs
- projects/rdc/.*.y*ml
- projects/rdc/*.md
- projects/rdc/LICENSE
pr: none
stages:
- stage: rdc
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/rdc.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/rdc
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+44
Ver Arquivo
@@ -0,0 +1,44 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/rocm-core
exclude:
- projects/rocm-core/CHANGELOG.md
- projects/rocm-core/CODEOWNERS
- projects/rocm-core/copyright
- projects/rocm-core/README.txt
pr: none
stages:
- stage: rocm_core
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/rocm-core.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/rocm-core
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+45
Ver Arquivo
@@ -0,0 +1,45 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/rocm-smi-lib
exclude:
- projects/rocm-smi-lib/.github
- projects/rocm-smi-lib/docs
- projects/rocm-smi-lib/.*.y*ml
- projects/rocm-smi-lib/*.md
- projects/rocm-smi-lib/License.txt
pr: none
stages:
- stage: rocm_smi_lib
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/rocm_smi_lib.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/rocm-smi-lib
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+177
Ver Arquivo
@@ -0,0 +1,177 @@
trigger: none
pr:
branches:
include:
- develop
- release/rocm-rel-7.1
- release/rocm-rel-7.2
drafts: false
variables:
- group: internal
- name: REPOSITORY_NAME
value: '$(Build.Repository.Name)'
- name: HEAD_SHA
value: '$(system.pullRequest.sourceCommitId)'
- name: PR_NUM
value: '$(system.pullRequest.pullRequestNumber)'
- name: PR_URL
value: '$(system.pullRequest.sourceRepositoryUri)/pull/$(PR_NUM)'
- name: BASE_REF
value: '$(system.pullRequest.TargetBranch)'
- name: EVENT_TYPE
value: 'pull_request'
- name: GH_PAT
value: '$(svc_acc_org_secret)'
jobs:
- job: Determine_Changes
displayName: 'Sparse Checkout & Check Changed Files'
pool: rocm-ci-caller
steps:
- script: |
echo "## Detecting file changes in PR #$(PR_NUM)"
git init repo_name
cd repo_name
git config core.sparseCheckout true
echo "projects/" > .git/info/sparse-checkout
echo "shared/" >> .git/info/sparse-checkout
git remote add origin https://github.com/$(REPOSITORY_NAME).git
git fetch --depth=250 origin $(BASE_REF)
git fetch --depth=250 origin $(HEAD_SHA)
git checkout FETCH_HEAD
git diff --name-only origin/$(BASE_REF)...HEAD > ../changed_files.txt
echo "Changed files:"
cat ../changed_files.txt
MATCH_FOUND=false
WINDOWS_SKIP=true
while read file; do
if [[ "$file" == projects/* ]]; then
MATCH_FOUND=true
fi
if [[ "$file" == projects/clr/* || "$file" == projects/hip/* || "$file" == projects/hip-tests/* ]]; then
WINDOWS_SKIP=false
fi
# Exclude paths:
# docs/**
# *.md
# *.rtf
# *.rst
#
# projects/*/docs/**
# **/.markdownlint-ci2.yaml
# **/.readthedocs.yaml
# **/.spellcheck.local.yaml
# **/.wordlist.txt
if [[ "${file}" == docs/* || \
"${file}" == *.md || \
"${file}" == *.rtf || \
"${file}" == *.rst
]] || \
grep --quiet --extended-regexp '^projects/[^/.]+/docs/.*$' <<< "${file}" || \
grep --quiet --extended-regexp '^([^/.]+/)*.markdownlint-ci2.yaml$' <<< "${file}" || \
grep --quiet --extended-regexp '^([^/.]+/)*.readthedocs.yaml$' <<< "${file}" || \
grep --quiet --extended-regexp '^([^/.]+/)*.spellcheck.local.yaml$' <<< "${file}" || \
grep --quiet --extended-regexp '^([^/.]+/)*.wordlist.txt$' <<< "${file}" \
; then
WINDOWS_SKIP=true
MATCH_FOUND=false
fi
if [[ "$MATCH_FOUND" == true && "$WINDOWS_SKIP" == false ]]; then
break
fi
done < ../changed_files.txt
echo "Match found: $MATCH_FOUND"
echo "##vso[task.setvariable variable=match_found;isOutput=true]$MATCH_FOUND"
echo "##vso[task.setvariable variable=windows_skip;isOutput=true]$WINDOWS_SKIP"
name: detectChanges
displayName: Detect path changes
- job: Trigger_Pipeline
displayName: 'Trigger Pipeline or Skip'
dependsOn: Determine_Changes
condition: succeeded()
pool: rocm-ci-caller
variables:
match_found: $[ dependencies.Determine_Changes.outputs['detectChanges.match_found'] ]
windows_skip: $[ dependencies.Determine_Changes.outputs['detectChanges.windows_skip'] ]
steps:
- checkout: none
- script: |
echo "DEBUG: match_found = '$(match_found)'"
displayName: 'Debug match_found variable'
- script: |
echo "DEBUG: windows_skip = '$(windows_skip)'"
displayName: 'Debug windows_skip variable'
- script: |
echo "Changes outside monitored paths (clr, hip, hip-tests). Skipping WindowsCI - Internal."
echo "Sending success status for WindowsCI - Internal..."
export GH_TOKEN=$(GH_PAT)
gh api repos/$(REPOSITORY_NAME)/statuses/$(HEAD_SHA) \
-f state=success \
-f context="WindowsCI - Internal" \
-f description="Windows PSDB skipped"
displayName: 'Skip WindowsCI - Internal'
condition: eq(variables.windows_skip, 'true')
- script: |
rm -rf $(repo_name)
git clone $(gh_repo)
displayName: Checkout Code
condition: eq(variables.match_found, 'true')
- script: |
set -e
echo "Calling jenkins_api.py for PR #$(PR_NUM)"
cd $(repo_name)
docker run \
-v "$PWD:/src" \
-w /src \
-e GH_TOKEN="$(svc_acc_org_secret)" \
-e svc_acc_org_secret="$(svc_acc_org_secret)" \
$(base_image) \
bash -c "echo 'Fetching PR title from GitHub API...' && \
echo 'repos/$(REPOSITORY_NAME)/pulls/$(PR_NUM)' && \
export TITLE=\$(gh api repos/$(REPOSITORY_NAME)/pulls/$(PR_NUM) | jq -r .title) && \
python3 jenkins_api.py \
-ghr '$(REPOSITORY_NAME)' \
-ghsha '$(HEAD_SHA)' \
-ghprn '$(PR_NUM)' \
-ghpru '$(PR_URL)' \
-ghprt \"\$TITLE\" \
-ghpat '$(GH_PAT)' \
-br '$(BASE_REF)' \
-et '$(EVENT_TYPE)'" > /dev/null 2>&1
displayName: Invoke jenkins_api.py in Docker
env:
svc_acc_org_secret: $(svc_acc_org_secret)
condition: eq(variables.match_found, 'true')
- script: |
echo "Changes outside monitored paths. Skipping Jenkins trigger."
echo "Sending success status for PSDB..."
export GH_TOKEN=$(GH_PAT)
gh api repos/$(REPOSITORY_NAME)/statuses/$(HEAD_SHA) \
-f state=success \
-f context="PSDB" \
-f description="PSDB skipped"
gh api repos/$(REPOSITORY_NAME)/statuses/$(HEAD_SHA) \
-f state=success \
-f context="psdb-test" \
-f description="psdb-test skipped"
displayName: Send Skipped Status
condition: ne(variables.match_found, 'true')
+43
Ver Arquivo
@@ -0,0 +1,43 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/rocminfo
exclude:
- projects/rocminfo/.github
- projects/rocminfo/License.txt
- projects/rocminfo/README.md
pr: none
stages:
- stage: rocminfo
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/rocminfo.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/rocminfo
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+47
Ver Arquivo
@@ -0,0 +1,47 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/rocprofiler-compute
exclude:
- projects/rocprofiler-compute/.github
- projects/rocprofiler-compute/docs
- projects/rocprofiler-compute/.*.y*ml
- projects/rocprofiler-compute/*.md
- projects/rocprofiler-compute/AUTHORS
- projects/rocprofiler-compute/LICENSE
- projects/rocprofiler-compute/VERSION
pr: none
stages:
- stage: rocprofiler_compute
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/rocprofiler-compute.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/rocprofiler-compute
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+44
Ver Arquivo
@@ -0,0 +1,44 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/rocprofiler-register
exclude:
- projects/rocprofiler-register/.github
- projects/rocprofiler-register/LICENSE
- projects/rocprofiler-register/README.md
- projects/rocprofiler-register/VERSION
pr: none
stages:
- stage: rocprofiler_register
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/rocprofiler-register.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/rocprofiler-register
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+46
Ver Arquivo
@@ -0,0 +1,46 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/rocprofiler-sdk
exclude:
- projects/rocprofiler-sdk/.github
- projects/rocprofiler-sdk/ISSUE_TEMPLATE
- projects/rocprofiler-sdk/*.md
- projects/rocprofiler-sdk/CODEOWNERS
- projects/rocprofiler-sdk/LICENSE
- projects/rocprofiler-sdk/source/docs
pr: none
stages:
- stage: rocprofiler_sdk
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/rocprofiler-sdk.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/rocprofiler-sdk
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+47
Ver Arquivo
@@ -0,0 +1,47 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/rocprofiler-systems
exclude:
- projects/rocprofiler-systems/.github
- projects/rocprofiler-systems/docs
- projects/rocprofiler-systems/.*.y*ml
- projects/rocprofiler-systems/*.md
- projects/rocprofiler-systems/LICENSE
- projects/rocprofiler-systems/VERSION
- projects/rocprofiler-systems/.wordlist.txt
pr: none
stages:
- stage: rocprofiler_systems
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/rocprofiler-systems.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/rocprofiler-systems
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+44
Ver Arquivo
@@ -0,0 +1,44 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/rocprofiler
exclude:
- projects/rocprofiler/.github
- projects/rocprofiler/doc
- projects/rocprofiler/LICENSE
- projects/rocprofiler/*.md
pr: none
stages:
- stage: rocprofiler
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/rocprofiler.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/rocprofiler
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+43
Ver Arquivo
@@ -0,0 +1,43 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/rocr-runtime
exclude:
- projects/rocr-runtime/.github
- projects/rocr-runtime/LICENSE.txt
- projects/rocr-runtime/*.md
pr: none
stages:
- stage: rocr_runtime
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/ROCR-Runtime.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/rocr-runtime
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
+44
Ver Arquivo
@@ -0,0 +1,44 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
parameters:
- name: pipelinesRepoRef
type: string
default: refs/heads/develop
- name: triggerDownstreamJobs
type: boolean
default: true
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
ref: ${{ parameters.pipelinesRepoRef }}
trigger:
batch: true
branches:
include:
- develop
paths:
include:
- projects/roctracer
exclude:
- projects/roctracer/.github
- projects/roctracer/doc
- projects/roctracer/LICENSE
- projects/roctracer/README.md
pr: none
stages:
- stage: roctracer
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/roctracer.yml@pipelines_repo
parameters:
sparseCheckoutDir: projects/roctracer
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
- template: templates/report-summary-check-wrapper.yml
@@ -0,0 +1,19 @@
stages:
- stage: report_successful
condition: succeeded()
jobs:
- template: report-summary-check.yml
parameters:
checkConclusion: success
- stage: report_failed
condition: failed()
jobs:
- template: report-summary-check.yml
parameters:
checkConclusion: failure
- stage: report_cancelled
condition: canceled() # note: only 1 L in canceled()
jobs:
- template: report-summary-check.yml
parameters:
checkConclusion: cancelled
@@ -0,0 +1,112 @@
parameters:
- name: checkConclusion
type: string
default: success
values:
- success
- failure
- cancelled
jobs:
- job: report_summary_check
displayName: 'Report check status: ${{ parameters.checkConclusion }}'
variables:
- group: systems-assistant
pool:
vmImage: ubuntu-latest
steps:
- checkout: none
- task: Bash@3
displayName: Install GitHub CLI
condition: always()
inputs:
targetType: 'inline'
script: |
(type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& sudo mkdir -p -m 755 /etc/apt/sources.list.d \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh jq -y
- task: Bash@3
displayName: Report CI status to GitHub PR Summary Check
condition: always()
env:
APP_ID: $(APP_ID)
APP_INSTALLATION_ID: $(APP_INSTALLATION_ID)
APP_PRIVATE_KEY: $(APP_PRIVATE_KEY)
inputs:
targetType: 'inline'
script: |
if [[ ! "$(Build.SourceBranch)" =~ ^refs/pull/ ]]; then
echo "This is not a PR build. Exiting."
exit 0
fi
# APP_PRIVATE_KEY is generated with `base64 app_private_key.pem | tr -d '\n'`
echo "$APP_PRIVATE_KEY" | base64 -d > app_private_key.pem
chmod 600 app_private_key.pem
create_jwt() {
local header=$(echo -n '{"alg":"RS256","typ":"JWT"}' | openssl base64 -e | tr -d '=' | tr '/+' '_-' | tr -d '\n')
local payload=$(echo -n "{\"iat\":$(date +%s),\"exp\":$(($(date +%s) + 600)),\"iss\":\"$APP_ID\"}" | openssl base64 -e | tr -d '=' | tr '/+' '_-' | tr -d '\n')
local unsigned_token="${header}.${payload}"
local signature=$(echo -n "$unsigned_token" | openssl dgst -sha256 -sign "app_private_key.pem" | openssl base64 -e | tr -d '=' | tr '/+' '_-' | tr -d '\n')
echo "${unsigned_token}.${signature}"
}
JWT=$(create_jwt)
export GH_TOKEN=$(curl -sSX POST \
-H "Authorization: Bearer $JWT" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/app/installations/$APP_INSTALLATION_ID/access_tokens" | jq -r .token)
PR_NUMBER=$(echo "$(Build.SourceBranch)" | sed 's|refs/pull/\([0-9]*\)/.*|\1|')
PR_HEAD_SHA=$(curl -s "https://api.github.com/repos/ROCm/rocm-systems/pulls/$PR_NUMBER" | jq -r '.head.sha')
CHECK=$(curl -s "https://api.github.com/repos/ROCm/rocm-systems/commits/$PR_HEAD_SHA/check-runs" | jq -r '.check_runs[] | select(.name == "Azure CI Summary")')
CHECK_ID=$(echo "$CHECK" | jq -r '.id')
CHECK_SUMMARY=$(echo "$CHECK" | jq -r '.output.summary')
CHECK_TEXT=$(echo "$CHECK" | jq -r '.output.text')
if [[ -z "$CHECK_ID" ]]; then
echo "No Azure CI Summary check found for commit $PR_HEAD_SHA"
exit 0
fi
if [[ "$CHECK_SUMMARY" == *"$(Build.BuildId)"* ]]; then
CHECK_SUMMARY=$(echo "$CHECK_SUMMARY" | sed "s/buildId=$(Build.BuildId)[^|]*|[^|]*|/buildId=$(Build.BuildId)) | ${{ parameters.checkConclusion }} |/")
fi
if [[ "$CHECK_TEXT" == *"$(Build.BuildId)="* ]]; then
CHECK_TEXT=$(echo "$CHECK_TEXT" | sed "s/$(Build.BuildId)=[^;]*;/$(Build.BuildId)=${{ parameters.checkConclusion }};/")
fi
CHECK_STATUS=$(echo "$CHECK_TEXT" | grep -q "pending" && echo "in_progress" || echo "completed")
CHECK_CONCLUSION=$(echo "$CHECK_TEXT" | grep -q -e "cancelled" -e "failure" && echo "failure" || echo "success")
if [[ "$CHECK_STATUS" == "completed" ]]; then
gh_output=$(gh api repos/ROCm/rocm-systems/check-runs/$CHECK_ID \
-X PATCH \
-f "name=Azure CI Summary" \
-f "head_sha=$PR_HEAD_SHA" \
-f "status=$CHECK_STATUS" \
-f "conclusion=$CHECK_CONCLUSION" \
-f "output[title]=Azure CI Summary" \
-f "output[summary]=$CHECK_SUMMARY" \
-f "output[text]=$CHECK_TEXT")
else
gh_output=$(gh api repos/ROCm/rocm-systems/check-runs/$CHECK_ID \
-X PATCH \
-f "name=Azure CI Summary" \
-f "head_sha=$PR_HEAD_SHA" \
-f "output[title]=Azure CI Summary" \
-f "output[summary]=$CHECK_SUMMARY" \
-f "output[text]=$CHECK_TEXT")
fi
echo "Reported status '${{ parameters.checkConclusion }}' to summary check: $(echo "$gh_output" | jq -r '.id')"
if [[ "$CHECK_STATUS" == "completed" ]]; then
echo "All checks completed with overall conclusion: $CHECK_CONCLUSION"
else
echo "Some checks are still in progress: $CHECK_STATUS"
fi
echo "Summary check URL: $(echo "$gh_output" | jq -r '.html_url')"
+3
Ver Arquivo
@@ -0,0 +1,3 @@
/config.local
/tmp
/cache
+6
Ver Arquivo
@@ -0,0 +1,6 @@
[core]
autostage = true
remote = storage
['remote "storage"']
url = s3://therock-dvc/rocm-systems
allow_anonymous_login = true
+3
Ver Arquivo
@@ -0,0 +1,3 @@
# Add patterns of files dvc should ignore, which could improve
# the performance. Learn more at
# https://dvc.org/doc/user-guide/dvcignore
+2
Ver Arquivo
@@ -0,0 +1,2 @@
2ff2316227dc3bb04447060c719e78baf2d7383f
f7338717aeb56fbe394c0683539a0cf2f7f3ded7
+97
Ver Arquivo
@@ -0,0 +1,97 @@
# CI ownership
/.azuredevops/ @ROCm/external-ci
/.github/ @ROCm/rocm-systems-reviewers
# Global documentation ownership
/**/*.md @ROCm/rocm-documentation
/**/*.rst @ROCm/rocm-documentation
**/.readthedocs.yaml @ROCm/rocm-documentation
**/docs/ @ROCm/rocm-documentation
**/library/include/ @ROCm/rocm-documentation
# Project-specific ownership
/projects/amdsmi/ @ROCm/smi-reviewers
/projects/clr/ @ROCm/clr-reviewers
/projects/hip/ @ROCm/hip-reviewers
/projects/hipother/ @ROCm/hipother-reviewers
/projects/hip-tests/ @ROCm/hip-tests-reviewers
/projects/rccl/ @ROCm/rccl-reviewers
/projects/rccl/src/include/api_trace.h @ROCm/rccl-reviewers @ROCm/ROCM-DevTools-Team
/projects/rccl-tests/ @ROCm/rccl-reviewers
/projects/rdc/ @ROCm/rdc-reviewers
/projects/rocm-core/ @nunnikri @frepaul @raramakr @ashutom @amd-isparry @arvindcheru
/projects/rocm-smi-lib/ @ROCm/smi-reviewers
/projects/rocminfo/ @dayatsin-amd @shwetagkhatri
/projects/rocprofiler-compute/ @ROCm/rocprof-compute-reviewer # Owners: @ROCm/rocprof-compute-owners, Reviewers: @ROCm/rocprof-compute-reviewer
/projects/rocprofiler-systems/ @ROCm/rocprof-sys @jrmadsen
/projects/rocprofiler-sdk/ @ROCm/rocm-devtools-team @ROCm/rocprofiler-owners # First Review: @ROCm/rocm-devtools-team, Final Review: @ROCm/rocprofiler-owners
/projects/rocr-runtime/ @kentrussell @dayatsin-amd @cfreeamd
/projects/roctracer/ @ammarwa @bgopesh
/projects/rocshmem/ @ROCm/rocshmem-reviewers
# Language runtime build infra code owners
/projects/clr/**/*.cmake @ROCm/clr-reviewers @ROCm/lrt-build-infra
/projects/clr/**/CMakeLists.txt @ROCm/clr-reviewers @ROCm/lrt-build-infra
/projects/hip/**/*.cmake @ROCm/hip-reviewers @ROCm/lrt-build-infra
/projects/hip/**/CMakeLists.txt @ROCm/hip-reviewers @ROCm/lrt-build-infra
/projects/hipother/**/*.cmake @ROCm/hipother-reviewers @ROCm/lrt-build-infra
/projects/hipother/**/CMakeLists.txt @ROCm/hipother-reviewers @ROCm/lrt-build-infra
/projects/hip-tests/**/*.cmake @ROCm/hip-tests-reviewers @ROCm/lrt-build-infra
/projects/hip-tests/**/CMakeLists.txt @ROCm/hip-tests-reviewers @ROCm/lrt-build-infra
# rocr-runtime section-specific code owners
/projects/rocr-runtime/libhsakmt @kentrussell @dayatsin-amd @cfreeamd
/projects/rocr-runtime/libhsakmt/tests/kfdtest @kentrussell @xiaogang-chen-amd
/projects/rocr-runtime/rocrtst @shwetagkhatri @cfreeamd
/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/trap_handler/*.s @lancesix @dayatsin-amd @cfreeamd @shwetagkhatri
/projects/rocr-runtime/runtime/hsa-runtime/core/driver/xdna @atgutier @ypapadop-amd @dayatsin-amd @cfreeamd
/projects/rocr-runtime/runtime/hsa-runtime/core/driver/virtio @dayatsin-amd @cfreeamd
/projects/rocr-runtime/runtime/hsa-runtime/loader @dayatsin-amd @kzhuravl @cfreeamd
/projects/rocr-runtime/runtime/hsa-runtime/image @shwetagkhatri @dayatsin-amd @cfreeamd
/projects/rocr-runtime/runtime/hsa-runtime/pcs @shwetagkhatri @dayatsin-amd @cfreeamd
# Documentation-specific ownership by project
/projects/clr/**/*.md @ROCm/clr-reviewers @ROCm/lrt-docs-reviewers
/projects/clr/**/*.rst @ROCm/clr-reviewers @ROCm/lrt-docs-reviewers
/projects/clr/**/.readthedocs.yaml @ROCm/clr-reviewers @ROCm/lrt-docs-reviewers
/projects/clr/hipamd/include/ @ROCm/clr-reviewers @ROCm/lrt-docs-reviewers
/projects/hip/**/*.md @ROCm/hip-reviewers @ROCm/lrt-docs-reviewers
/projects/hip/**/*.rst @ROCm/hip-reviewers @ROCm/lrt-docs-reviewers
/projects/hip/**/.readthedocs.yaml @ROCm/hip-reviewers @ROCm/lrt-docs-reviewers
/projects/hip/docs/ @ROCm/hip-reviewers @ROCm/lrt-docs-reviewers
/projects/hip/include/ @ROCm/hip-reviewers @ROCm/lrt-docs-reviewers
/projects/rdc/**/*.md @ROCm/rdc-reviewers @ROCm/rocm-documentation
/projects/rdc/**/*.rst @ROCm/rdc-reviewers @ROCm/rocm-documentation
/projects/rdc/**/.readthedocs.yaml @ROCm/rdc-reviewers @ROCm/rocm-documentation
/projects/rdc/docs/ @ROCm/rdc-reviewers @ROCm/rocm-documentation
/projects/rocm-core/**/*.md @nunnikri @frepaul @raramakr @ashutom @amd-isparry @arvindcheru @ROCm/rocm-documentation
/projects/rocm-core/**/*.rst @nunnikri @frepaul @raramakr @ashutom @amd-isparry @arvindcheru @ROCm/rocm-documentation
/projects/rocm-smi-lib/**/*.md @ROCm/smi-reviewers @ROCm/rocm-documentation
/projects/rocm-smi-lib/**/*.rst @ROCm/smi-reviewers @ROCm/rocm-documentation
/projects/rocm-smi-lib/**/.readthedocs.yaml @ROCm/smi-reviewers @ROCm/rocm-documentation
/projects/rocm-smi-lib/docs/ @ROCm/smi-reviewers @ROCm/rocm-documentation
/projects/rocminfo/**/*.md @dayatsin-amd @shwetagkhatri @ROCm/rocm-documentation
/projects/rocminfo/**/*.rst @dayatsin-amd @shwetagkhatri @ROCm/rocm-documentation
/projects/rocminfo/**/.readthedocs.yaml @dayatsin-amd @shwetagkhatri @ROCm/rocm-documentation
/projects/rocminfo/docs/ @dayatsin-amd @shwetagkhatri @ROCm/rocm-documentation
/projects/rocprofiler-compute/**/*.md @ROCm/rocprof-compute-reviewer @ROCm/rocm-documentation @prbasyal-amd
/projects/rocprofiler-compute/**/*.rst @ROCm/rocprof-compute-reviewer @ROCm/rocm-documentation @prbasyal-amd
/projects/rocprofiler-compute/**/.readthedocs.yaml @ROCm/rocprof-compute-reviewer @ROCm/rocm-documentation @prbasyal-amd
/projects/rocprofiler-compute/docs/ @ROCm/rocprof-compute-reviewer @ROCm/rocm-documentation @prbasyal-amd
/projects/rocprofiler-systems/**/*.md @ROCm/rocprof-sys @jrmadsen @ROCm/rocm-documentation
/projects/rocprofiler-systems/**/*.rst @ROCm/rocprof-sys @jrmadsen @ROCm/rocm-documentation
/projects/rocprofiler-systems/**/.readthedocs.yaml @ROCm/rocprof-sys @jrmadsen @ROCm/rocm-documentation
/projects/rocprofiler-systems/docs/ @ROCm/rocprof-sys @jrmadsen @ROCm/rocm-documentation
/projects/rocr-runtime/**/*.md @kentrussell @dayatsin-amd @ROCm/rocm-documentation
/projects/rocr-runtime/**/*.rst @kentrussell @dayatsin-amd @ROCm/rocm-documentation
/projects/rocr-runtime/**/.readthedocs.yaml @kentrussell @dayatsin-amd @ROCm/rocm-documentation
+60
Ver Arquivo
@@ -0,0 +1,60 @@
version: 2
updates:
# Check for updates to GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
github-actions:
patterns:
- "*"
- package-ecosystem: "pip" # See documentation for possible values
directory: "projects/hipcub/docs/sphinx" # Location of package manifests
open-pull-requests-limit: 10
schedule:
interval: "daily"
labels:
- "documentation"
- "dependencies"
- "ci:docs-only"
reviewers:
- "samjwu"
- package-ecosystem: "pip" # See documentation for possible values
directory: "projects/rocprim/docs/sphinx" # Location of package manifests
open-pull-requests-limit: 10
schedule:
interval: "daily"
labels:
- "documentation"
- "dependencies"
- "ci:docs-only"
reviewers:
- "samjwu"
- package-ecosystem: "pip" # See documentation for possible values
directory: "projects/rocrand/docs/sphinx" # Location of package manifests
open-pull-requests-limit: 10
schedule:
interval: "daily"
labels:
- "documentation"
- "dependencies"
- "ci:docs-only"
reviewers:
- "samjwu"
- package-ecosystem: "pip" # See documentation for possible values
directory: "projects/rocthrust/docs/sphinx" # Location of package manifests
open-pull-requests-limit: 10
schedule:
interval: "daily"
labels:
- "documentation"
- "dependencies"
- "ci:docs-only"
reviewers:
- "samjwu"
+62
Ver Arquivo
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
set -euo pipefail
RANGE=""
while [[ $# -gt 0 ]]; do
echo $1
echo $2
case "$1" in
--range)
RANGE="$2"
shift 2
;;
*)
echo "Unknown arg $1" >&2
exit 64
;;
esac
done
regex='\.(c|cc|cpp|cxx|h|hh|hpp|hxx)$'
clang_bin="${CLANG_FORMAT:-clang-format}"
if ! command -v "$clang_bin" >/dev/null 2>&1; then
if [[ -x "/c/Program Files/LLVM/bin/clang-format.exe" ]]; then
clang_bin="/c/Program Files/LLVM/bin/clang-format.exe"
fi
fi
clang_format_diff="${CLANG_FORMAT_DIFF:-clang-format-diff}"
if ! command -v "$clang_format_diff" >/dev/null 2>&1; then
if [[ -x "/c/Program Files/LLVM/share/clang/clang-format-diff.py" ]]; then
clang_format_diff="/c/Program Files/LLVM/share/clang/clang-format-diff.py"
fi
fi
directories=(projects/hip projects/clr projects/hipother projects/hip-tests)
for dir in ${array[*]}; do
cd $dir
if [[ -n $RANGE ]]; then
files=$(git diff --name-only "$RANGE" . | grep -E "$regex" || true)
else
files=$(git diff --cached --name-only --diff-filter=ACMR . | grep -E "$regex" || true)
fi
echo "Checking $files"
[[ -z $files ]] && exit 0
for file in $files; do
echo "Checking lines of $file"
if [[ -n $RANGE ]]; then
diff_output=$(git diff -U0 "$RANGE" -- "$file")
else
diff_output=$(git diff -U0 --cached -- "$file")
fi
echo "$diff_output" | "$clang_format_diff" -style=file -fallback-style=none -p1
done
cd ..
done
+2
Ver Arquivo
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec "$(git rev-parse --show-toplevel)/.github/hooks/clang-format-check.sh"
+103
Ver Arquivo
@@ -0,0 +1,103 @@
"project: amdsmi":
- changed-files:
- any-glob-to-any-file: 'projects/amdsmi/**/*'
"project: aqlprofile":
- changed-files:
- any-glob-to-any-file: 'projects/aqlprofile/**/*'
"project: clr":
- changed-files:
- any-glob-to-any-file: 'projects/clr/**/*'
"project: hip":
- changed-files:
- any-glob-to-any-file: 'projects/hip/**/*'
"project: hipother":
- changed-files:
- any-glob-to-any-file: 'projects/hipother/**/*'
"project: hip-tests":
- changed-files:
- any-glob-to-any-file: 'projects/hip-tests/**/*'
"project: rccl":
- changed-files:
- any-glob-to-any-file: 'projects/rccl/**/*'
"project: rccl-tests":
- changed-files:
- any-glob-to-any-file: 'projects/rccl-tests/**/*'
"project: rdc":
- changed-files:
- any-glob-to-any-file: 'projects/rdc/**/*'
"project: rocm-core":
- changed-files:
- any-glob-to-any-file: 'projects/rocm-core/**/*'
"project: rocminfo":
- changed-files:
- any-glob-to-any-file: 'projects/rocminfo/**/*'
"project: rocm-smi-lib":
- changed-files:
- any-glob-to-any-file: 'projects/rocm-smi-lib/**/*'
"project: rocprofiler":
- changed-files:
- any-glob-to-any-file: 'projects/rocprofiler/**/*'
"project: rocprofiler-compute":
- changed-files:
- any-glob-to-any-file: 'projects/rocprofiler-compute/**/*'
"project: rocprofiler-register":
- changed-files:
- any-glob-to-any-file: 'projects/rocprofiler-register/**/*'
"project: rocprofiler-sdk":
- changed-files:
- any-glob-to-any-file: 'projects/rocprofiler-sdk/**/*'
"project: rocprofiler-systems":
- changed-files:
- any-glob-to-any-file: 'projects/rocprofiler-systems/**/*'
"project: rocr-runtime":
- changed-files:
- any-glob-to-any-file: 'projects/rocr-runtime/**/*'
"project: rocshmem":
- changed-files:
- any-glob-to-any-file: 'projects/rocshmem/**/*'
"project: roctracer":
- changed-files:
- any-glob-to-any-file: 'projects/roctracer/**/*'
"shared: amdgpu-windows-interop":
- changed-files:
- any-glob-to-any-file: 'shared/amdgpu-windows-interop/**/*'
documentation:
- changed-files:
- any-glob-to-any-file:
- docs/**/*
- '**/docs/**/*'
- '*.md'
External CI:
- changed-files:
- any-glob-to-any-file:
- .azuredevops/**/*
github actions:
- changed-files:
- any-glob-to-any-file:
- .github/workflows/**/*
- .github/scripts/**/*
- .github/*.json
- .github/*.yml
+388
Ver Arquivo
@@ -0,0 +1,388 @@
- name: bug
color: ee0701
description: null
- name: BuildPackaging
color: 87d1e5
description: CMake and other build related enhancements
- name: change request
color: 37C0A1
description: A code change requested by external or internal stakeholders
- name: CI - Failed
color: B60205
description: ''
- name: CI - Pass
color: 0E8A16
description: ''
- name: CI - Testing
color: FBCA04
description: ''
- name: ci:asan
color: 561D33
description: ''
- name: ci:ccache
color: FBCA04
description: Enable ccache in CI builds
- name: ci:codecoverage
color: bfd4f2
description: ''
- name: ci:debug
color: 73CAF8
description: ''
- name: ci:docs-only
color: 24D116
description: Docs only changes
- name: ci:extended
color: d93f0b
description: ''
- name: ci:gpu:gfx90a
color: 12E85E
description: ''
- name: ci:gpu:gfx942
color: 6119E7
description: ''
- name: ci:nightly
color: 2F1E2B
description: ''
- name: ci:no-ccache
color: bfd4f2
description: disable ccache
- name: ci:no-sparse
color: C870AE
description: Skip testing sparse functionality
- name: ci:profiling
color: 006b75
description: ''
- name: ci:smoke
color: 13E349
description: ''
- name: ci:static-libraries
color: 54AE5B
description: ''
- name: ci:testonly
color: E57E1A
description: ''
- name: clang
color: 22DDAA
description: ''
- name: code quality
color: F7E574
description: ''
- name: compilation time
color: F66750
description: ''
- name: compiler bug
color: F13314
description: ''
- name: complexity_high
color: bb0099
description: ''
- name: complexity_low
color: ffbbcc
description: ''
- name: complexity_middle
color: dd88cc
description: ''
- name: correctness
color: 3377ff
description: ''
- name: debug
color: bfd4f2
description: ''
- name: debugging
color: 4444ee
description: ''
- name: DebugHelpers
color: 8c0c24
description: Code to help with debugging
- name: dependencies
color: 0366d6
description: Pull requests that update a dependency file
- name: Design
color: 403df7
description: Design change requiring detailed review
- name: DeviceCodeGen
color: 0e8a16
description: General device code generator pieces
- name: documentation
color: 5555ff
description: ''
- name: Documentation
color: ddc10b
description: Documentation
- name: duplicate
color: cfd3d7
description: This issue or pull request already exists
- name: enhancement
color: 99ff99
description: ''
- name: envUseHipblasLT
color: e99695
description: export ROCBLAS_USE_HIPBLASLT=1
- name: external
color: d8587a
description: ''
- name: external contribution
color: 6A7916
description: Code contribution from users community..
- name: external_collaborator
color: D93F0B
description: ''
- name: Feature Request
color: D5CA0F
description: ''
- name: feature request
color: 86E277
description: New feature or request
- name: g++
color: d4c5f9
description: ''
- name: GFX10Code
color: d896f2
description: ''
- name: gfx12
color: e99695
description: ''
- name: gfx942
color: B40A83
description: ''
- name: gfx94x
color: c5def5
description: ''
- name: gfx950
color: 006b75
description: run CI on gfx950
- name: GFX9Code
color: 44ce84
description: Python code generator
- name: gfxall
color: 5319e7
description: PRs to develop built using all default gfx targets
- name: good first issue
color: 7057ff
description: Good for newcomers
- name: GTest
color: fbca04
description: ''
- name: help wanted
color: 084408
description: ''
- name: helpWanted
color: 008672
description: Extra attention is needed
- name: hipcc
color: 1507A2
description: ''
- name: Hotfix
color: 20FF50
description: Hotfix to quickly address breakage
- name: IMPACTS_API
color: bb0099
description: ''
- name: IMPACTS_FIND_DB
color: eebb11
description: ''
- name: IMPACTS_PERFORMANCE_DB
color: ee8811
description: ''
- name: initial iteration time
color: 128A0C
description: ''
- name: invalid
color: e4e669
description: This doesn't seem right
- name: KTN
color: C2E0C6
description: KernelTuningNet model updated
- name: merge conflict
color: F9A830
description: ''
- name: needs clarification
color: cc0000
description: This issue needs additional information before it can be properly addressed
- name: NoCI
color: '000000'
description: Don't run CI
- name: noCI
color: e99695
description: 'Disable testing on supported CI systems: math libraries CI has this
feature enabled..'
- name: noExtendedCI
color: 006b75
description: ''
- name: noHipblasLT
color: 1d76db
description: Run PR without hipblasLT
- name: non-miopen-bug
color: ee0701
description: ''
- name: noOptimizations
color: 34a503
description: Disable optimized kernels for small sizes for some routines
- name: noSolver
color: CFE25A
description: Run PR without rocSOLVER
- name: noSolverClients
color: EC8EE7
description: Build without rocSOLVER clients
- name: noTensile
color: bbe580
description: Run PR without Tensile
- name: noTensileLogic
color: B1500E
description: ''
- name: on hold
color: FBCA04
description: ''
- name: ON_HOLD
color: ccddff
description: ''
- name: performance
color: 128A0C
description: ''
- name: Performance Issue
color: c5def5
description: performance issue due to regression or something fishy
- name: PerfTest
color: f9d0c4
description: Performance tests
- name: post-merge
color: 13361A
description: For issue tracking after PR merge
- name: priority
color: 8C0BF4
description: ''
- name: quality
color: ffbb88
description: ''
- name: question
color: 0066aa
description: ''
- name: ReplacementKernel
color: 1df4cd
description: Individual replacement kernels
- name: request_for_comments
color: '000000'
description: See https://en.wikipedia.org/wiki/Request_for_Comments
- name: runPerformance
color: d93f0b
description: testing only
- name: Runtime
color: 3167a0
description: C++ host code
- name: sandbox
color: D47D0C
description: ''
- name: SolutionSelection
color: cda8ff
description: Kernel selection logic
- name: solverBuildtime
color: 5319e7
description: Link against rocSOLVER at buildtime
- name: specification
color: '000000'
description: ''
- name: Tensor
color: fcaf0a
description: Tensor contraction related items
- name: testing
color: 3333bb
description: ''
- name: TESTING_CI_PASSED
color: FFff00
description: ''
- name: TESTING_PERFORMANCE_REQUIRED
color: ccEEcc
description: ''
- name: TestLevel1Only
color: B7D6F9
description: Tests only Level 1 functions in this PR
- name: TestLevel2Only
color: '794359'
description: Tests only Level 2 functions in this PR
- name: TestLevel3Only
color: d93f0b
description: Tests only Level 3 functions in this PR
- name: Tests
color: e564ab
description: Improvement/additions to tests
- name: TestTensileOnly
color: c5def5
description: Runs Tensile only test on this PR
- name: triaged
color: F2B54D
description: The issue has been reviewed by a team member and prioritized
- name: TunaNet
color: C2E0C6
description: TunaNet model updated
- name: tuning
color: 0cf436
description: ''
- name: tuning_notes
color: 0f617a
description: Record of events that have taken place during MIOpen tuning
- name: TuningFiles
color: f9f195
description: Tuning run related for evaluations and archival
- name: TuningScripts
color: fc7874
description: Tuning automation & improvements
- name: uai
color: C5DEF5
description: ''
- name: umbrella_ticket
color: '000000'
description: ''
- name: Under Investigation
color: 0052CC
description: ''
- name: under investigation
color: 5319e7
description: ''
- name: urgency_blocker
color: cc2200
description: ''
- name: urgency_high
color: ee5500
description: ''
- name: urgency_low
color: ffffff
description: ''
- name: urgency_medium
color: 4C4F1E
description: ''
- name: urgency_normal
color: ffdd77
description: ''
- name: urgency_unknown
color: '999999'
description: ''
- name: value_high
color: '990099'
description: ''
- name: value_low
color: eebbee
description: ''
- name: value_middle
color: cc88cc
description: ''
- name: value_unknown
color: bbbbbb
description: ''
- name: weekly
color: fbca04
description: run weekly CI job
- name: windows
color: 4B78AD
description: ''
- name: WIP
color: EE8CE7
description: ''
- name: wontfix
color: ffffff
description: null
- name: workaround
color: '777700'
description: ''
- name: XDLOPS
color: bff296
description: Python code generator
+24
Ver Arquivo
@@ -0,0 +1,24 @@
## Motivation
<!-- Explain the purpose of this PR and the goals it aims to achieve. -->
## Technical Details
<!-- Explain the changes along with any relevant GitHub links. -->
## JIRA ID
<!-- If applicable, mention the JIRA ID resolved by this PR (Example: Resolves SWDEV-12345). -->
<!-- Do not post any JIRA links here. -->
## Test Plan
<!-- Explain any relevant testing done to verify this PR. -->
## Test Result
<!-- Briefly summarize test outcomes. -->
## Submission Checklist
- [ ] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
+36
Ver Arquivo
@@ -0,0 +1,36 @@
{
"repositories": [
{
"name": "clr",
"url": "ROCm/clr",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "hip",
"url": "ROCm/hip",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "hipother",
"url": "ROCm/hipother",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "hip-tests",
"url": "ROCm/hip-tests",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
}
]
}
+36
Ver Arquivo
@@ -0,0 +1,36 @@
{
"repositories": [
{
"name": "clr",
"url": "ROCm/clr",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "hip",
"url": "ROCm/hip",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "hipother",
"url": "ROCm/hipother",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "hip-tests",
"url": "ROCm/hip-tests",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
}
]
}
+132
Ver Arquivo
@@ -0,0 +1,132 @@
{
"repositories": [
{
"name": "aqlprofile",
"url": "ROCm/aqlprofile",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": false
},
{
"name": "clr",
"url": "ROCm/clr",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "hip",
"url": "ROCm/hip",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "hipother",
"url": "ROCm/hipother",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "hip-tests",
"url": "ROCm/hip-tests",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "rdc",
"url": "ROCm/rdc",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": false
},
{
"name": "rocm-core",
"url": "ROCm/rocm-core",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": false
},
{
"name": "rocminfo",
"url": "ROCm/rocminfo",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": false
},
{
"name": "rocm-smi-lib",
"url": "ROCm/rocm_smi_lib",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": false
},
{
"name": "rocprofiler",
"url": "ROCm/rocprofiler",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": false
},
{
"name": "rocprofiler-compute",
"url": "ROCm/rocprofiler-compute",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": false
},
{
"name": "rocprofiler-register",
"url": "ROCm/rocprofiler-register",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": false
},
{
"name": "rocprofiler-sdk",
"url": "ROCm/rocprofiler-sdk",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": false
},
{
"name": "rocprofiler-systems",
"url": "ROCm/rocprofiler-systems",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": false
},
{
"name": "rocr-runtime",
"url": "ROCm/ROCR-Runtime",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": false
},
{
"name": "roctracer",
"url": "ROCm/roctracer",
"branch": "release/rocm-rel-7.0",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": false
}
]
}
+184
Ver Arquivo
@@ -0,0 +1,184 @@
{
"repositories": [
{
"name": "amdsmi",
"url": "ROCm/amdsmi",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "aqlprofile",
"url": "ROCm/aqlprofile",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "clr",
"url": "ROCm/clr",
"branch": "develop",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "hip",
"url": "ROCm/hip",
"branch": "develop",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "hipother",
"url": "ROCm/hipother",
"branch": "develop",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "hip-tests",
"url": "ROCm/hip-tests",
"branch": "develop",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rdc",
"url": "ROCm/rdc",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rocm-core",
"url": "ROCm/rocm-core",
"branch": "amd-mainline",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rocminfo",
"url": "ROCm/rocminfo",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rocm-smi-lib",
"url": "ROCm/rocm_smi_lib",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rocprofiler",
"url": "ROCm/rocprofiler",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rocprofiler-compute",
"url": "ROCm/rocprofiler-compute",
"branch": "develop",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rocprofiler-register",
"url": "ROCm/rocprofiler-register",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rocprofiler-sdk",
"url": "ROCm/rocprofiler-sdk",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rocprofiler-systems",
"url": "ROCm/rocprofiler-systems",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rocr-runtime",
"url": "ROCm/ROCR-Runtime",
"branch": "develop",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "roctracer",
"url": "ROCm/roctracer",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rocshmem",
"url": "ROCm/rocshmem",
"branch": "develop",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rccl",
"url": "ROCm/rccl",
"branch": "develop",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
},
{
"name": "rccl-tests",
"url": "ROCm/rccl-tests",
"branch": "develop",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true,
"monorepo_source_of_truth": true
}
]
}
+2
Ver Arquivo
@@ -0,0 +1,2 @@
pydantic
requests
+64
Ver Arquivo
@@ -0,0 +1,64 @@
import os
import sys
import yaml
import requests
def get_existing_labels(repo, token):
headers = {"Authorization": f"token {token}"}
labels = {}
page = 1
while True:
url = f"https://api.github.com/repos/{repo}/labels?page={page}&per_page=100"
resp = requests.get(url, headers=headers)
if resp.status_code != 200:
raise Exception(f"Failed to fetch existing labels: {resp.text}")
data = resp.json()
if not data:
break
for label in data:
labels[label["name"]] = {
"color": label["color"],
"description": label.get("description", "")
}
page += 1
return labels
def create_or_update_label(repo, token, label, existing):
headers = {
"Authorization": f"token {token}",
"Accept": "application/vnd.github+json"
}
if label["name"] not in existing:
# Create label
print(f"Creating label: {label['name']}")
url = f"https://api.github.com/repos/{repo}/labels"
resp = requests.post(url, json=label, headers=headers)
else:
# Update if different
current = existing[label["name"]]
if (label["color"].lower() != current["color"].lower() or
label.get("description", "") != current.get("description", "")):
print(f"Updating label: {label['name']}")
url = f"https://api.github.com/repos/{repo}/labels/{label['name']}"
resp = requests.patch(url, json=label, headers=headers)
else:
print(f"Label '{label['name']}' already up to date. Skipping.")
return
if not resp.ok:
print(f"Failed to apply label {label['name']}: {resp.status_code} {resp.text}")
def main(label_file):
token = os.environ["GH_TOKEN"]
repo = os.environ["GITHUB_REPO"]
existing = get_existing_labels(repo, token)
with open(label_file, "r") as f:
labels = yaml.safe_load(f)
for label in labels:
create_or_update_label(repo, token, label, existing)
if __name__ == "__main__":
main(sys.argv[1])
+110
Ver Arquivo
@@ -0,0 +1,110 @@
#!/usr/bin/env python3
"""
Azure Pipeline Resolver Script
------------------------------
This script determines which Azure pipelines to run based on changed subtrees.
Using a predefined dependency map, the script resolves which projects need to be processed,
skipping those that will be covered by their dependencies.
Steps:
1. Load a list of changed projects from a file.
2. Consult a dependency map to determine transitive and direct dependencies.
3. Identify projects that should be processed, excluding those handled by dependencies.
4. Output the list of projects to be run, along with their Azure pipeline IDs.
Arguments:
--subtree-file : Path to the file containing a newline-separated list of changed subtrees.
Outputs:
Prints a newline-separated list of "project_name=definition_id" for the projects that need
to be processed, where `definition_id` is the Azure pipeline ID associated with the project.
Example Usage:
To determine which pipelines to run given the changed subtrees listed in a file:
python azure_pipeline_resolver.py --subtree-file changed_subtrees.txt
"""
import argparse
from typing import List, Optional
def parse_arguments(argv: Optional[List[str]] = None) -> argparse.Namespace:
"""Parse command-line arguments."""
parser = argparse.ArgumentParser(
description="Given a list of changed subtrees, determine which Azure pipelines to run."
)
parser.add_argument(
"--subtree-file",
required=True,
help="Path to the file containing changed subtrees",
)
return parser.parse_args(argv)
def read_file_into_set(file_path):
"""Reads the project names from the file into a set."""
with open(file_path, "r") as file:
return {line.strip() for line in file}
def resolve_dependencies(projects, dependencies):
"""Resolves projects to be run by checking all levels of dependencies."""
def has_dependency(project, projects_set):
"""Recursively checks if a project has any dependencies in the projects_set."""
if project not in dependencies:
return False
for dependency in dependencies[project]:
if dependency in projects_set or has_dependency(dependency, projects_set):
return True
return False
projects_to_run = set(projects)
for project in projects:
if has_dependency(project, projects_to_run):
projects_to_run.discard(project)
return projects_to_run
def main(argv=None) -> None:
"""Main function to process the projects and output those to be run."""
# Systems build+test dependency tree as defined in Azure CI and TheRock
systems_dependencies = {
"projects/clr": {"projects/hip"},
"projects/hip": {"projects/hipother"},
}
# Azure pipeline IDs for each project, to be populated as projects are enabled
definition_ids = {
"projects/amdsmi": 376,
"projects/aqlprofile": 365,
"projects/clr": 335,
#"projects/hip-tests": 362,
"projects/hip": 335,
"projects/hipother": 335,
"projects/rdc": 360,
"projects/rocm-core": 349,
"projects/rocm-smi-lib": 358,
"projects/rocminfo": 356,
"projects/rocprofiler-compute": 344,
"projects/rocprofiler-register": 327,
"projects/rocprofiler-sdk": 347,
"projects/rocprofiler-systems": 345,
"projects/rocprofiler": 329,
"projects/rocr-runtime": 354,
"projects/roctracer": 331,
}
args = parse_arguments(argv)
projects = read_file_into_set(args.subtree_file)
projects_to_run = resolve_dependencies(projects, systems_dependencies)
for project in projects_to_run:
if project in definition_ids:
print(f"{project}={definition_ids[project]}")
if __name__ == "__main__":
main()
+48
Ver Arquivo
@@ -0,0 +1,48 @@
import json
import os
import sys
import requests
import yaml
def get_labels(repo, token):
headers = {"Authorization": f"token {token}"}
labels = []
page = 1
while True:
url = f"https://api.github.com/repos/{repo}/labels?page={page}&per_page=100"
resp = requests.get(url, headers=headers)
if resp.status_code != 200:
raise Exception(f"Failed to fetch labels from {repo}: {resp.text}")
data = resp.json()
if not data:
break
labels.extend(data)
page += 1
return labels
def main(file_path):
with open(file_path, "r") as f:
repos_data = json.load(f)["repositories"]
token = os.environ["GH_TOKEN"]
all_labels = {}
for repo_entry in repos_data:
repo_url = repo_entry["url"]
print(f"Collecting labels from {repo_url}")
for label in get_labels(repo_url, token):
name = label["name"]
if name not in all_labels:
all_labels[name] = {
"name": name,
"color": label["color"],
"description": label.get("description", "")
}
sorted_labels = sorted(all_labels.values(), key=lambda l: l["name"].lower())
os.makedirs(".github", exist_ok=True) # Ensure the .github directory exists
with open(".github/labels.yml", "w") as out:
yaml.dump(sorted_labels, out, sort_keys=False)
if __name__ == "__main__":
main(sys.argv[1])
+18
Ver Arquivo
@@ -0,0 +1,18 @@
import json
import sys
import logging
from typing import List
from repo_config_model import RepoConfig, RepoEntry
logger = logging.getLogger(__name__)
def load_repo_config(config_path: str) -> List[RepoEntry]:
"""Load and validate repository config from JSON using Pydantic."""
try:
with open(config_path, "r", encoding="utf-8") as f:
data = json.load(f)
config = RepoConfig(**data)
return config.repositories
except Exception as e:
logger.error(f"Failed to load or validate config file '{config_path}': {e}")
sys.exit(1)
+282
Ver Arquivo
@@ -0,0 +1,282 @@
#!/usr/bin/env python3
"""
GitHub Client Utility
---------------------
This utility provides a GitHubClient class that wraps GitHub REST API operations
used across automation scripts, such as retrieving pull request file changes and labels.
When doing manual testing, you can run the same REST API calls through curl in the terminal.
These REST API URLs, without the authentication header, will be output by the debug logging.
This includes:
- Fetching PR details
- Creating PRs
- Closing PRs
Requirements:
- NOTE: GH_TOKEN environment variable hands authentication token to this script in a runner.
- The token is created by the GitHub App and is passed to the script via the environment variable.
Manual curl testing:
To fetch PR details:
curl -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github+json" \
https://api.github.com/repos/OWNER/REPO/pulls/NUMBER
To list PRs by head branch:
curl -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/OWNER/REPO/pulls?head=OWNER:branch-name&state=open"
To fetch changed files in a PR:
curl -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github+json" \
https://api.github.com/repos/OWNER/REPO/pulls/NUMBER/files
To create a PR:
curl -X POST -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github+json" \
https://api.github.com/repos/OWNER/REPO/pulls \
-d '{"title":"Title","body":"Description","head":"branch-name","base":"main"}'
To apply labels:
curl -X POST -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github+json" \
https://api.github.com/repos/OWNER/REPO/issues/NUMBER/labels \
-d '{"labels": ["bug", "needs-review"]}'
"""
import os
import requests
import time
import logging
from typing import List, Optional
logger = logging.getLogger(__name__)
class GitHubCLIClient:
def __init__(self) -> None:
"""Initialize the GitHub API client using GitHub App authentication."""
self.api_url = "https://api.github.com"
self.session = requests.Session()
self.session.headers.update({
"Authorization": f"Bearer {self._get_token()}",
"Accept": "application/vnd.github+json",
})
def _get_token(self) -> str:
"""Helper method to retrieve the GitHub token from environment variable."""
token = os.getenv("GH_TOKEN")
if not token:
raise EnvironmentError("GH_TOKEN environment variable is not set")
return token
def _get_with_retries(self, url: str, error_msg: str, retries: int = 3,
backoff: int = 2, timeout: int = 10) -> Optional[requests.Response]:
"""Internal helper to retry a GET request with exponential backoff."""
# no logging the actual request to avoid leaking sensitive information
for attempt in range(retries):
try:
response = self.session.get(url, timeout=timeout)
if response.status_code == 200:
return response
# for api rate limiting, we check the headers for remaining requests and reset time
elif response.status_code == 403 and response.headers.get("X-RateLimit-Remaining") == "0":
reset_time = int(response.headers.get("X-RateLimit-Reset", 0))
sleep_seconds = max(1, reset_time - int(time.time()) + 1)
logger.warning(f"Rate limited. Sleeping for {sleep_seconds} seconds...")
time.sleep(sleep_seconds)
continue
# other errors will use exponential backoff timeout
elif response.status_code in {403, 429, 500, 502, 503, 504}:
logger.warning(f"Retryable error {response.status_code} on attempt {attempt}.")
else:
response.raise_for_status()
except requests.RequestException as e:
logger.warning(f"Request failed on attempt {attempt}: {e}")
logger.error(f"{error_msg} for {url} (Attempt {attempt + 1}/{retries})")
if attempt < retries - 1:
time.sleep(backoff ** attempt) # Exponential backoff
else:
logger.error(f"Max retries reached for GET at {url}. Giving up.")
return None
def _get_json(self, url: str, error_msg: str) -> dict:
"""Helper method to perform a simple GET request and return a single JSON object."""
response = self._get_with_retries(url, error_msg)
return response.json() if response else {}
def _get_paginated_json(self, url: str, error_msg: str) -> List[dict]:
"""Helper method to perform a sequence of GET requests with pagination."""
results = []
while url:
response = self._get_with_retries(url, error_msg)
if not response:
return results
results.extend(response.json())
url = response.links.get("next", {}).get("url")
return results
def _request_json(self, method: str, url: str, json: Optional[dict] = None,
error_msg: str = "", retries: int = 3, backoff: int = 2) -> dict:
"""Helper method to perform a request with retries and return JSON response."""
# no logging the actual request to avoid leaking sensitive information
for attempt in range(retries):
response = self.session.request(method, url, json=json)
if response.ok:
if response.status_code == 204 or not response.text.strip():
return {} # DELETE requests have no json content
else:
return response.json()
else:
# for api rate limiting, we check the headers for remaining requests and reset time
if response.status_code == 403 and response.headers.get("X-RateLimit-Remaining") == "0":
reset_time = int(response.headers.get("X-RateLimit-Reset", 0))
sleep_seconds = max(1, reset_time - int(time.time()) + 1)
logger.warning(f"Rate limited. Sleeping for {sleep_seconds} seconds...")
time.sleep(sleep_seconds)
# other errors will use exponential backoff timeout
else:
logger.error(f"{error_msg} for method {method} at {url} (Attempt {attempt + 1}/{retries})")
if attempt < retries - 1:
time.sleep(backoff ** attempt) # Exponential backoff
else:
logger.error(f"Max retries reached for method {method} at {url}. Giving up.")
return {}
def get_changed_files(self, repo: str, pr: int) -> List[str]:
"""Fetch the changed files in a pull request using GitHub API."""
url = f"{self.api_url}/repos/{repo}/pulls/{pr}/files?per_page=50"
logger.debug(f"Request URL: {url}")
files_data = self._get_paginated_json(url, f"Failed to fetch files for PR #{pr} in {repo}")
files = [file["filename"] for file in files_data]
logger.debug(f"Changed files in PR #{pr}: {files}")
return files
def get_defined_labels(self, repo: str) -> List[str]:
"""Get all labels defined in the given repository."""
url = f"{self.api_url}/repos/{repo}/labels?per_page=100"
logger.debug(f"Request URL: {url}")
labels_data = self._get_paginated_json(url, f"Failed to fetch labels from {repo}")
labels = [label["name"] for label in labels_data]
logger.debug(f"Defined labels in {repo}: {labels}")
return labels
def get_existing_labels_on_pr(self, repo: str, pr: int) -> List[str]:
"""Fetch current labels on a PR."""
url = f"{self.api_url}/repos/{repo}/issues/{pr}/labels?per_page=100"
logger.debug(f"Request URL: {url}")
labels_data = self._get_paginated_json(url, f"Failed to fetch labels for PR #{pr} in {repo}")
labels = [label["name"] for label in labels_data]
logger.debug(f"Existing labels on PR #{pr}: {labels}")
return labels
def pr_view(self, repo: str, head: str) -> Optional[int]:
"""Check if a PR exists for the given repo and branch."""
# This is similar to get_pr_by_head_branch but returns only the PR number directly
url = f"{self.api_url}/repos/{repo}/pulls?head={repo.split('/')[0]}:{head}&per_page=100"
logger.debug(f"Request URL: {url}")
result = self._get_paginated_json(url, f"Failed to retrieve PR for head branch {head} in repo {repo}")
return result[0]["number"] if result else None
def get_pr_by_head_branch(self, repo: str, head: str) -> Optional[dict]:
"""Fetch the PR object for a given head branch in a repository, if it exists."""
# This is similar to pr_view but returns the full PR object
url = f"{self.api_url}/repos/{repo}/pulls?head={repo.split('/')[0]}:{head}&state=open&per_page=100"
logger.debug(f"Request URL: {url}")
data = self._get_paginated_json(url, f"Failed to get PRs for {repo} with head {head}")
return data[0] if data else None
def get_pr_by_number(self, repo: str, pr_number: int) -> Optional[dict]:
"""Fetch the PR object for a given PR number in a repository."""
url = f"{self.api_url}/repos/{repo}/pulls/{pr_number}"
logger.debug(f"Fetching PR #{pr_number} from {repo}")
response = self._get_json(url, f"Failed to get PR #{pr_number} from {repo}")
return response
def pr_create(self, repo: str, base: str, head: str, title: str, body: str, dry_run: bool = False) -> None:
"""Create a new pull request."""
url = f"{self.api_url}/repos/{repo}/pulls"
payload = {
"title": title,
"body": body,
"head": head,
"base": base
}
logger.debug(f"Request URL: {url}")
logger.debug(f"Request Payload: {payload}")
if dry_run:
logger.info(f"Dry run: The pull request would be created from {head} to {base} in {repo}")
return
self._request_json("POST", url, payload, f"Failed to create PR from {head} to {base} in {repo}")
logger.info(f"Created PR from {head} to {base} in {repo}.")
def close_pr_and_delete_branch(self, repo: str, pr_number: int, dry_run: bool = False) -> None:
"""Close a pull request and delete the associated branch using the GitHub API."""
pr_url = f"{self.api_url}/repos/{repo}/pulls/{pr_number}"
logger.debug(f"Request URL: {pr_url}")
pr_data = self._get_json(pr_url, f"Failed to fetch PR #{pr_number} in {repo}")
head_ref = pr_data.get("head", {}).get("ref")
if not head_ref:
logger.error(f"Could not determine head branch for PR #{pr_number} in {repo}")
return
logger.debug(f"PR #{pr_number} head branch: {head_ref}")
close_payload = {"state": "closed"}
logger.debug(f"Request Payload: {close_payload}")
if dry_run:
logger.info(f"Dry run: The pull request #{pr_number} would be closed and the branch '{head_ref}' would be deleted in repo '{repo}'")
return
self._request_json("PATCH", pr_url, close_payload, f"Failed to close PR #{pr_number} in {repo}")
branch_url = f"{self.api_url}/repos/{repo}/git/refs/heads/{head_ref}"
logger.debug(f"Branch DELETE URL: {branch_url}")
self._request_json("DELETE", branch_url, None, f"Failed to delete branch '{head_ref}' for PR #{pr_number}")
logger.info(f"Closed pull request #{pr_number} and deleted the branch '{head_ref}' in {repo}.")
def sync_labels(self, target_repo: str, pr_number: int, labels: List[str], dry_run: bool = False) -> None:
"""Sync labels from the source repo to the target repo (only apply existing labels)."""
url = f"{self.api_url}/repos/{target_repo}/labels?per_page=100"
logger.debug(f"Request URL: {url}")
target_repo_labels = {label["name"] for label in self._get_paginated_json(url, f"Failed to fetch labels for {target_repo}")}
labels_set = set(labels)
labels_to_apply = labels_set & target_repo_labels
labels_for_logging = ",".join(labels_to_apply)
if labels_to_apply:
# note: using issues endpoint for labels as PRs are a subset of issues
url = f"{self.api_url}/repos/{target_repo}/issues/{pr_number}/labels"
payload = {"labels": list(labels_to_apply)}
logger.debug(f"Request URL: {url}")
logger.debug(f"Request Payload: {payload}")
if not dry_run:
self._request_json("POST", url, payload, f"Failed to apply labels to PR #{pr_number} in {target_repo}")
logger.info(f"Applied labels '{labels_for_logging}' to PR #{pr_number} in {target_repo}.")
else:
logger.info(f"Dry run: Labels '{labels_for_logging}' would be applied to PR #{pr_number} in {target_repo}.")
else:
logger.info(f"No valid labels to apply to PR #{pr_number} in {target_repo}.")
def get_squash_merge_commit(self, repo: str, pr_number: int) -> Optional[str]:
"""Get the squash merge commit SHA of a merged pull request."""
url = f"{self.api_url}/repos/{repo}/pulls/{pr_number}"
logger.debug(f"Request URL: {url}")
data = self._get_json(url, f"Failed to fetch PR #{pr_number} from {repo}")
if not data:
logger.error(f"No data returned for PR #{pr_number}")
return None
if data.get("merged") and data.get("merge_commit_sha"):
logger.debug(f"PR #{pr_number} merged commit: {data['merge_commit_sha']}")
return data["merge_commit_sha"]
logger.warning(f"PR #{pr_number} is not merged or missing merge commit SHA.")
return None
def get_user(self, username: str) -> tuple[str, str]:
"""Fetch the name and email of a GitHub user. Falls back to login and no-reply email."""
url = f"{self.api_url}/users/{username}"
logger.debug(f"Fetching user profile for @{username}")
data = self._get_json(url, f"Failed to fetch user profile for @{username}")
name = data.get("name") or username
email = data.get("email")
if not email:
user_id = data.get("id")
if user_id:
email = f"{user_id}+{username}@users.noreply.github.com"
else:
email = f"{username}@users.noreply.github.com"
return name, email
@@ -0,0 +1,71 @@
import os, re, sys
from typing import List, Optional
def is_checkbox(line: str) -> bool:
return bool(re.match(r"^\s*-\s*\[[ xX]\]\s*.+", line))
def is_checked(line: str) -> bool:
return bool(re.match(r"^\s*-\s*\[\s*[xX]\s*\]\s*.+", line))
def is_comment(line: str) -> bool:
return bool(re.match(r"^\s*<!--.*-->\s*$", line))
def text_clean(lines: List[str]) -> str:
text = [line for line in lines if not is_comment(line)]
return "".join("".join(text).strip().split())
def validate_section(section_name: str, lines: List[str]) -> Optional[str]:
has_checkboxes = any(is_checkbox(line) for line in lines)
if has_checkboxes:
if not any(is_checked(line) for line in lines):
return f"Section {section_name} is a checklist without selections"
return None
if not text_clean(lines):
return f"Section {section_name} is empty text section"
return None
def check_description(description: str) -> List[str]:
sections = []
current_section = None
current_lines = []
errors = []
for line in description.splitlines():
header_match = re.match(r"^\s*##\s*(.+?)\s*$", line)
if header_match:
if current_section:
sections.append((current_section, current_lines))
current_section = header_match.group(1)
current_lines = []
elif current_section:
current_lines.append(line)
if current_section:
sections.append((current_section, current_lines))
if not sections:
return ["No sections available, template is empty"]
for section_name, section_lines in sections:
error = validate_section(section_name, section_lines)
if error:
errors.append(error)
return errors
if __name__ == "__main__":
pr_description = os.getenv("PR_DESCRIPTION", "")
errors = check_description(pr_description)
if not errors:
print("All good")
exit(0)
print("\n".join(errors))
exit(1)
+109
Ver Arquivo
@@ -0,0 +1,109 @@
import os
import sys
import subprocess
from github import Github
from git import Repo
def run(cmd, **kwargs):
print(f">> {cmd}")
subprocess.check_call(cmd, shell=True, **kwargs)
def main():
# 1) Read and validate env vars
token = os.getenv("GITHUB_TOKEN")
repo_full= os.getenv("GITHUB_REPOSITORY")
prefix = os.getenv("SUBPREFIX")
subrepo = os.getenv("SUBREPO")
upstream = os.getenv("UPSTREAM")
target = os.getenv("TARGET", "develop")
pr_list = os.getenv("PR_LIST", "")
if not all([token, repo_full, prefix, subrepo, upstream, pr_list]):
print("ERROR: Missing one or more required environment variables.")
sys.exit(1)
pr_numbers = [p.strip() for p in pr_list.split(",") if p.strip()]
conflicted_prs = [] # 🔹 Track PRs with merge conflicts
# 2) Init local repo and configure Git user
repo = Repo(os.getcwd())
run("git config user.name 'systems-assistant[bot]'")
run("git config user.email 'systems-assistant[bot]@users.noreply.github.com'")
# 3) Init GitHub clients
gh = Github(token)
super_repo = gh.get_repo(repo_full)
sub_repo = gh.get_repo(upstream)
# 4) Ensure target branch is checked out
run(f"git fetch origin {target}")
try:
run(f"git checkout {target}")
except subprocess.CalledProcessError:
run(f"git checkout -b {target} origin/{target}")
# 5) Loop over each PR
for pr_num in pr_numbers:
print(f"\n=== Importing PR #{pr_num} ===")
pr = sub_repo.get_pull(int(pr_num))
title = pr.title
body = pr.body or ""
head_ref = pr.head.ref
head_url = pr.head.repo.clone_url
is_draft = pr.draft
author = pr.user.login
tclean = target.replace("/", "_")
src_clean= subrepo.replace("/", "_")
branch = f"import/{tclean}/{src_clean}/pr-{pr_num}"
try:
run(f"git checkout -b {branch}")
except subprocess.CalledProcessError:
run(f"git branch -D {branch}")
run(f"git checkout -b {branch}")
try:
run(f"git subtree pull --prefix={prefix} {head_url} {head_ref}")
except subprocess.CalledProcessError:
print(f"❌ Merge conflict: subtree pull failed for PR #{pr_num}, skipping.")
conflicted_prs.append(pr_num) # 🔹 Track the failed PR
run(f"git merge --abort || true") # Clean up merge state if needed
run(f"git reset --hard") # Ensure clean state
run(f"git checkout {target}")
continue
run(f"git push origin {branch}")
footer = (
"\n\n---\n"
f"🔁 Imported from [{upstream}#{pr_num}](https://github.com/{upstream}/pull/{pr_num})\n"
f"🧑‍💻 Originally authored by @{author}"
)
full_body = body + footer
new_pr = super_repo.create_pull(
title=title,
body=full_body,
head=branch,
base=target,
draft=is_draft,
)
new_pr.add_to_labels("imported pr")
run(f"git checkout {target}")
# 🔹 Summary of failed PRs due to conflict
if conflicted_prs:
print("\n⚠️ The following PRs failed due to merge conflicts:")
for pr in conflicted_prs:
print(f" - #{pr}")
else:
print("\n✅ All PRs imported successfully without conflicts.")
print("\nAll imports complete.")
if __name__ == "__main__":
main()
+54
Ver Arquivo
@@ -0,0 +1,54 @@
import os
from pathlib import Path
# Determine super-repo root and output CODEOWNERS path
super_repo_root = Path(__file__).resolve().parents[2]
output_path = super_repo_root / ".github" / "CODEOWNERS"
merged_entries = []
# Walk top-level directories (excluding .github/.git/etc.)
for subdir in super_repo_root.iterdir():
if subdir.name.startswith(".") or not subdir.is_dir():
continue
# Look for CODEOWNERS in root or .github directory of the submodule
candidates = [subdir / "CODEOWNERS", subdir / ".github" / "CODEOWNERS"]
for codeowners_file in candidates:
if codeowners_file.is_file():
with codeowners_file.open("r") as f:
for line in f:
stripped = line.strip()
# Skip empty lines or comments
if not stripped or stripped.startswith("#"):
continue
parts = stripped.split()
if not parts:
continue
original_path = parts[0]
owners = " ".join(parts[1:])
# Ensure prefixed path starts with a single slash
prefixed_path = (
f"/{subdir.name.rstrip('/')}{original_path}"
if original_path.startswith("/")
else f"/{subdir.name}/{original_path}"
)
merged_entries.append(f"{prefixed_path} {owners}")
# Sort for consistency
merged_entries.sort()
# Write merged CODEOWNERS file
output_path.parent.mkdir(parents=True, exist_ok=True)
with output_path.open("w") as out:
out.write("# Auto-generated CODEOWNERS file\n\n")
out.write("\n".join(merged_entries))
print(f"✅ Merged CODEOWNERS written to {output_path}")
+36
Ver Arquivo
@@ -0,0 +1,36 @@
import os
import configparser
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parents[2] # Assuming script is in .github/scripts/
OUTPUT_FILE = ROOT_DIR / ".gitmodules"
MODULE_FILES = list(ROOT_DIR.glob("*/.gitmodules")) + list(ROOT_DIR.glob("*/.github/.gitmodules"))
combined = configparser.ConfigParser()
combined.optionxform = str # Preserve case sensitivity
for module_file in MODULE_FILES:
subdir = module_file.parent.name
local_config = configparser.ConfigParser()
local_config.optionxform = str
local_config.read(module_file)
for section in local_config.sections():
if section.startswith("submodule "):
name = section.split('"')[1]
new_name = f"{subdir}/{name}"
new_section = f'submodule "{new_name}"'
combined[new_section] = {}
for key, value in local_config[section].items():
if key == "path":
value = f"{subdir}/{value}"
combined[new_section][key] = value
# Write combined .gitmodules
with OUTPUT_FILE.open("w") as f:
for section in combined.sections():
f.write(f"[{section}]\n")
for key, value in combined[section].items():
f.write(f"\t{key} = {value}\n")
f.write("\n")
+109
Ver Arquivo
@@ -0,0 +1,109 @@
#!/usr/bin/env python3
"""
PR Category Label Script
--------------------
This script analyzes the file paths changed in a pull request and determines which
category labels should be added or removed based on the modified files.
It uses GitHub's cli to fetch the changed files and the existing labels on the pull request.
Then, it computes the desired labels based on file paths, compares them to the existing labels,
and applies the necessary additions and removals unless in dry-run mode.
Arguments:
--repo : Full repository name (e.g., org/repo)
--pr : Pull request number
--dry-run : If set, will only log actions without making changes.
--debug : If set, enables detailed debug logging.
Outputs:
Writes 'add' and 'remove' keys to the GitHub Actions $GITHUB_OUTPUT file, which
the workflow reads to apply label changes using the GitHub CLI.
Example Usage:
To run in debug mode and perform a dry-run (no changes made):
python pr_auto_label.py --repo ROCm/rocm-systems --pr <pr-number> --dry-run --debug
To run in debug mode and apply label changes:
python pr_auto_label.py --repo ROCm/rocm-systems --pr <pr-number> --debug
"""
import argparse
import json
import logging
import os
import sys
from pathlib import Path
from typing import List, Optional
from github_cli_client import GitHubCLIClient
logger = logging.getLogger(__name__)
def parse_arguments(argv: Optional[List[str]] = None) -> argparse.Namespace:
"""Parse command-line arguments."""
parser = argparse.ArgumentParser(description="Apply labels based on PR's changed files.")
parser.add_argument("--repo", required=True, help="Full repository name (e.g., org/repo)")
parser.add_argument("--pr", required=True, type=int, help="Pull request number")
parser.add_argument("--dry-run", action="store_true", help="Print results without writing to GITHUB_OUTPUT.")
parser.add_argument("--debug", action="store_true", help="Enable debug logging")
return parser.parse_args(argv)
def compute_desired_labels(file_paths: list) -> set:
"""Determine the desired labels based on the changed files."""
desired_labels = set()
for path in file_paths:
parts = Path(path).parts
if len(parts) >= 2:
if parts[0] == "projects":
desired_labels.add(f"project: {parts[1]}")
elif parts[0] == "shared":
desired_labels.add(f"shared: {parts[1]}")
logger.debug(f"Desired labels based on changes: {desired_labels}")
return desired_labels
def output_labels(existing_labels: List[str], desired_labels: List[str], dry_run: bool) -> None:
"""Output the labels to add/remove to GITHUB_OUTPUT or log them in dry-run mode."""
to_add = sorted(desired_labels - set(existing_labels))
logger.debug(f"Labels to add: {to_add}")
if dry_run:
logger.info("Dry run enabled. Labels will not be applied.")
else:
output_file = os.environ.get("GITHUB_OUTPUT")
if output_file:
with open(output_file, 'a') as f:
print(f"label_add={','.join(to_add)}", file=f)
logger.info(f"Wrote to GITHUB_OUTPUT: add={','.join(to_add)}")
else:
print("GITHUB_OUTPUT environment variable not set. Outputs cannot be written.")
sys.exit(1)
def main(argv=None) -> None:
"""Main function to execute the PR auto label logic."""
args = parse_arguments(argv)
logging.basicConfig(
level=logging.DEBUG if args.debug else logging.INFO
)
client = GitHubCLIClient()
changed_files = [file for file in client.get_changed_files(args.repo, int(args.pr))]
if not changed_files:
logger.warning("REST API failed or returned no changed files. Falling back to SHA-based Git diff...")
try:
pr_data = os.popen(f"gh api repos/{args.repo}/pulls/{args.pr}").read()
pr = json.loads(pr_data)
base_sha = pr["base"]["sha"]
head_sha = pr["head"]["sha"]
logger.debug(f"Base SHA: {base_sha}, Head SHA: {head_sha}")
os.system(f"git fetch origin {base_sha} {head_sha}")
result = os.popen(f"git diff --name-only {base_sha} {head_sha}").read()
changed_files = result.strip().splitlines()
logger.info(f"Fallback changed files (SHA-based): {changed_files}")
except Exception as e:
logger.error(f"SHA-based Git CLI fallback failed: {e}")
sys.exit(1)
existing_labels = client.get_existing_labels_on_pr(args.repo, int(args.pr))
desired_labels = compute_desired_labels(changed_files)
output_labels(existing_labels, desired_labels, args.dry_run)
if __name__ == "__main__":
main()
+133
Ver Arquivo
@@ -0,0 +1,133 @@
#!/usr/bin/env python3
"""
PR Detect Changed Subtrees Script
---------------------------------
This script analyzes a pull request's changed files and determines which subtrees
(defined in .github/repos-config.json by category/name) were affected.
Steps:
1. Fetch the changed files in the PR using the GitHub API.
2. Load the subtree mapping from repos-config.json.
3. Match changed paths against known category/name prefixes.
4. Emit a new-line separated list of changed subtrees to GITHUB_OUTPUT as 'subtrees'.
Arguments:
--repo : Full repository name (e.g., org/repo)
--pr : Pull request number
--config : OPTIONAL, path to the repos-config.json file.
--require-auto-pull : If set, only include entries with auto_subtree_pull=true.
--require-auto-push : If set, only include entries with auto_subtree_push=true.
--dry-run : If set, will only log actions without making changes.
--debug : If set, enables detailed debug logging.
Outputs:
Writes 'subtrees' key to the GitHub Actions $GITHUB_OUTPUT file, which
the workflow reads to pass paths to the checkout stages.
The output is a new-line separated list of subtrees in `category/name` format.
Example Usage:
To run in auto-push situations in debug mode and perform a dry-run (no changes made):
python pr_detect_changed_subtrees.py --repo ROCm/rocm-systems --pr 123 --require-auto-push --debug --dry-run
"""
import argparse
import json
import logging
import os
import sys
from typing import List, Optional, Set
from github_cli_client import GitHubCLIClient
from repo_config_model import RepoEntry
from config_loader import load_repo_config
logger = logging.getLogger(__name__)
def parse_arguments(argv: Optional[List[str]] = None) -> argparse.Namespace:
"""Parse command-line arguments."""
parser = argparse.ArgumentParser(description="Detect changed subtrees in a PR.")
parser.add_argument("--repo", required=True, help="Full repository name (e.g., org/repo)")
parser.add_argument("--pr", required=True, type=int, help="Pull request number")
parser.add_argument("--config", required=False, default=".github/repos-config.json", help="Path to the repos-config.json file")
parser.add_argument("--require-auto-pull", action="store_true", help="Only include entries with auto_subtree_pull=true")
parser.add_argument("--require-auto-push", action="store_true", help="Only include entries with auto_subtree_push=true")
parser.add_argument("--require-monorepo-source", action="store_true", help="Only include entries with monorepo_source_of_truth=true")
parser.add_argument("--dry-run", action="store_true", help="Print results without writing to GITHUB_OUTPUT.")
parser.add_argument("--debug", action="store_true", help="Enable debug logging")
return parser.parse_args(argv)
def get_valid_prefixes(config: List[RepoEntry], require_auto_pull: bool = False, require_auto_push: bool = False, require_monorepo_source: bool = False) -> Set[str]:
"""Extract valid subtree prefixes from the configuration based on filters."""
valid_prefixes = set()
for entry in config:
if require_auto_pull and not getattr(entry, "auto_subtree_pull", False):
continue
if require_auto_push and not getattr(entry, "auto_subtree_push", False):
continue
if require_monorepo_source and not getattr(entry, "monorepo_source_of_truth", False):
continue
valid_prefixes.add(f"{entry.category}/{entry.name}")
logger.debug("Valid subtrees:\n" + "\n".join(sorted(valid_prefixes)))
return valid_prefixes
def find_matched_subtrees(changed_files: List[str], valid_prefixes: Set[str]) -> List[str]:
"""Find subtrees that match the changed files."""
changed_subtrees = {
"/".join(path.split("/", 2)[:2])
for path in changed_files
if len(path.split("/")) >= 2
}
matched = sorted(changed_subtrees & valid_prefixes)
skipped = sorted(changed_subtrees - valid_prefixes)
if skipped:
logger.debug(f"Skipped subtrees: {skipped}")
logger.debug(f"Matched subtrees: {matched}")
return matched
def output_subtrees(matched_subtrees: List[str], dry_run: bool) -> None:
"""Output the matched subtrees to GITHUB_OUTPUT or log them in dry-run mode."""
newline_separated = "\n".join(matched_subtrees)
if dry_run:
logger.info(f"[Dry-run] Would output:\n{newline_separated}")
else:
output_file = os.environ.get('GITHUB_OUTPUT')
if output_file:
with open(output_file, 'a') as f:
print(f"subtrees<<EOF\n{newline_separated}\nEOF", file=f)
logger.info("Wrote matched subtrees to GITHUB_OUTPUT.")
else:
logger.error("GITHUB_OUTPUT environment variable not set. Outputs cannot be written.")
sys.exit(1)
def main(argv=None) -> None:
"""Main function to determine changed subtrees in PR."""
args = parse_arguments(argv)
logging.basicConfig(
level = logging.DEBUG if args.debug else logging.INFO
)
client = GitHubCLIClient()
config = load_repo_config(args.config)
changed_files = client.get_changed_files(args.repo, int(args.pr))
if not changed_files:
logger.warning("REST API failed or returned no changed files. Falling back to SHA-based Git diff...")
try:
pr_data = os.popen(f"gh api repos/{args.repo}/pulls/{args.pr}").read()
pr = json.loads(pr_data)
base_sha = pr["base"]["sha"]
head_sha = pr["head"]["sha"]
logger.debug(f"Base SHA: {base_sha}, Head SHA: {head_sha}")
os.system(f"git fetch origin {base_sha} {head_sha}")
result = os.popen(f"git diff --name-only {base_sha} {head_sha}").read()
changed_files = result.strip().splitlines()
logger.info(f"Fallback changed files (SHA-based): {changed_files}")
except Exception as e:
logger.error(f"SHA-based Git CLI fallback failed: {e}")
sys.exit(1)
valid_prefixes = get_valid_prefixes(config, args.require_auto_pull, args.require_auto_push, args.require_monorepo_source)
matched_subtrees = find_matched_subtrees(changed_files, valid_prefixes)
output_subtrees(matched_subtrees, args.dry_run)
if __name__ == "__main__":
main()
+222
Ver Arquivo
@@ -0,0 +1,222 @@
#!/usr/bin/env python3
"""
Sync Patches to Subrepositories
-------------------------------
This script is part of the super-repo synchronization system. It runs after a super-repo pull request
is merged and applies relevant changes to the corresponding sub-repositories using Git patches.
- Uses the merge commit of the super-repo PR to extract subtree changes.
- Generates patch files per changed subtree.
- Applies each patch to its respective sub-repository, adjusting for subtree prefix.
- Uses the repos-config.json file to map subtrees to sub-repos.
- Assumes this script is run from the root of the super-repo.
Arguments:
--repo : Full repository name (e.g., org/repo)
--pr : Pull request number
--subtrees : A newline-separated list of subtree paths in category/name format (e.g., projects/rocBLAS)
--config : OPTIONAL, path to the repos-config.json file
--dry-run : If set, will only log actions without making changes.
--debug : If set, enables detailed debug logging.
Example Usage:
python pr_merge_sync_patches.py --repo ROCm/rocm-systems --pr 123 --subtrees "$(printf 'projects/rocprofiler-sdk\nprojects/rocprofiler-register\projects/rocm-smi-lib')" --dry-run --debug
"""
import argparse
import logging
import os
import re
import subprocess
import tempfile
from typing import Optional, List
from pathlib import Path
from github_cli_client import GitHubCLIClient
from config_loader import load_repo_config
from repo_config_model import RepoEntry
logger = logging.getLogger(__name__)
def parse_arguments(argv: Optional[List[str]] = None) -> argparse.Namespace:
"""Parse command-line arguments."""
parser = argparse.ArgumentParser(description="Apply subtree patches to sub-repositories.")
parser.add_argument("--repo", required=True, help="Full repository name (e.g., org/repo)")
parser.add_argument("--pr", required=True, type=int, help="Pull request number")
parser.add_argument("--subtrees", required=True, help="Newline-separated list of changed subtrees (category/name)")
parser.add_argument("--config", required=False, default=".github/repos-config.json", help="Path to the repos-config.json file")
parser.add_argument("--dry-run", action="store_true", help="If set, only logs actions without making changes.")
parser.add_argument("--debug", action="store_true", help="If set, enables detailed debug logging.")
return parser.parse_args(argv)
def get_subtree_info(config: List[RepoEntry], subtrees: List[str]) -> List[RepoEntry]:
"""Return config entries matching the given subtrees in category/name format."""
requested = set(subtrees)
matched = [
entry for entry in config
if f"{entry.category}/{entry.name}" in requested
]
missing = requested - {f"{e.category}/{e.name}" for e in matched}
if missing:
logger.warning(f"Some subtrees not found in config: {', '.join(sorted(missing))}")
return matched
def _run_git(args: List[str], cwd: Optional[Path] = None) -> str:
"""Run a git command and return stdout."""
cmd = ["git"] + args
logger.debug(f"Running git command: {' '.join(cmd)} (cwd={cwd})")
result = subprocess.run(
cmd,
cwd=cwd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)
if result.returncode != 0:
logger.error(f"Git command failed: {' '.join(cmd)}\n{result.stderr}")
raise RuntimeError(f"Git command failed: {' '.join(cmd)}\n{result.stderr}")
return result.stdout.strip()
def _clone_subrepo(repo_url: str, branch: str, destination: Path) -> None:
"""Clone a specific branch from the given GitHub repository into the destination path."""
_run_git([
"clone",
"--branch", branch,
"--single-branch",
f"https://github.com/{repo_url}",
str(destination)
])
logger.debug(f"Cloned {repo_url} into {destination}")
def _configure_git_user(repo_path: Path) -> None:
"""Configure git user.name and user.email for the given repository directory."""
_run_git(["config", "user.name", "systems-assistant[bot]"], cwd=repo_path)
_run_git(["config", "user.email", "systems-assistant[bot]@users.noreply.github.com"], cwd=repo_path)
def _apply_patch(repo_path: Path, patch_path: Path) -> None:
"""Apply a patch file to the working tree."""
_run_git(["apply", str(patch_path)], cwd=repo_path)
logger.info(f"Applied patch to working tree at {repo_path}")
def _stage_changes(repo_path: Path) -> None:
"""Stage all changes in the repository."""
_run_git(["add", "."], cwd=repo_path)
logger.debug(f"Staged all changes in {repo_path}")
def _extract_commit_message_from_patch(patch_path: Path) -> str:
"""Extract and clean the original commit message from the patch file,
removing '[PATCH]' and trailing PR references like (#NN) from the title."""
with open(patch_path, "r", encoding="utf-8") as f:
lines = f.readlines()
commit_msg_lines = []
in_msg = False
for line in lines:
if line.startswith("Subject: "):
subject = line[len("Subject: "):].strip()
# Remove leading "[PATCH]" if present
if subject.startswith("[PATCH]"):
subject = subject[len("[PATCH]"):].strip()
# Remove trailing PR refs like (#NN)
subject = re.sub(r"\s*\(#\d+\)$", "", subject)
commit_msg_lines.append(subject + "\n")
in_msg = True
elif in_msg:
if line.startswith("---"):
break
commit_msg_lines.append(line)
return "".join(commit_msg_lines).strip()
def _format_commit_message(super_repo_url: str, pr_number: int, merge_sha: str, original_msg: str) -> str:
"""Append a sync annotation to the original commit message."""
annotation = f"\n[rocm-systems] {super_repo_url}#{pr_number} (commit {merge_sha[:7]})\n"
return original_msg + annotation
def _commit_changes(repo_path: Path, message: str, author_name: str, author_email: str) -> None:
"""Commit staged changes with the specified author and message."""
_run_git([
"commit",
"--author", f"{author_name} <{author_email}>",
"-m", message
], cwd=repo_path)
logger.debug(f"Committed changes with author {author_name} <{author_email}>")
def _set_authenticated_remote(repo_path: Path, repo_url: str) -> None:
"""Set the push URL to use the GitHub App token from GH_TOKEN env."""
token = os.environ["GH_TOKEN"]
if not token:
raise RuntimeError("GH_TOKEN environment variable is not set")
remote_url = f"https://x-access-token:{token}@github.com/{repo_url}.git"
_run_git(["remote", "set-url", "origin", remote_url], cwd=repo_path)
def _push_changes(repo_path: Path, branch: str) -> None:
"""Push the commit to origin of branch."""
_run_git(["push", "origin", branch], cwd=repo_path)
logger.debug(f"Pushed changes from {repo_path} to origin")
def generate_patch(prefix: str, merge_sha: str, patch_path: Path) -> None:
"""Generate a patch file for a given subtree prefix from a merge commit."""
args = ["format-patch", "-1", merge_sha, f"--relative={prefix}", "--output", str(patch_path)]
_run_git(args)
logger.debug(f"Generated patch for prefix '{prefix}' at {patch_path}")
def resolve_patch_author(client: GitHubCLIClient, repo: str, pr: int) -> tuple[str, str]:
"""Determine the appropriate author for the patch
Returns: (author_name, author_email)"""
pr_data = client.get_pr_by_number(repo, pr)
body = pr_data.get("body", "") or ""
match = re.search(r"Originally authored by @([A-Za-z0-9_-]+)", body)
if match:
username = match.group(1)
logger.debug(f"Found originally authored username in PR body: @{username}")
else:
username = pr_data["user"]["login"]
logger.debug(f"No explicit original author, using PR author: @{username}")
name, email = client.get_user(username)
return name or username, email
def apply_patch_to_subrepo(entry: RepoEntry, super_repo_url: str, super_repo_pr: int,
patch_path: Path, author_name: str, author_email: str,
merge_sha: str, dry_run: bool = False) -> None:
"""Clone the subrepo, apply the patch, and attribute to the original author with commit message annotations."""
with tempfile.TemporaryDirectory() as tmpdir:
subrepo_path = Path(tmpdir) / entry.name
_clone_subrepo(entry.url, entry.branch, subrepo_path)
if dry_run:
logger.info(f"[Dry-run] Would apply patch to {entry.url} as {author_name} <{author_email}>")
return
_configure_git_user(subrepo_path)
_apply_patch(subrepo_path, patch_path)
_stage_changes(subrepo_path)
original_commit_msg = _extract_commit_message_from_patch(patch_path)
commit_msg = _format_commit_message(super_repo_url, super_repo_pr, merge_sha, original_commit_msg)
_commit_changes(subrepo_path, commit_msg, author_name, author_email)
_set_authenticated_remote(subrepo_path, entry.url)
_push_changes(subrepo_path, entry.branch)
logger.info(f"Patch applied, committed, and pushed to {entry.url} as {author_name} <{author_email}>")
def main(argv: Optional[List[str]] = None) -> None:
"""Main function to apply patches to sub-repositories."""
args = parse_arguments(argv)
logging.basicConfig(
level=logging.DEBUG if args.debug else logging.INFO
)
client = GitHubCLIClient()
config = load_repo_config(args.config)
subtrees = [line.strip() for line in args.subtrees.splitlines() if line.strip()]
relevant_subtrees = get_subtree_info(config, subtrees)
merge_sha = client.get_squash_merge_commit(args.repo, args.pr)
logger.debug(f"Merge commit for PR #{args.pr} in {args.repo}: {merge_sha}")
for entry in relevant_subtrees:
prefix = f"{entry.category}/{entry.name}/"
logger.debug(f"Processing subtree {prefix}")
with tempfile.TemporaryDirectory() as tmpdir:
patch_file = Path(tmpdir) / f"{entry.name}.patch"
generate_patch(prefix, merge_sha, patch_file)
author_name, author_email = resolve_patch_author(client, args.repo, args.pr)
apply_patch_to_subrepo(entry, args.repo, args.pr,
patch_file, author_name, author_email,
merge_sha, args.dry_run)
if __name__ == "__main__":
main()
+53
Ver Arquivo
@@ -0,0 +1,53 @@
#!/usr/bin/env python3
"""
Repository Config Model
------------------------
This module defines Pydantic data models for validating and parsing the repos-config.json file.
Structure of the expected JSON:
{
"repositories": [
{
"name": "rocblas",
"url": "ROCm/rocBLAS",
"branch": "develop",
"category": "projects"
},
...
]
}
"""
from typing import List
from pydantic import BaseModel
class RepoEntry(BaseModel):
"""
Represents a single repository entry in the repos-config.json file.
Fields:
name : Name of the project matching packaging file names. Lower-cased and no underscores. (e.g., "rocblas")
url : Individual GitHub org plus repo names in matching case and punctuation. (e.g., "ROCm/rocBLAS")
branch : The base branch of the sub-repo to target (e.g., "develop").
category : Directory category in the super-repo (e.g., "projects" or "shared").
monorepo_source_of_truth : Whether this project has completed migration to monorepo as source of truth.
"""
name: str
url: str
branch: str
category: str
auto_subtree_pull: bool
auto_subtree_push: bool
monorepo_source_of_truth: bool
class RepoConfig(BaseModel):
"""
Represents the full config file structure.
Fields:
repositories : List of RepoEntry items.
"""
repositories: List[RepoEntry]
@@ -0,0 +1,155 @@
from pathlib import Path
import os
import sys
import unittest
from unittest.mock import MagicMock, patch
sys.path.insert(0, os.fspath(Path(__file__).parent.parent))
import therock_configure_ci
class ConfigureCITest(unittest.TestCase):
@patch("subprocess.run")
def test_pull_request(self, mock_run):
args = {
"is_pull_request": True,
"base_ref": "HEAD^"
}
mock_process = MagicMock()
mock_process.stdout = "projects/rocminfo/src/main.cpp"
mock_run.return_value = mock_process
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertGreaterEqual(len(project_to_run), 1)
@patch("subprocess.run")
def test_pull_request_empty(self, mock_run):
args = {
"is_pull_request": True,
"base_ref": "HEAD^"
}
mock_process = MagicMock()
mock_process.stdout = ""
mock_run.return_value = mock_process
project_to_run = therock_configure_ci.retrieve_projects(args)
# Empty modified_paths should return empty list (no changes = no CI)
self.assertEqual(len(project_to_run), 0)
@patch("subprocess.run")
def test_workflow_dispatch(self, mock_run):
args = {
"is_workflow_dispatch": True,
"input_projects": "projects/rocminfo projects/clr",
"base_ref": "HEAD^"
}
mock_process = MagicMock()
mock_process.stdout = "projects/rocminfo/src/main.cpp"
mock_run.return_value = mock_process
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertGreaterEqual(len(project_to_run), 1)
@patch("subprocess.run")
def test_workflow_dispatch_bad_input(self, mock_run):
args = {
"is_workflow_dispatch": True,
"input_projects": "projects/invalid$$projects/fake",
"base_ref": "HEAD^"
}
mock_process = MagicMock()
mock_process.stdout = "projects/rocminfo/src/main.cpp"
mock_run.return_value = mock_process
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertEqual(len(project_to_run), 0)
@patch("subprocess.run")
def test_workflow_dispatch_all(self, mock_run):
args = {
"is_workflow_dispatch": True,
"input_projects": "all",
"base_ref": "HEAD^"
}
mock_process = MagicMock()
mock_process.stdout = "projects/rocminfo/src/main.cpp"
mock_run.return_value = mock_process
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertGreaterEqual(len(project_to_run), 1)
@patch("subprocess.run")
def test_workflow_dispatch_empty(self, mock_run):
args = {
"is_workflow_dispatch": True,
"input_projects": "",
"base_ref": "HEAD^"
}
mock_process = MagicMock()
mock_process.stdout = "projects/rocminfo/src/main.cpp"
mock_run.return_value = mock_process
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertEqual(len(project_to_run), 0)
@patch("subprocess.run")
def test_is_push(self, mock_run):
args = {
"is_push": True,
"base_ref": "HEAD^"
}
mock_process = MagicMock()
mock_process.stdout = "projects/rocminfo/src/main.cpp"
mock_run.return_value = mock_process
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertGreaterEqual(len(project_to_run), 1)
def test_is_path_skippable(self):
# Test skippable patterns
self.assertTrue(therock_configure_ci.is_path_skippable("README.md"))
self.assertTrue(therock_configure_ci.is_path_skippable("docs/guide.rst"))
self.assertTrue(therock_configure_ci.is_path_skippable("projects/rocminfo/README.md"))
self.assertTrue(therock_configure_ci.is_path_skippable("projects/rocminfo/docs/api.rst"))
self.assertTrue(therock_configure_ci.is_path_skippable(".gitignore"))
# Test non-skippable patterns
self.assertFalse(therock_configure_ci.is_path_skippable("projects/rocminfo/src/main.cpp"))
self.assertFalse(therock_configure_ci.is_path_skippable("CMakeLists.txt"))
self.assertFalse(therock_configure_ci.is_path_skippable("projects/rocminfo/test/test.cpp"))
def test_check_for_non_skippable_path(self):
# All skippable paths
skippable_paths = ["README.md", "docs/guide.rst", "projects/rocminfo/docs/api.md"]
self.assertFalse(therock_configure_ci.check_for_non_skippable_path(skippable_paths))
# Mixed paths (has non-skippable)
mixed_paths = ["README.md", "src/main.cpp"]
self.assertTrue(therock_configure_ci.check_for_non_skippable_path(mixed_paths))
# None input
self.assertFalse(therock_configure_ci.check_for_non_skippable_path(None))
@patch("subprocess.run")
def test_docs_only_change_returns_empty_list(self, mock_run):
args = {
"is_pull_request": True,
"base_ref": "HEAD^"
}
# Mock git diff to return only doc files
mock_process = MagicMock()
mock_process.stdout = "README.md\ndocs/guide.rst\nprojects/rocprim/docs/api.md"
mock_run.return_value = mock_process
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertEqual(len(project_to_run), 0)
if __name__ == "__main__":
unittest.main()
+192
Ver Arquivo
@@ -0,0 +1,192 @@
"""
This script determines which build flag and tests to run based on SUBTREES
Required environment variables:
- SUBTREES
"""
import fnmatch
import json
import logging
import subprocess
from therock_matrix import subtree_to_project_map, project_map
import time
from typing import Mapping, Optional, Iterable
import os
logging.basicConfig(level=logging.INFO)
def set_github_output(d: Mapping[str, str]):
"""Sets GITHUB_OUTPUT values.
See https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/passing-information-between-jobs
"""
logging.info(f"Setting github output:\n{d}")
step_output_file = os.environ.get("GITHUB_OUTPUT", "")
if not step_output_file:
logging.warning(
"Warning: GITHUB_OUTPUT env var not set, can't set github outputs"
)
return
with open(step_output_file, "a") as f:
f.writelines(f"{k}={v}" + "\n" for k, v in d.items())
def retry(max_attempts, delay_seconds, exceptions):
def decorator(func):
def newfn(*args, **kwargs):
attempt = 0
while attempt < max_attempts:
try:
return func(*args, **kwargs)
except exceptions as e:
print(f'Exception {str(e)} thrown when attempting to run , attempt {attempt} of {max_attempts}')
attempt += 1
if attempt < max_attempts:
backoff = delay_seconds * (2 ** (attempt - 1))
time.sleep(backoff)
return func(*args, **kwargs)
return newfn
return decorator
@retry(max_attempts=3, delay_seconds=2, exceptions=(TimeoutError))
def get_modified_paths(base_ref: str) -> Optional[Iterable[str]]:
"""Returns the paths of modified files relative to the base reference."""
return subprocess.run(
["git", "diff", "--name-only", base_ref],
stdout=subprocess.PIPE,
check=True,
text=True,
timeout=60,
).stdout.splitlines()
GITHUB_WORKFLOWS_CI_PATTERNS = [
"therock*",
]
def is_path_workflow_file_related_to_ci(path: str) -> bool:
return any(
fnmatch.fnmatch(path, ".github/workflows/" + pattern)
for pattern in GITHUB_WORKFLOWS_CI_PATTERNS
) or any(
fnmatch.fnmatch(path, ".github/scripts/" + pattern)
for pattern in GITHUB_WORKFLOWS_CI_PATTERNS
)
def check_for_workflow_file_related_to_ci(paths: Optional[Iterable[str]]) -> bool:
if paths is None:
return False
return any(is_path_workflow_file_related_to_ci(p) for p in paths)
# Paths matching any of these patterns are considered to have no influence over
# build or test workflows so any related jobs can be skipped if all paths
# modified by a commit/PR match a pattern in this list.
SKIPPABLE_PATH_PATTERNS = [
"docs/*",
".gitignore",
"*.md",
"*.rtf",
"*.rst",
"*/.markdownlint-ci2.yaml",
"*/.readthedocs.yaml",
"*/.spellcheck.local.yaml",
"*/.wordlist.txt",
"projects/*/docs/*",
"projects/*/.gitignore",
"shared/*/docs/*",
"shared/*/.gitignore",
]
def is_path_skippable(path: str) -> bool:
"""Determines if a given relative path to a file matches any skippable patterns."""
return any(fnmatch.fnmatch(path, pattern) for pattern in SKIPPABLE_PATH_PATTERNS)
def check_for_non_skippable_path(paths: Optional[Iterable[str]]) -> bool:
"""Returns true if at least one path is not in the skippable set."""
if paths is None:
return False
return any(not is_path_skippable(p) for p in paths)
def retrieve_projects(args):
# Check if CI should be skipped based on modified paths
# (only for push and pull_request events, not workflow_dispatch or nightly)
if args.get("is_push") or args.get("is_pull_request"):
base_ref = args.get("base_ref")
modified_paths = get_modified_paths(base_ref)
paths_set = set(modified_paths)
contains_non_skippable_files = check_for_non_skippable_path(paths_set)
# If only skippable paths were modified, skip CI
if not contains_non_skippable_files:
logging.info("Only skippable paths were modified, skipping CI")
return []
if args.get("is_pull_request"):
subtrees = list(subtree_to_project_map.keys())
if args.get("is_workflow_dispatch"):
if args.get("input_projects") == "all":
subtrees = list(subtree_to_project_map.keys())
else:
subtrees = args.get("input_projects").split()
# If a push event to develop happens, we run tests on all subtrees
if args.get("is_push"):
subtrees = list(subtree_to_project_map.keys())
# If .github/*/therock* were changed, run all subtrees
base_ref = args.get("base_ref")
modified_paths = get_modified_paths(base_ref)
print("modified_paths (max 200):", modified_paths[:200])
related_to_therock_ci = check_for_workflow_file_related_to_ci(modified_paths)
if related_to_therock_ci:
subtrees = list(subtree_to_project_map.keys())
projects = set()
# collect the associated subtree to project
for subtree in subtrees:
if subtree in subtree_to_project_map:
projects.add(subtree_to_project_map.get(subtree))
# retrieve the subtrees to checkout, cmake options to build, and projects to test
project_to_run = []
# Currently as we have no tests, we just build all packages available if an applicable change is made.
# As we start to get an idea of test times, we can divide test jobs.
if projects:
for project in ["all"]:
if project in project_map:
project_to_run.append(project_map.get(project))
return project_to_run
def run(args):
project_to_run = retrieve_projects(args)
set_github_output({"projects": json.dumps(project_to_run)})
if __name__ == "__main__":
args = {}
github_event_name = os.getenv("GITHUB_EVENT_NAME")
args["is_pull_request"] = github_event_name == "pull_request"
args["is_push"] = github_event_name == "push"
args["is_workflow_dispatch"] = github_event_name == "workflow_dispatch"
input_subtrees = os.getenv("SUBTREES", "")
args["input_subtrees"] = input_subtrees
input_projects = os.getenv("PROJECTS", "")
args["input_projects"] = input_projects
args["base_ref"] = os.environ.get("BASE_REF", "HEAD^")
logging.info(f"Retrieved arguments {args}")
run(args)
+36
Ver Arquivo
@@ -0,0 +1,36 @@
"""
This dictionary is used to map specific file directory changes to the corresponding build flag and tests
"""
subtree_to_project_map = {
'projects/aqlprofile': 'profiler',
'projects/clr': 'core',
'projects/hip': 'core',
'projects/hip-tests': 'core',
'projects/hipother': 'core',
'projects/rdc': 'rdc',
'projects/rocm-core': 'core',
'projects/rocm-smi-lib': 'core',
'projects/rocminfo': 'core',
'projects/rocprofiler-compute': 'profiler',
'projects/rocprofiler-register': 'profiler',
'projects/rocprofiler-sdk': 'profiler',
'projects/rocprofiler-systems': 'profiler',
'projects/rocprofiler': 'profiler',
'projects/rocr-runtime': 'core',
'projects/roctracer': 'profiler'
}
project_map = {
"core": {
"cmake_options": "-DTHEROCK_ENABLE_CORE=ON -DTHEROCK_ENABLE_HIP_RUNTIME=ON -DTHEROCK_ENABLE_ALL=OFF",
"project_to_test": "hip-tests",
},
"profiler": {
"cmake_options": "-DTHEROCK_ENABLE_PROFILER=ON -DTHEROCK_ENABLE_ALL=OFF",
"project_to_test": "rocprofiler-tests",
},
"all": {
"cmake_options": "-DTHEROCK_ENABLE_CORE=ON -DTHEROCK_ENABLE_PROFILER=ON -DTHEROCK_ENABLE_ALL=OFF",
"project_to_test": "hip-tests, rocprofiler-tests",
}
}
+921
Ver Arquivo
@@ -0,0 +1,921 @@
name: AMDSMI CI
on:
pull_request:
branches: [develop]
paths:
- 'projects/amdsmi/**'
- '.github/workflows/amdsmi-build.yml'
push:
branches: [develop]
paths:
- 'projects/amdsmi/**'
- '.github/workflows/amdsmi-build.yml'
workflow_dispatch:
permissions:
contents: read
env:
DEBIAN_FRONTEND: noninteractive
DEBCONF_NONINTERACTIVE_SEEN: true
BUILD_TYPE: Release
ROCM_DIR: /opt/rocm
jobs:
debian-buildinstall:
name: Build
runs-on:
- self-hosted
- ${{ vars.RUNNER_TYPE }}
continue-on-error: true
strategy:
max-parallel: 10
matrix:
os: [Ubuntu20, Ubuntu22, Debian10]
container:
image: ${{ vars[format('{0}_DOCKER_IMAGE', matrix.os)] }}
options: --rm --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --shm-size=64G --cap-add=SYS_MODULE -v /lib/modules:/lib/modules -u root
steps:
- uses: actions/checkout@v4
- name: Set Artifact Metadata
if: github.event_name == 'pull_request'
run: |
# Set PR number and date for artifact naming
echo "PR_NUMBER=PR${{ github.event.pull_request.number }}" >> $GITHUB_ENV
# Set date in MMDDYY-HHMM format (UTC time)
echo "BUILD_DATE=$(date -u +%m%d%y-%H%M)" >> $GITHUB_ENV
- name: Set Project Directory
run: |
# Find the directory containing the main CMakeLists.txt for AMDSMI
TARGET_DIR=$(find $GITHUB_WORKSPACE -path "*/projects/amdsmi/CMakeLists.txt" -exec dirname {} \;)
if [ -z "$TARGET_DIR" ]; then
echo "Could not find CMakeLists.txt in projects/amdsmi. Searching root..."
TARGET_DIR=$(find $GITHUB_WORKSPACE -maxdepth 2 -name "CMakeLists.txt" -exec dirname {} \; | head -n 1)
fi
echo "PROJECT_DIR=$TARGET_DIR" >> $GITHUB_ENV
- name: Update repositories for Debian10
if: matrix.os == 'Debian10'
run: |
set -e
echo 'Updating repositories for Debian10 (archived)'
cat > /etc/apt/sources.list << EOF
deb http://archive.debian.org/debian buster main
deb http://archive.debian.org/debian-security buster/updates main
EOF
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99-disable-check-valid-until
apt update
- name: Build AMDSMI
run: |
set -e
echo 'Building on ${{ matrix.os }}'
BUILD_FOLDER=${{ env.PROJECT_DIR }}/build
RETRIES=3
for i in $(seq 1 $RETRIES); do
echo "Build attempt $i for ${{ matrix.os }}..."
rm -rf $BUILD_FOLDER
mkdir -p $BUILD_FOLDER
cd $BUILD_FOLDER
# Configure, build, and package
if cmake ${{ env.PROJECT_DIR }} -DBUILD_TESTS=ON -DENABLE_ESMI_LIB=ON 2>&1 | tee cmake.log && \
make -j $(nproc) 2>&1 | tee make.log && \
make package 2>&1 | tee package.log; then
# Parse and report warnings as GitHub annotations
echo "::group::Build Warnings"
grep -i "warning" cmake.log make.log package.log | while read -r line; do
echo "::warning::$line"
done
echo "::endgroup::"
echo "Build successful on attempt $i"
break
else
echo "Build failed on attempt $i"
if [ $i -eq $RETRIES ]; then
echo "All $RETRIES build attempts failed. Exiting."
exit 1
fi
sleep $((2 * i))
fi
done
echo "Build completed on ${{ matrix.os }}"
- name: Upload Debian Package Artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: amd-smi-lib-deb-${{ matrix.os }}-${{ env.PR_NUMBER }}-${{ env.BUILD_DATE }}
path: ${{ env.PROJECT_DIR }}/build/amd-smi-lib*99999-local_amd64.deb
if-no-files-found: warn
retention-days: 7
- name: Install AMDSMI
run: |
cd ${{ env.PROJECT_DIR }}/build
if [ "${{ matrix.os }}" != "Debian10" ]; then
apt update
fi
RETRIES=3
for i in $(seq 1 $RETRIES); do
echo "Installation attempt $i for ${{ matrix.os }}..."
if apt install -y ./amd-smi-lib*99999-local_amd64.deb; then
echo "Installation successful on attempt $i"
ln -s /opt/rocm/bin/amd-smi /usr/local/bin
# Verify Installation
echo 'Verifying installation:'
amd-smi version
python3 -m pip list | grep amd
python3 -m pip list | grep pip
python3 -m pip list | grep setuptools
echo 'Completed installation on ${{ matrix.os }}'
break
else
echo "Installation failed on attempt $i"
if [ $i -eq $RETRIES ]; then
echo "All $RETRIES installation attempts failed. Exiting."
exit 1
fi
sleep $((2 * i))
fi
done
echo "Build completed on ${{ matrix.os }}"
- name: Uninstall
if: always()
run: |
set -e
echo 'Uninstalling on ${{ matrix.os }}'
apt remove -y amd-smi-lib || true
rm -f /usr/local/bin/amd-smi
if [ -d /opt/rocm/share/amd_smi ]; then
echo '/opt/rocm/share/amd_smi exists. Removing.'
rm -rf /opt/rocm/share/amd_smi
fi
echo 'Uninstall done on ${{ matrix.os }}'
debian-test:
name: Tests
needs: debian-buildinstall
runs-on:
- self-hosted
- ${{ vars.RUNNER_TYPE }}
continue-on-error: true
strategy:
max-parallel: 10
matrix:
os: [Ubuntu20, Ubuntu22, Debian10]
container:
image: ${{ vars[format('{0}_DOCKER_IMAGE', matrix.os)] }}
options: --rm --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --shm-size=64G --cap-add=SYS_MODULE -v /lib/modules:/lib/modules -u root
steps:
- uses: actions/checkout@v4
- name: Set Project Directory
run: |
TARGET_DIR=$(find $GITHUB_WORKSPACE -path "*/projects/amdsmi/CMakeLists.txt" -exec dirname {} \;)
if [ -z "$TARGET_DIR" ]; then
TARGET_DIR=$(find $GITHUB_WORKSPACE -maxdepth 2 -name "CMakeLists.txt" -exec dirname {} \; | head -n 1)
fi
echo "PROJECT_DIR=$TARGET_DIR" >> $GITHUB_ENV
- name: Update repositories for Debian10
if: matrix.os == 'Debian10'
run: |
set -e
echo 'Updating repositories for Debian10 (archived)'
cat > /etc/apt/sources.list << EOF
deb http://archive.debian.org/debian buster main
deb http://archive.debian.org/debian-security buster/updates main
EOF
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99-disable-check-valid-until
apt update
- name: Build and Install for Test
run: |
set -e
echo 'Building for test on ${{ matrix.os }}'
BUILD_FOLDER=${{ env.PROJECT_DIR }}/build
RETRIES=3
for i in $(seq 1 $RETRIES); do
echo "Build attempt $i for ${{ matrix.os }} test..."
rm -rf $BUILD_FOLDER
mkdir -p $BUILD_FOLDER
cd $BUILD_FOLDER
if cmake ${{ env.PROJECT_DIR }} -DBUILD_TESTS=ON -DENABLE_ESMI_LIB=ON && \
make -j $(nproc) && \
make package; then
echo "Build successful on attempt $i"
break
else
echo "Build failed on attempt $i"
if [ $i -eq $RETRIES ]; then
echo "All $RETRIES build attempts failed. Exiting."
exit 1
fi
sleep $((2 * i))
fi
done
echo 'Installing for test on ${{ matrix.os }}'
for i in $(seq 1 $RETRIES); do
echo "Installation attempt $i for test on ${{ matrix.os }}..."
if apt install -y $BUILD_FOLDER/amd-smi-lib*99999-local_amd64.deb; then
echo "Installation successful on attempt $i"
ln -s /opt/rocm/bin/amd-smi /usr/local/bin
echo 'Install done for test on ${{ matrix.os }}'
break
else
echo "Installation failed on attempt $i"
if [ $i -eq $RETRIES ]; then
echo "All $RETRIES installation attempts failed. Exiting."
exit 1
fi
sleep $((2 * i))
fi
done
- name: AMDSMI Command Tests
shell: bash
run: |
set -e
echo "Running AMDSMI commands on ${{ matrix.os }}"
mkdir -p /tmp/test-results-${{ matrix.os }}
commands=(
"amd-smi version"
"amd-smi list"
"amd-smi static"
"amd-smi firmware"
"amd-smi ucode"
"amd-smi bad-pages"
"amd-smi metric"
"amd-smi process"
"amd-smi topology"
"amd-smi monitor"
"amd-smi dmon"
"amd-smi xgmi"
"amd-smi partition"
)
for cmd in "${commands[@]}"; do
debug_cmd="$cmd --loglevel debug"
echo "Running: $debug_cmd"
if ! eval "$debug_cmd" > /tmp/test-results-${{ matrix.os }}/$(echo $cmd | tr ' ' '_').log 2>&1; then
echo "Command '$debug_cmd' failed."
cat /tmp/test-results-${{ matrix.os }}/$(echo $cmd | tr ' ' '_').log
exit 1
else
echo "$debug_cmd passed."
fi
done
echo "AMDSMI commands done on ${{ matrix.os }}"
- name: Upload AMDSMI Command Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: amdsmi-command-tests-${{ matrix.os }}
path: /tmp/test-results-${{ matrix.os }}
- name: Run AMDSMI, Python, and Example Tests
shell: bash
run: |
set -e
echo 'Running other tests on ${{ matrix.os }}'
# AMDSMI Tests
echo 'Running AMDSMI tests'
cd /opt/rocm/share/amd_smi/tests
source amdsmitst.exclude
AMDSMI_RETRIES=3
for attempt in $(seq 1 $AMDSMI_RETRIES); do
echo "AMDSMI test attempt $attempt for ${{ matrix.os }}..."
if ./amdsmitst --gtest_filter="-$(echo ${BLACKLIST_ALL_ASICS})" > /tmp/test-results-${{ matrix.os }}/amdsmi_tests.log 2>&1; then
echo "AMDSMI tests passed on attempt $attempt"
echo "=============== TEST OUTPUT ==============="
cat /tmp/test-results-${{ matrix.os }}/amdsmi_tests.log | grep -E "\[==========\]|\[ PASSED \]|\[ SKIPPED \]|\[ FAILED \]"
echo "=============================================="
echo "AMDSMI tests done"
break
else
TEST_EXIT_CODE=$?
echo "AMDSMI tests failed on attempt $attempt with exit code $TEST_EXIT_CODE"
if [ $attempt -eq $AMDSMI_RETRIES ]; then
echo "All $AMDSMI_RETRIES AMDSMI test attempts failed. Final failure."
echo "=============== TEST OUTPUT ==============="
cat /tmp/test-results-${{ matrix.os }}/amdsmi_tests.log | grep -E "\[==========\]|\[ PASSED \]|\[ SKIPPED \]|\[ FAILED \]"
echo "=============================================="
echo "AMDSMI tests failed"
exit $TEST_EXIT_CODE
else
echo "Retrying AMDSMI tests in $((2 * attempt)) seconds..."
sleep $((2 * attempt))
fi
fi
done
# Python Tests
echo 'Running Python tests'
cd /opt/rocm/share/amd_smi/tests/python_unittest
echo "Running integration tests..."
if ! ./integration_test.py -v > /tmp/test-results-${{ matrix.os }}/integration_test_output.txt 2>&1; then
echo "Integration tests failed!"
echo "=============== INTEGRATION TEST OUTPUT ==============="
tail -100 /tmp/test-results-${{ matrix.os }}/integration_test_output.txt
echo "======================================================="
exit 1
else
echo "Integration tests passed"
fi
echo "Running unit tests..."
if ! ./unit_tests.py -v > /tmp/test-results-${{ matrix.os }}/unit_test_output.txt 2>&1; then
echo "Unit tests failed!"
echo "=============== UNIT TEST OUTPUT ==============="
tail -100 /tmp/test-results-${{ matrix.os }}/unit_test_output.txt
echo "================================================"
exit 1
else
echo "Unit tests passed"
fi
echo "Python tests done"
# Example Tests
echo 'Running Example tests'
cd ${{ env.PROJECT_DIR }}/example
rm -rf build
cmake -B build -DENABLE_ESMI_LIB=OFF
make -C build -j $(nproc)
cd build
./amd_smi_drm_ex > /tmp/test-results-${{ matrix.os }}/amd_smi_drm_ex.log 2>&1 || echo 'amd_smi_drm_ex failed'
./amd_smi_nodrm_ex > /tmp/test-results-${{ matrix.os }}/amd_smi_nodrm_ex.log 2>&1 || echo 'amd_smi_nodrm_ex failed'
echo "Example tests done"
- name: AMDSMI Test Results
if: always()
run: |
echo "Displaying AMDSMI test results for ${{ matrix.os }}"
cat /tmp/test-results-${{ matrix.os }}/amdsmi_tests.log || echo "No AMDSMI test results found for ${{ matrix.os }}"
- name: Integration Test Results
if: always()
run: |
echo "Displaying Integration test results for ${{ matrix.os }}"
cat /tmp/test-results-${{ matrix.os }}/integration_test_output.txt || echo "No integration test results found for ${{ matrix.os }}"
- name: Unit Test Results
if: always()
run: |
echo "Displaying Unit Test Results for ${{ matrix.os }}"
cat /tmp/test-results-${{ matrix.os }}/unit_test_output.txt || echo "No unit test results found for ${{ matrix.os }}"
- name: Example DRM Test Results
if: always()
run: |
echo "Displaying Example DRM test results for ${{ matrix.os }}"
cat /tmp/test-results-${{ matrix.os }}/amd_smi_drm_ex.log || echo "No DRM example test results found for ${{ matrix.os }}"
- name: Example NoDRM Test Results
if: always()
run: |
echo "Displaying Example NoDRM test results for ${{ matrix.os }}"
cat /tmp/test-results-${{ matrix.os }}/amd_smi_nodrm_ex.log || echo "No NoDRM example test results found for ${{ matrix.os }}"
rpm-buildinstall:
name: Build
runs-on:
- self-hosted
- ${{ vars.RUNNER_TYPE }}
continue-on-error: true
strategy:
max-parallel: 10
matrix:
os:
- SLES
- RHEL8
- RHEL9
- RHEL10
- AzureLinux3
- AlmaLinux8
container:
image: ${{ vars[format('{0}_DOCKER_IMAGE', matrix.os)] }}
options: --rm --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --shm-size=64G --cap-add=SYS_MODULE -v /lib/modules:/lib/modules -u root
steps:
- uses: actions/checkout@v4
- name: Set Artifact Metadata
if: github.event_name == 'pull_request'
run: |
# Set PR number and date for artifact naming
echo "PR_NUMBER=PR${{ github.event.pull_request.number }}" >> $GITHUB_ENV
# Set date in MMDDYY-HHMM format (UTC time)
echo "BUILD_DATE=$(date -u +%m%d%y-%H%M)" >> $GITHUB_ENV
- name: Set Project Directory
run: |
TARGET_DIR=$(find $GITHUB_WORKSPACE -path "*/projects/amdsmi/CMakeLists.txt" -exec dirname {} \;)
if [ -z "$TARGET_DIR" ]; then
TARGET_DIR=$(find $GITHUB_WORKSPACE -maxdepth 2 -name "CMakeLists.txt" -exec dirname {} \; | head -n 1)
fi
echo "PROJECT_DIR=$TARGET_DIR" >> $GITHUB_ENV
- name: Set PkgMgr
run: |
set -e
case "${{ matrix.os }}" in
SLES)
echo "PACKAGE_MANAGER=zypper" >> $GITHUB_ENV
;;
RHEL8|RHEL9|RHEL10|AlmaLinux8|AzureLinux3)
echo "PACKAGE_MANAGER=dnf" >> $GITHUB_ENV
;;
esac
- name: Add more_itertools
if: matrix.os == 'AzureLinux3'
run: |
set -e
echo 'Installing more_itertools on ${{ matrix.os }}'
python3 -m pip install more_itertools
- name: Build AMDSMI(RHEL10 & AlmaLinux8)
if: matrix.os == 'RHEL10' || matrix.os == 'AlmaLinux8'
run: |
set -e
echo 'Building on ${{ matrix.os }} with retries and QA_RPATHS'
BUILD_FOLDER=${{ env.PROJECT_DIR }}/build
RETRIES=5
# Set QA_RPATHS to ignore empty (0x0010) and invalid (0x0002) RPATHs
export QA_RPATHS=$((0x0010 | 0x0002))
for i in $(seq 1 $RETRIES); do
echo "Build attempt $i for ${{ matrix.os }} ..."
rm -rf $BUILD_FOLDER
mkdir -p $BUILD_FOLDER
cd $BUILD_FOLDER
if cmake ${{ env.PROJECT_DIR }} -DBUILD_TESTS=ON -DENABLE_ESMI_LIB=ON && \
make -j $(nproc) && \
make package; then
echo "Build successful on attempt $i"
break
else
echo "Build failed on attempt $i"
if [ $i -eq $RETRIES ]; then
echo "All $RETRIES build attempts failed. Exiting."
exit 1
fi
sleep $((2 * i))
fi
done
echo "Build completed on ${{ matrix.os }}"
- name: Upload RPM Package Artifacts (RHEL10 & AlmaLinux8)
if: github.event_name == 'pull_request' && (matrix.os == 'RHEL10' || matrix.os == 'AlmaLinux8')
uses: actions/upload-artifact@v4
with:
name: amd-smi-lib-rpm-${{ matrix.os }}-${{ env.PR_NUMBER }}-${{ env.BUILD_DATE }}
path: ${{ env.PROJECT_DIR }}/build/amd-smi-lib-*99999-local*.rpm
if-no-files-found: warn
retention-days: 7
- name: Build AMDSMI
if: matrix.os != 'RHEL10' && matrix.os != 'AlmaLinux8'
run: |
set -e
echo 'Building on ${{ matrix.os }}'
BUILD_FOLDER=${{ env.PROJECT_DIR }}/build
RETRIES=3
for i in $(seq 1 $RETRIES); do
echo "Build attempt $i for ${{ matrix.os }}..."
rm -rf $BUILD_FOLDER
mkdir -p $BUILD_FOLDER
cd $BUILD_FOLDER
# Capture build output to parse warnings
if cmake ${{ env.PROJECT_DIR }} -DBUILD_TESTS=ON -DENABLE_ESMI_LIB=ON 2>&1 | tee cmake.log && \
make -j $(nproc) 2>&1 | tee make.log && \
make package 2>&1 | tee package.log; then
# Parse and report warnings as GitHub annotations
echo "::group::Build Warnings"
grep -i "warning" cmake.log make.log package.log | while read -r line; do
echo "::warning::$line"
done
echo "::endgroup::"
echo "Build successful on attempt $i"
break
else
echo "Build failed on attempt $i"
if [ $i -eq $RETRIES ]; then
echo "All $RETRIES build attempts failed. Exiting."
exit 1
fi
sleep $((2 * i))
fi
done
echo "Build completed on ${{ matrix.os }}"
- name: Upload RPM Package Artifacts
if: github.event_name == 'pull_request' && matrix.os != 'RHEL10' && matrix.os != 'AlmaLinux8'
uses: actions/upload-artifact@v4
with:
name: amd-smi-lib-rpm-${{ matrix.os }}-${{ env.PR_NUMBER }}-${{ env.BUILD_DATE }}
path: ${{ env.PROJECT_DIR }}/build/amd-smi-lib-*99999-local*.rpm
if-no-files-found: warn
retention-days: 7
- name: Install AMDSMI(RHEL10 & AlmaLinux8)
if: matrix.os == 'RHEL10' || matrix.os == 'AlmaLinux8'
run: |
cd ${{ env.PROJECT_DIR }}/build
dnf install python3-setuptools python3-wheel -y
RETRIES=3
for i in $(seq 1 $RETRIES); do
echo "RHEL10: Installation attempt $i..."
if timeout 10m dnf install -y --skip-broken --disablerepo=* ./amd-smi-lib-*99999-local*.rpm; then
echo "Installation successful on attempt $i"
ln -s /opt/rocm/bin/amd-smi /usr/local/bin
echo 'Verifying installation:'
amd-smi version
python3 -m pip list | grep amd
python3 -m pip list | grep pip
python3 -m pip list | grep setuptools
echo 'Completed installation on RHEL10'
break
else
echo "Installation failed on attempt $i"
if [ $i -eq $RETRIES ]; then
echo "All $RETRIES installation attempts failed. Exiting."
exit 1
fi
sleep $((2 * i))
fi
done
- name: Install AMDSMI
if: matrix.os != 'RHEL10' && matrix.os != 'AlmaLinux8'
run: |
cd ${{ env.PROJECT_DIR }}/build
case ${{ env.PACKAGE_MANAGER }} in
zypper)
timeout 10m zypper --no-refresh --no-gpg-checks install -y ./amd-smi-lib-*99999-local*.rpm
;;
dnf)
dnf install python3-setuptools python3-wheel -y
RETRIES=3
for i in $(seq 1 $RETRIES); do
echo "Attempt $i: Installing AMDSMI package..."
if timeout 10m dnf install -y --skip-broken --disablerepo=* ./amd-smi-lib-*99999-local*.rpm; then
echo "AMDSMI package installed successfully."
break
else
echo "Installation failed on attempt $i. Retrying..."
if [ $i -eq $RETRIES ]; then
echo "All $RETRIES attempts failed. Exiting."
exit 1
fi
sleep 10
fi
done
;;
esac
ln -s /opt/rocm/bin/amd-smi /usr/local/bin
# Verify Installation
echo 'Verifying installation:'
amd-smi version
python3 -m pip list | grep amd
python3 -m pip list | grep pip
python3 -m pip list | grep setuptools
echo 'Completed installation on ${{ matrix.os }}'
- name: Uninstall
if: always()
run: |
set -e
echo 'Uninstalling on ${{ matrix.os }}'
case ${{ matrix.os }} in
SLES)
zypper remove -y amd-smi-lib || true
;;
RHEL8|RHEL9|RHEL10|AlmaLinux8|AzureLinux3)
dnf remove -y amd-smi-lib || true
;;
esac
rm -f /usr/local/bin/amd-smi
if [ -d /opt/rocm/share/amd_smi ]; then
echo '/opt/rocm/share/amd_smi exists. Removing.'
rm -rf /opt/rocm/share/amd_smi
fi
echo 'Uninstall done on ${{ matrix.os }}'
rpm-test:
name: Tests
needs: [rpm-buildinstall, debian-test]
runs-on:
- self-hosted
- ${{ vars.RUNNER_TYPE }}
continue-on-error: true
strategy:
max-parallel: 10
matrix:
os:
- SLES
- RHEL8
- RHEL9
- RHEL10
- AzureLinux3
- AlmaLinux8
container:
image: ${{ vars[format('{0}_DOCKER_IMAGE', matrix.os)] }}
options: --rm --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --shm-size=64G --cap-add=SYS_MODULE -v /lib/modules:/lib/modules -u root
steps:
- uses: actions/checkout@v4
- name: Set Project Directory
run: |
TARGET_DIR=$(find $GITHUB_WORKSPACE -path "*/projects/amdsmi/CMakeLists.txt" -exec dirname {} \;)
if [ -z "$TARGET_DIR" ]; then
TARGET_DIR=$(find $GITHUB_WORKSPACE -maxdepth 2 -name "CMakeLists.txt" -exec dirname {} \; | head -n 1)
fi
echo "PROJECT_DIR=$TARGET_DIR" >> $GITHUB_ENV
- name: Set PkgMgr
run: |
set -e
case "${{ matrix.os }}" in
SLES)
echo "PACKAGE_MANAGER=zypper" >> $GITHUB_ENV
;;
RHEL8|RHEL9|RHEL10|AlmaLinux8|AzureLinux3)
echo "PACKAGE_MANAGER=dnf" >> $GITHUB_ENV
;;
esac
- name: Add more_itertools
if: matrix.os == 'AzureLinux3'
run: |
set -e
echo 'Installing more_itertools on ${{ matrix.os }}'
python3 -m pip install more_itertools
- name: Build and Install for Tests (RHEL10 & AlmaLinux8)
if: matrix.os == 'RHEL10' || matrix.os == 'AlmaLinux8'
run: |
set -e
echo 'Building for test on RHEL10/AlmaLinux8 with retries and QA_RPATHS'
BUILD_FOLDER=${{ env.PROJECT_DIR }}/build
RETRIES=5
# Set QA_RPATHS to ignore empty (0x0010 | 0x0002) RPATHs
export QA_RPATHS=$((0x0010 | 0x0002))
for i in $(seq 1 $RETRIES); do
echo "Build attempt $i for RHEL10/AlmaLinux8 test..."
rm -rf $BUILD_FOLDER
mkdir -p $BUILD_FOLDER
cd $BUILD_FOLDER
if cmake ${{ env.PROJECT_DIR }} -DBUILD_TESTS=ON -DENABLE_ESMI_LIB=ON && \
make -j $(nproc) && \
make package; then
echo "Build successful on attempt $i"
break
else
echo "Build failed on attempt $i"
if [ $i -eq $RETRIES ]; then
echo "All $RETRIES build attempts failed. Exiting."
exit 1
fi
sleep $((2 * i))
fi
done
echo 'Installing for test on RHEL10/AlmaLinux8'
dnf install python3-setuptools python3-wheel -y
for i in $(seq 1 $RETRIES); do
echo "RHEL10/AlmaLinux8: Installation attempt $i for test..."
if timeout 10m dnf install -y --skip-broken --disablerepo=* $BUILD_FOLDER/amd-smi-lib-*99999-local*.rpm; then
echo "Installation successful on attempt $i"
ln -s /opt/rocm/bin/amd-smi /usr/local/bin
echo 'Install done for test on RHEL10/AlmaLinux8'
break
else
echo "Installation failed on attempt $i"
if [ $i -eq $RETRIES ]; then
echo "All $RETRIES installation attempts failed. Exiting."
exit 1
fi
sleep $((2 * i))
fi
done
- name: Build and Install for Tests
if: matrix.os != 'RHEL10' && matrix.os != 'AlmaLinux8'
run: |
set -e
echo 'Building for test on ${{ matrix.os }}'
BUILD_FOLDER=${{ env.PROJECT_DIR }}/build
rm -rf $BUILD_FOLDER
mkdir -p $BUILD_FOLDER
cd $BUILD_FOLDER
cmake ${{ env.PROJECT_DIR }} -DBUILD_TESTS=ON -DENABLE_ESMI_LIB=ON
make -j $(nproc)
make package
echo 'Installing for test on ${{ matrix.os }}'
case ${{ env.PACKAGE_MANAGER }} in
zypper)
timeout 10m zypper --no-refresh --no-gpg-checks install -y $BUILD_FOLDER/amd-smi-lib-*99999-local*.rpm
;;
dnf)
dnf install python3-setuptools python3-wheel -y
RETRIES=3
for i in $(seq 1 $RETRIES); do
echo "Attempt $i: Installing..."
if timeout 10m dnf install -y --skip-broken --disablerepo=* $BUILD_FOLDER/amd-smi-lib-*99999-local*.rpm; then
echo "Install successful."
break
else
echo "Attempt $i failed. Retrying..."
if [ $i -eq $RETRIES ]; then
echo "All attempts failed."
exit 1
fi
sleep 10
fi
done
;;
esac
ln -s /opt/rocm/bin/amd-smi /usr/local/bin
echo 'Install done for test on ${{ matrix.os }}'
- name: AMDSMI Command Tests
shell: bash
run: |
set -e
echo "Running AMDSMI commands on ${{ matrix.os }}"
mkdir -p /tmp/test-results-${{ matrix.os }}
commands=(
"amd-smi version"
"amd-smi list"
"amd-smi static"
"amd-smi firmware"
"amd-smi ucode"
"amd-smi bad-pages"
"amd-smi metric"
"amd-smi process"
"amd-smi topology"
"amd-smi monitor"
"amd-smi dmon"
"amd-smi xgmi"
"amd-smi partition"
)
for cmd in "${commands[@]}"; do
debug_cmd="$cmd --loglevel debug"
echo "Running: $debug_cmd"
if ! eval "$debug_cmd" > /tmp/test-results-${{ matrix.os }}/$(echo $cmd | tr ' ' '_').log 2>&1; then
echo "Command '$debug_cmd' failed."
cat /tmp/test-results-${{ matrix.os }}/$(echo $cmd | tr ' ' '_').log
exit 1
else
echo "$debug_cmd passed."
fi
done
echo "AMDSMI commands done on ${{ matrix.os }}"
- name: Upload AMDSMI Command Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: amdsmi-command-tests-${{ matrix.os }}
path: /tmp/test-results-${{ matrix.os }}
- name: Run AMDSMI, Python, and Example Tests
shell: bash
run: |
set -e
echo 'Running other tests on ${{ matrix.os }}'
# AMDSMI Tests
echo 'Running AMDSMI tests'
cd /opt/rocm/share/amd_smi/tests
source amdsmitst.exclude
AMDSMI_RETRIES=3
for attempt in $(seq 1 $AMDSMI_RETRIES); do
echo "AMDSMI test attempt $attempt for ${{ matrix.os }}..."
if ./amdsmitst --gtest_filter="-$(echo ${BLACKLIST_ALL_ASICS})" > /tmp/test-results-${{ matrix.os }}/amdsmi_tests.log 2>&1; then
echo "AMDSMI tests passed on attempt $attempt"
echo "=============== TEST OUTPUT ==============="
cat /tmp/test-results-${{ matrix.os }}/amdsmi_tests.log | grep -E "\[==========\]|\[ PASSED \]|\[ SKIPPED \]|\[ FAILED \]"
echo "=============================================="
echo "AMDSMI tests done"
break
else
TEST_EXIT_CODE=$?
echo "AMDSMI tests failed on attempt $attempt with exit code $TEST_EXIT_CODE"
if [ $attempt -eq $AMDSMI_RETRIES ]; then
echo "All $AMDSMI_RETRIES AMDSMI test attempts failed. Final failure."
echo "=============== TEST OUTPUT ==============="
cat /tmp/test-results-${{ matrix.os }}/amdsmi_tests.log | grep -E "\[==========\]|\[ PASSED \]|\[ SKIPPED \]|\[ FAILED \]"
echo "=============================================="
echo "AMDSMI tests failed"
exit $TEST_EXIT_CODE
else
echo "Retrying AMDSMI tests in $((2 * attempt)) seconds..."
sleep $((2 * attempt))
fi
fi
done
# Python Tests
echo 'Running Python tests'
cd /opt/rocm/share/amd_smi/tests/python_unittest
echo "Running integration tests..."
if ! ./integration_test.py -v > /tmp/test-results-${{ matrix.os }}/integration_test_output.txt 2>&1; then
echo "Integration tests failed!"
echo "=============== INTEGRATION TEST OUTPUT ==============="
tail -100 /tmp/test-results-${{ matrix.os }}/integration_test_output.txt
echo "======================================================="
exit 1
else
echo "Integration tests passed"
fi
echo "Running unit tests..."
if ! ./unit_tests.py -v > /tmp/test-results-${{ matrix.os }}/unit_test_output.txt 2>&1; then
echo "Unit tests failed!"
echo "=============== UNIT TEST OUTPUT ==============="
tail -100 /tmp/test-results-${{ matrix.os }}/unit_test_output.txt
echo "================================================"
exit 1
else
echo "Unit tests passed"
fi
echo "Python tests done"
# Example Tests
echo 'Running Example tests'
cd ${{ env.PROJECT_DIR }}/example
rm -rf build
cmake -B build -DENABLE_ESMI_LIB=OFF
make -C build -j $(nproc)
cd build
./amd_smi_drm_ex > /tmp/test-results-${{ matrix.os }}/amd_smi_drm_ex.log 2>&1 || echo 'amd_smi_drm_ex failed'
./amd_smi_nodrm_ex > /tmp/test-results-${{ matrix.os }}/amd_smi_nodrm_ex.log 2>&1 || echo 'amd_smi_nodrm_ex failed'
echo "Example tests done"
- name: AMDSMI Test Results
if: always()
run: |
echo "Displaying AMDSMI test results for ${{ matrix.os }}"
cat /tmp/test-results-${{ matrix.os }}/amdsmi_tests.log || echo "No AMDSMI test results found for ${{ matrix.os }}"
- name: Integration Test Results
if: always()
run: |
echo "Displaying Integration test results for ${{ matrix.os }}"
cat /tmp/test-results-${{ matrix.os }}/integration_test_output.txt || echo "No integration test results found for ${{ matrix.os }}"
- name: Unit Test Results
if: always()
run: |
echo "Displaying Unit Test Results for ${{ matrix.os }}"
cat /tmp/test-results-${{ matrix.os }}/unit_test_output.txt || echo "No unit test results found for ${{ matrix.os }}"
- name: Example DRM Test Results
if: always()
run: |
echo "Displaying Example DRM test results for ${{ matrix.os }}"
cat /tmp/test-results-${{ matrix.os }}/amd_smi_drm_ex.log || echo "No DRM example test results found for ${{ matrix.os }}"
- name: Example NoDRM Test Results
if: always()
run: |
echo "Displaying Example NoDRM test results for ${{ matrix.os }}"
cat /tmp/test-results-${{ matrix.os }}/amd_smi_nodrm_ex.log || echo "No NoDRM example test results found for ${{ matrix.os }}"
+32
Ver Arquivo
@@ -0,0 +1,32 @@
name: Apply Labels
on:
workflow_dispatch:
inputs:
labelFile:
description: 'Path to YAML file with labels'
required: true
default: '.github/labels.yml'
jobs:
apply-labels:
runs-on: ubuntu-latest
steps:
- name: Checkout super-repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
run: pip install PyYAML requests
- name: Apply labels to super-repo
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
run: |
python .github/scripts/apply-labels.py "${{ github.event.inputs.labelFile }}"
+120
Ver Arquivo
@@ -0,0 +1,120 @@
name: "AqlProfile CodeQL Advanced"
on:
push:
branches:
- develop
paths:
- 'projects/aqlprofile/**'
pull_request:
paths:
- 'projects/aqlprofile/**'
schedule:
- cron: '0 0 * * *'
env:
EXCLUDED_PATHS: ""
jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ubuntu-latest
container: rocm/dev-ubuntu-22.04:latest
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: c-cpp
build-mode: manual
- language: python
build-mode: none
- language: actions
build-mode: none
steps:
- name: Install OS requirements
timeout-minutes: 10
shell: bash
run: |
sudo apt update
sudo apt install -y software-properties-common
sudo apt-add-repository ppa:git-core/ppa
sudo apt-get update
sudo apt install -y git
- name: Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: |
projects/aqlprofile
.github/workflows/aqlprofile-code-ql.yml
- name: Configure Git Safe Directory
shell: bash
run: |
cd projects/aqlprofile
git config --global --add safe.directory '*'
git config --global --add safe.directory '/__w/rocm-systems/rocm-systems'
- if: matrix.build-mode == 'manual'
name: Install requirements
timeout-minutes: 10
shell: bash
run: |
cd projects/aqlprofile
git config --global --add safe.directory '*'
apt-get update
apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libdw-dev rocm-llvm-dev libgtest-dev libgmock-dev
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
queries: security-extended
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
name: Configure and Build
timeout-minutes: 30
shell: bash
run: |
cd projects/aqlprofile
cmake -B /tmp/build -DGPU_TARGETS='gfx906,gfx90a,gfx942,gfx1101,gfx1201' -DCMAKE_PREFIX_PATH=/opt/rocm
cmake --build /tmp/build --target all --parallel 16
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
@@ -0,0 +1,207 @@
name: AqlProfile Continuous Integration
on:
schedule:
- cron: '0 7 * * *'
workflow_dispatch:
push:
branches:
- develop
paths:
- 'projects/aqlprofile/**'
- '!projects/aqlprofile/*.md'
- '!projects/aqlprofile/CODEOWNERS'
- '!projects/aqlprofile/source/docs/**'
- '.github/workflows/aqlprofile-continuous_integration.yml'
pull_request:
paths:
- 'projects/aqlprofile/**'
- '!projects/aqlprofile/*.md'
- '!projects/aqlprofile/CODEOWNERS'
- '!projects/aqlprofile/source/docs/**'
- '.github/workflows/aqlprofile-continuous_integration.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ROCM_PATH: "/opt/rocm"
ROCM_VERSION: "7.2.0"
PYTHON_VENV_PATH: "aqlprofile"
PYTHON_VENV_ACTIVATE: "aqlprofile/bin/activate"
navi3_EXCLUDE_TESTS_REGEX: ""
vega20_EXCLUDE_TESTS_REGEX: ""
mi200_EXCLUDE_TESTS_REGEX: ""
mi300_EXCLUDE_TESTS_REGEX: ""
mi300a_EXCLUDE_TESTS_REGEX: ""
mi325_EXCLUDE_TESTS_REGEX: ""
navi4_EXCLUDE_TESTS_REGEX: ""
navi3_EXCLUDE_LABEL_REGEX: ""
vega20_EXCLUDE_LABEL_REGEX: ""
mi200_EXCLUDE_LABEL_REGEX: ""
mi300_EXCLUDE_LABEL_REGEX: ""
mi300a_EXCLUDE_LABEL_REGEX: ""
mi325_EXCLUDE_LABEL_REGEX: ""
navi4_EXCLUDE_LABEL_REGEX: ""
jobs:
core-deb:
name: Core • ${{ matrix.system.gpu }} • ${{ matrix.system.os }}
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
strategy:
fail-fast: false
matrix:
system:
- { gpu: 'navi4', runner: 'rocprofiler-navi4-dind', os: 'ubuntu-22.04', build-type: 'RelWithDebInfo', gpu-target: 'gfx120X' }
- { gpu: 'navi3', runner: 'rocprofiler-navi3-dind', os: 'ubuntu-22.04', build-type: 'RelWithDebInfo', gpu-target: 'gfx110X' }
- { gpu: 'mi325', runner: 'linux-mi325-1gpu-ossci-rocm-frac', os: 'ubuntu-22.04', build-type: 'RelWithDebInfo', gpu-target: 'gfx94X' }
runs-on: ${{ matrix.system.runner }}
container:
image: docker.io/rocm/rocprofiler-private:${{ matrix.system.os }}-${{ matrix.system.gpu-target }}-latest
credentials:
username: ${{ secrets.ROCPROFILER_AZURE_CI_USER }}
password: ${{ secrets.ROCPROFILER_AZURE_CI_PASS }}
env:
DEBIAN_FRONTEND: noninteractive
options: --privileged --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
permissions:
contents: read
pull-requests: write
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
GPU_RUNNER: ${{ matrix.system.gpu }}
steps:
- name: Install Latest Nightly ROCm
shell: bash
working-directory: /tmp
run: |
tar -xf ${{ env.ROCM_PATH }}-${{ matrix.system.gpu-target }}.tar.gz -C ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}
ln -s ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} ${{ env.ROCM_PATH }}
echo "ROCm installed to: ${{ env.ROCM_PATH }}"
ln -s -f /usr/bin/git /usr/local/bin/git
- uses: actions/checkout@v5
with:
sparse-checkout: projects/aqlprofile
set-safe-directory: true
- name: Install requirements
timeout-minutes: 10
shell: bash
run: |
git config --global --add safe.directory '*'
apt-get update
apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libgtest-dev libgmock-dev
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
- name: List Files
shell: bash
run: |
echo "PATH: ${PATH}"
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
cat ${{ env.ROCM_PATH }}/.info/version
ls -la
pwd
- name: Configure, Build, and Test
timeout-minutes: 30
shell: bash
run:
PATH=~/.local/bin:${{ env.ROCM_PATH }}/bin:${PATH}
LD_LIBRARY_PATH=$(pwd)/build:${{ env.ROCM_PATH }}/lib:$LD_LIBRARY_PATH
ctest --output-on-failure --verbose -DCTEST_SOURCE_DIRECTORY="$(pwd)"
-DCTEST_BINARY_DIRECTORY="$(pwd)/build" -DAQLPROFILE_BUILD_NUM_JOBS="16" -DCTEST_SITE="${{ matrix.system.runner }}"
-DCTEST_BUILD_NAME=PR_${{ github.ref_name }}_${{ github.repository }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-core
-DCMAKE_CTEST_ARGUMENTS=""
-DAQLPROFILE_BUILD_TESTS=ON
-DAQLPROFILE_EXTRA_CONFIGURE_ARGS=""
-S $(pwd)/projects/aqlprofile/dashboard.cmake
core-rpm:
name: Core • ${{ matrix.system.gpu }} • ${{ matrix.system.os }}
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
strategy:
fail-fast: false
matrix:
system:
- { gpu: 'mi325', runner: 'linux-mi325-1gpu-ossci-rocm-frac', os: 'rhel-8.8', build-type: 'RelWithDebInfo', gpu-target: 'gfx94X' }
- { gpu: 'mi325', runner: 'linux-mi325-1gpu-ossci-rocm-frac', os: 'rhel-9.5', build-type: 'RelWithDebInfo', gpu-target: 'gfx94X' }
- { gpu: 'mi325', runner: 'linux-mi325-1gpu-ossci-rocm-frac', os: 'sles-15.6', build-type: 'RelWithDebInfo', gpu-target: 'gfx94X' }
runs-on: ${{ matrix.system.runner }}
container:
image: docker.io/rocm/rocprofiler-private:${{ matrix.system.os }}-${{ matrix.system.gpu-target }}-latest
credentials:
username: ${{ secrets.ROCPROFILER_AZURE_CI_USER }}
password: ${{ secrets.ROCPROFILER_AZURE_CI_PASS }}
options: --privileged --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
permissions:
contents: read
pull-requests: write
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
GPU_RUNNER: ${{ matrix.system.gpu }}
steps:
- uses: actions/checkout@v5
with:
sparse-checkout: projects/aqlprofile
set-safe-directory: true
- name: Install Latest Nightly ROCm using TheRock Tarballs
shell: bash
working-directory: /tmp
run: |
tar -xf ${{ env.ROCM_PATH }}-${{ matrix.system.gpu-target }}.tar.gz -C ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}
ln -s ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} ${{ env.ROCM_PATH }}
echo "ROCm installed to: ${{ env.ROCM_PATH }}"
- name: Install requirements
timeout-minutes: 10
shell: bash
run: |
git config --global --add safe.directory '*'
python3 -m venv ${{ env.PYTHON_VENV_PATH }}
source ${{ env.PYTHON_VENV_ACTIVATE }}
export PATH=/opt/rh/gcc-toolset-11/root/usr/bin:$PATH
python3 -m pip install --upgrade pip
python3 -m pip install cmake
- name: List Files
shell: bash
run: |
source ${{ env.PYTHON_VENV_ACTIVATE }}
echo "PATH: ${PATH}"
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
cat ${{ env.ROCM_PATH }}/.info/version
ls -la
pwd
- name: Configure, Build, and Test
timeout-minutes: 30
shell: bash
run:
PATH=~/.local/bin:${{ env.ROCM_PATH }}/bin:${PATH}
LD_LIBRARY_PATH=$(pwd)/build:${{ env.ROCM_PATH }}/lib:$LD_LIBRARY_PATH
ctest --output-on-failure --verbose -DCTEST_SOURCE_DIRECTORY="$(pwd)"
-DCTEST_BINARY_DIRECTORY="$(pwd)/build" -DAQLPROFILE_BUILD_NUM_JOBS="16"
-DCTEST_SITE=${{ matrix.system.runner }}
-DCTEST_BUILD_NAME=PR_${{ github.ref_name }}_${{ github.repository }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-core
-DCMAKE_CTEST_ARGUMENTS=""
-DAQLPROFILE_BUILD_TESTS=ON
-DAQLPROFILE_EXTRA_CONFIGURE_ARGS=""
-S $(pwd)/projects/aqlprofile/dashboard.cmake
+319
Ver Arquivo
@@ -0,0 +1,319 @@
name: Auto Label PRs
on:
pull_request:
types: [opened, synchronize, reopened, closed]
workflow_run:
workflows: ["ABI Compliance Check"]
types: [completed]
jobs:
apply-labels:
runs-on: ubuntu-22.04
permissions:
pull-requests: write
actions: read
contents: read
steps:
- name: Add/Remove labels based on branch names and ABI results
uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request;
let prNumber, headSha, baseBranch, headBranch;
// Handle different event types
if (context.eventName === 'pull_request') {
prNumber = pr.number;
headSha = pr.head.sha;
baseBranch = pr.base.ref;
headBranch = pr.head.ref;
} else if (context.eventName === 'workflow_run') {
// Find the associated PR for workflow_run events
const workflowRun = context.payload.workflow_run;
console.log(`Workflow run completed: ${workflowRun.name} with conclusion: ${workflowRun.conclusion}`);
if (workflowRun.event !== 'pull_request') {
console.log('Workflow run was not triggered by a pull request, skipping');
return;
}
const prs = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
head: `${context.repo.owner}:${workflowRun.head_branch}`
});
const associatedPr = prs.data.find(p => p.head.sha === workflowRun.head_sha);
if (!associatedPr) {
console.log('No associated PR found for this workflow run');
return;
}
prNumber = associatedPr.number;
headSha = associatedPr.head.sha;
baseBranch = associatedPr.base.ref;
headBranch = associatedPr.head.ref;
} else {
console.log('Unsupported event type');
return;
}
let labelsApplied = false;
// Debug information
console.log(`Processing PR #${prNumber}: Head: ${headBranch}, Base: ${baseBranch}`);
// Get current PR data to check existing labels
const { data: currentPr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});
const existingLabels = currentPr.labels.map(label => label.name);
// Condition 1: PR targeting amd-mainline
if (baseBranch === 'amd-mainline' && context.eventName === 'pull_request') {
const labelToAdd = 'Merge amd-mainline';
try {
if (!existingLabels.includes(labelToAdd)) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
labels: [labelToAdd]
});
console.log(`Added label "${labelToAdd}" to PR #${prNumber}`);
labelsApplied = true;
}
} catch (error) {
console.error(`Error adding label "${labelToAdd}": ${error.message}`);
}
}
// Condition 2: Cherry-pick based on head branch name or release target
if (context.eventName === 'pull_request') {
const isCherryPickHead = /cherry.*pick/i.test(headBranch);
const isReleaseTargetBase = baseBranch.startsWith('release/');
if (isCherryPickHead || isReleaseTargetBase) {
const labelToAdd = 'cherry-pick';
try {
if (!existingLabels.includes(labelToAdd)) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
labels: [labelToAdd]
});
console.log(`Added label "${labelToAdd}" to PR #${prNumber}`);
labelsApplied = true;
} else {
console.log(`Label "${labelToAdd}" already exists on PR #${prNumber}`);
}
} catch (error) {
console.error(`Error adding label "${labelToAdd}": ${error.message}`);
}
}
}
// ABI BREAKAGE LOGIC: Check on both workflow_run AND pull_request events
let shouldCheckABI = false;
let hasMajorAbiBreakage = false;
let hasMinorAbiBreakage = false;
if (context.eventName === 'workflow_run') {
// Handle workflow_run events (existing logic)
const workflowRun = context.payload.workflow_run;
if (workflowRun.name === 'ABI Compliance Check') {
shouldCheckABI = true;
console.log(`ABI Compliance Check completed with conclusion: ${workflowRun.conclusion}`);
try {
const { data: jobs } = await github.rest.actions.listJobsForWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: workflowRun.id
});
// Check job conclusions for ABI breakage
for (const job of jobs.jobs) {
console.log(`Job: ${job.name}, Conclusion: ${job.conclusion}`);
if (job.name.includes('Major ABI') && job.conclusion === 'failure') {
hasMajorAbiBreakage = true;
console.log('Major ABI breakage detected from job failure');
}
if (job.name.includes('Minor ABI') && job.conclusion === 'failure') {
hasMinorAbiBreakage = true;
console.log('Minor ABI breakage detected from job failure');
}
}
// If workflow succeeded, no ABI breakage
if (workflowRun.conclusion === 'success') {
console.log('ABI Compliance Check succeeded - no ABI breakage');
hasMajorAbiBreakage = false;
hasMinorAbiBreakage = false;
}
} catch (error) {
console.log(`Could not fetch job details: ${error.message}`);
return;
}
}
} else if (context.eventName === 'pull_request') {
// NEW: Check if amdsmi.h has been reverted on PR events
const hasAbiLabels = existingLabels.includes('MAJOR ABI BREAKAGE') || existingLabels.includes('MINOR ABI BREAKAGE');
if (hasAbiLabels) {
console.log('PR has ABI labels, checking if amdsmi.h changes were reverted...');
shouldCheckABI = true;
try {
// Get the diff for amdsmi.h between base and head
const { data: comparison } = await github.rest.repos.compareCommits({
owner: context.repo.owner,
repo: context.repo.repo,
base: currentPr.base.sha,
head: currentPr.head.sha
});
// Check if amdsmi.h has any changes
const amdsmiFile = comparison.files?.find(file => file.filename === 'include/amd_smi/amdsmi.h');
if (!amdsmiFile) {
console.log('No changes to amdsmi.h found in this PR - removing ABI labels');
hasMajorAbiBreakage = false;
hasMinorAbiBreakage = false;
} else if (amdsmiFile.changes === 0) {
console.log('amdsmi.h file exists but has no changes - removing ABI labels');
hasMajorAbiBreakage = false;
hasMinorAbiBreakage = false;
} else {
console.log(`amdsmi.h has ${amdsmiFile.changes} changes - keeping existing ABI labels`);
// Keep existing labels since we can't determine ABI status without running the check
hasMajorAbiBreakage = existingLabels.includes('MAJOR ABI BREAKAGE');
hasMinorAbiBreakage = existingLabels.includes('MINOR ABI BREAKAGE');
}
} catch (error) {
console.log(`Error checking file changes: ${error.message}`);
// If we can't check, preserve existing labels
hasMajorAbiBreakage = existingLabels.includes('MAJOR ABI BREAKAGE');
hasMinorAbiBreakage = existingLabels.includes('MINOR ABI BREAKAGE');
}
}
}
// Manage ABI breakage labels (only if we determined ABI status)
if (shouldCheckABI) {
const abiLabels = {
'MAJOR ABI BREAKAGE': hasMajorAbiBreakage,
'MINOR ABI BREAKAGE': hasMinorAbiBreakage
};
const wasMajorAbiBreakage = existingLabels.includes('MAJOR ABI BREAKAGE');
const wasMinorAbiBreakage = existingLabels.includes('MINOR ABI BREAKAGE');
for (const [labelName, shouldHaveLabel] of Object.entries(abiLabels)) {
const hasLabel = existingLabels.includes(labelName);
if (shouldHaveLabel && !hasLabel) {
// Add label
try {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
labels: [labelName]
});
console.log(`✅ Added label "${labelName}" to PR #${prNumber}`);
labelsApplied = true;
} catch (error) {
console.error(`❌ Error adding label "${labelName}": ${error.message}`);
}
} else if (!shouldHaveLabel && hasLabel) {
// Remove label
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
name: labelName
});
console.log(`🗑️ Removed label "${labelName}" from PR #${prNumber}`);
labelsApplied = true;
} catch (error) {
console.error(`❌ Error removing label "${labelName}": ${error.message}`);
}
}
}
// Add comments when ABI issues are detected or resolved
if (context.eventName === 'workflow_run') {
// Only add comments for workflow_run events (actual ABI check results)
if (hasMajorAbiBreakage && !wasMajorAbiBreakage) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: '⚠️ **MAJOR ABI BREAKAGE detected** in the latest ABI compliance check. Please review the ABI compliance report and fix any breaking changes.'
});
}
if (hasMinorAbiBreakage && !wasMinorAbiBreakage) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: '⚠️ **MINOR ABI BREAKAGE detected** in the latest ABI compliance check. Please review the ABI compliance report for details.'
});
}
if (!hasMajorAbiBreakage && wasMajorAbiBreakage) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: '✅ **MAJOR ABI BREAKAGE resolved** - ABI compliance check is now passing!'
});
}
if (!hasMinorAbiBreakage && wasMinorAbiBreakage) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: '✅ **MINOR ABI BREAKAGE resolved** - ABI compliance check is now passing!'
});
}
} else if (context.eventName === 'pull_request') {
// Add comment when labels are removed due to file reversion
if (!hasMajorAbiBreakage && wasMajorAbiBreakage) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: '✅ **MAJOR ABI BREAKAGE resolved** - `amdsmi.h` changes have been reverted.'
});
}
if (!hasMinorAbiBreakage && wasMinorAbiBreakage) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: '✅ **MINOR ABI BREAKAGE resolved** - `amdsmi.h` changes have been reverted.'
});
}
}
}
if (!labelsApplied && context.eventName === 'pull_request') {
console.log(`PR #${prNumber} did not match criteria for automatic labeling by this workflow.`);
}
+355
Ver Arquivo
@@ -0,0 +1,355 @@
# Azure CI Dispatcher
# ------------------
# This workflow allows Azure CI to be centralized in a single PR check.
# It detects which subtrees (from a super-repo structure) were changed in a
# pull request, and automatically requests Azure CI runs for the corresponding
# subtrees.
#
# For any given subtree, if an upstream subtree is also included in the PR,
# it will not run CI for the downstream subtree.
# Eg. A PR that touches rocprim and rocthrust will only trigger rocprim CI.
#
# Requires an Azure Personal Access Token with permissions to manage builds.
# The token should be stored in the repository secrets as `AZ_PAT`.
name: Trigger Azure CI
on:
pull_request_target:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- develop
- staging
- main
- release-staging/rocm-rel-7.*
paths-ignore: # Do not trigger full tests on documentation-only changes
- '**/*.md'
- '**/*.rtf'
- '**/*.rst'
- '**/.markdownlint-ci2.yaml'
- '**/.readthedocs.yaml'
- '**/.spellcheck.local.yaml'
- '**/.wordlist.txt'
- 'docs/**'
- 'projects/*/docs/**'
concurrency:
group: azure-ci-dispatcher-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
dispatch-azure-ci:
name: Trigger Azure CI
if: github.repository == 'ROCm/rocm-systems' && github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: |
rocm-systems
- name: Wait until refs/pull/${{ github.event.pull_request.number }}/merge exists
run: |
merge_ref="refs/pull/${{ github.event.pull_request.number }}/merge"
check_merge_ref() {
git ls-remote "https://github.com/ROCm/rocm-systems" "$merge_ref" | grep -q "$merge_ref"
}
max_attempts=10
attempt=0
while [ $attempt -lt $max_attempts ]; do
if check_merge_ref; then
echo "$merge_ref found."
break
else
retry_delay=60
echo "$merge_ref not found. Retrying in $retry_delay seconds..."
sleep $retry_delay
fi
attempt=$((attempt + 1))
done
if [ $attempt -ge $max_attempts ]; then
echo "$merge_ref not found. Maximum attempts reached."
exit 1
fi
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
sparse-checkout: .github
sparse-checkout-cone-mode: true
token: ${{ steps.generate-token.outputs.token }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r .github/requirements.txt
- name: Detect changed subtrees
id: detect
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
python .github/scripts/pr_detect_changed_subtrees.py \
--repo "${{ github.repository }}" \
--pr "${{ github.event.pull_request.number }}" \
--config ".github/repos-config.json" \
--require-monorepo-source
- name: Cancel in-progress/not-started runs for current PR
id: cancel-in-progress
if: steps.detect.outputs.subtrees
run: |
pr_number=${{ github.event.pull_request.number }}
pr_filter_query="branchName=refs/pull/$pr_number/merge&repositoryType=GitHub&repositoryId=ROCm/rocm-systems&api-version=7.1"
res=$(curl -sSX GET "https://dev.azure.com/ROCm-CI/ROCm-CI/_apis/build/builds?$pr_filter_query" \
-H "Content-Type: application/json")
runs=$(echo "$res" | jq -r ".value[] | select((.status == \"inProgress\" or .status == \"notStarted\") and .definition.name != \"rocm-ci-caller\") | .id")
if [ -z "$runs" ]; then
echo "No in-progress/not-started runs found for ROCm/rocm-systems PR #$pr_number"
echo "status=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "Found in-progress/not-started runs for ROCm/rocm-systems PR #$pr_number: $runs"
echo "status=true" >> $GITHUB_OUTPUT
for run_id in $runs; do
echo "Cancelling run ID: $run_id"
echo "Run URL: https://dev.azure.com/ROCm-CI/ROCm-CI/_build/results?buildId=$run_id"
response=$(curl -sSX PATCH "https://dev.azure.com/ROCm-CI/ROCm-CI/_apis/build/builds/$run_id?api-version=7.1" \
-u ":${{ secrets.AZ_PAT }}" \
-H "Content-Type: application/json" \
-d '{"status": "cancelling"}')
if [ $? -ne 0 ]; then
echo "Failed to cancel run ID: $run_id"
else
echo "Cancelled run ID: $run_id"
fi
done
- name: Rerun previous failed/cancelled runs for current PR merge commit
id: rerun-failed
if: steps.detect.outputs.subtrees && steps.cancel-in-progress.outputs.status == 'false'
run: |
pr_number=${{ github.event.pull_request.number }}
pr_merge_sha=$(curl -sSX GET "https://api.github.com/repos/ROCm/rocm-systems/git/ref/pull/${pr_number}/merge" | jq -r '.object.sha')
pr_filter_query="branchName=refs/pull/$pr_number/merge&repositoryType=GitHub&repositoryId=ROCm/rocm-systems&api-version=7.1"
res=$(curl -sSX GET "https://dev.azure.com/ROCm-CI/ROCm-CI/_apis/build/builds?$pr_filter_query" \
-H "Content-Type: application/json")
failed_runs_info=$(echo "$res" | jq -r ".value[] |
select((.result == \"failed\" or .result == \"canceled\")
and (.sourceVersion | contains(\"$pr_merge_sha\")))
| {id: .id, name: .definition.name}")
success_runs_info=$(echo "$res" | jq -r ".value[] |
select((.result == \"succeeded\")
and (.sourceVersion | contains(\"$pr_merge_sha\")))
| {id: .id, name: .definition.name}")
failed_run_ids=$(echo "$failed_runs_info" | jq -r '.id')
failed_project_names=$(echo "$failed_runs_info" | jq -r '.name')
success_run_ids=$(echo "$success_runs_info" | jq -r '.id')
success_project_names=$(echo "$success_runs_info" | jq -r '.name')
if [ -z "$failed_run_ids" ]; then
echo "No failed/cancelled runs found for ROCm/rocm-systems PR #$pr_number at merge commit $pr_merge_sha"
echo "status=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "Found failed/cancelled runs for ROCm/rocm-systems PR #$pr_number at merge commit $pr_merge_sha: ${failed_run_ids[*]}"
echo "Found successful runs for ROCm/rocm-systems PR #$pr_number at merge commit $pr_merge_sha: ${success_run_ids[*]}"
echo "status=true" >> $GITHUB_OUTPUT
new_run_ids=()
for run_id in $failed_run_ids; do
echo "Rerunning failed run ID: $run_id"
echo "Run URL: https://dev.azure.com/ROCm-CI/ROCm-CI/_build/results?buildId=$run_id"
response=$(curl -sSX PATCH "https://dev.azure.com/ROCm-CI/ROCm-CI/_apis/build/builds/$run_id?retry=true&api-version=7.1" \
-u ":${{ secrets.AZ_PAT }}" \
-H "Content-Type: application/json")
if [ $? -ne 0 ]; then
echo "Failed to rerun run ID: $run_id"
else
echo "Rerun requested for run ID: $run_id"
new_run_ids+=("$run_id")
fi
done
echo "run_ids=${new_run_ids[*]}" >> $GITHUB_OUTPUT
echo "project_names=${failed_project_names[*]}" >> $GITHUB_OUTPUT
echo "success_run_ids=${success_run_ids[*]}" >> $GITHUB_OUTPUT
echo "success_project_names=${success_project_names[*]}" >> $GITHUB_OUTPUT
- name: Start new Azure CI runs
id: dispatch
if: steps.detect.outputs.subtrees && (steps.cancel-in-progress.outputs.status == 'true' || steps.rerun-failed.outputs.status == 'false')
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
echo "${{ steps.detect.outputs.subtrees }}" > changed_subtrees.txt
python .github/scripts/azure_resolve_subtree_deps.py \
--subtree-file changed_subtrees.txt \
> resolved_subtrees.txt
run_ids=()
project_names=()
while IFS= read -r line; do
IFS='=' read -r project_name definition_id <<< "$line"
echo "Requesting run for $project_name with definition ID $definition_id"
max_attempts=3
retry_delay=5
attempt=1
success=false
while [ $attempt -le $max_attempts ]; do
response=$(curl -sSX POST https://dev.azure.com/ROCm-CI/ROCm-CI/_apis/pipelines/$definition_id/runs?api-version=7.1 \
-u ":${{ secrets.AZ_PAT }}" \
-H "Content-Type: application/json" \
-d '{
"resources": {
"repositories": {
"self": {
"refName": "refs/pull/${{ github.event.pull_request.number }}/merge"
}
}
}
}')
if [ $? -eq 0 ]; then
success=true
break
fi
echo "Attempt $attempt failed. Retrying in $retry_delay seconds..."
sleep $retry_delay
attempt=$((attempt + 1))
done
if [ "$success" = true ]; then
run_id=$(echo "$response" | jq -r '.id' || echo "null")
if [ "$run_id" != "null" ]; then
echo "Run ID for $project_name: $run_id"
echo "Run URL: https://dev.azure.com/ROCm-CI/ROCm-CI/_build/results?buildId=$run_id"
run_ids+=("$run_id")
project_names+=("$project_name")
else
echo "Failed to request run for $project_name"
fi
else
echo "Failed to request run for $project_name after $max_attempts attempts"
fi
echo ""
done < resolved_subtrees.txt
echo "run_ids=${run_ids[*]}" >> $GITHUB_OUTPUT
echo "project_names=${project_names[*]}" >> $GITHUB_OUTPUT
- name: Create summary check
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
PR_TITLE: ${{ toJSON(github.event.pull_request.title) }}
run: |
if [[ -n "${{ steps.dispatch.outputs.run_ids }}" && -n "${{ steps.dispatch.outputs.project_names }}" ]]; then # If new runs were started
run_ids=(${{ steps.dispatch.outputs.run_ids }})
project_names=(${{ steps.dispatch.outputs.project_names }})
elif [[ -n "${{ steps.rerun-failed.outputs.run_ids }}" && -n "${{ steps.rerun-failed.outputs.project_names }}" ]]; then # If reruns were requested
run_ids=(${{ steps.rerun-failed.outputs.run_ids }})
project_names=(${{ steps.rerun-failed.outputs.project_names }})
success_run_ids=(${{ steps.rerun-failed.outputs.success_run_ids }})
success_project_names=(${{ steps.rerun-failed.outputs.success_project_names }})
else
echo "No run IDs or project names found, creating empty summary check."
fi
pr_number=${{ github.event.pull_request.number }}
pr_head_sha=${{ github.event.pull_request.head.sha }}
pr_merge_sha=$(curl -sSX GET "https://api.github.com/repos/ROCm/rocm-systems/git/ref/pull/${pr_number}/merge" | jq -r '.object.sha')
newline=$'\n'
summary="PR: [$PR_TITLE #$pr_number](${{ github.event.pull_request.html_url }})${newline}${newline}"
summary+="HEAD: [$pr_head_sha](https://github.com/ROCm/rocm-systems/commit/$pr_head_sha)${newline}${newline}"
summary+="MERGE: [$pr_merge_sha](https://github.com/ROCm/rocm-systems/commit/$pr_merge_sha)${newline}${newline}"
if [[ -z "${run_ids[*]}" && -z "${success_run_ids[*]}" ]]; then
summary+="### No Azure CI runs were started for this PR.${newline}${newline}"
gh_output=$(gh api repos/ROCm/rocm-systems/check-runs \
-f "name=Azure CI Summary" \
-f "head_sha=$pr_head_sha" \
-f "status=completed" \
-f "conclusion=neutral" \
-f "output[title]=Azure CI Summary" \
-f "output[summary]=$summary")
echo "Created empty summary check with ID: $(echo "$gh_output" | jq -r '.id')"
echo "Summary check URL: https://github.com/ROCm/rocm-systems/pull/$pr_number/checks?check_run_id=$(echo "$gh_output" | jq -r '.id')"
exit 0
fi
summary+="### Pipelines triggered for this PR${newline}${newline}"
summary+="| Project | Run ID | Status |${newline}"
summary+="|--------------|--------|--------|${newline}"
if [[ -n "${success_run_ids[*]}" ]]; then
for i in "${!success_project_names[@]}"; do
summary+="| ${success_project_names[i]} | [${success_run_ids[i]}](https://dev.azure.com/ROCm-CI/ROCm-CI/_build/results?buildId=${success_run_ids[i]}) | success |${newline}"
done
fi
for i in "${!project_names[@]}"; do
summary+="| ${project_names[i]} | [${run_ids[i]}](https://dev.azure.com/ROCm-CI/ROCm-CI/_build/results?buildId=${run_ids[i]}) | pending |${newline}"
done
summary+="${newline}${newline}"
summary+="### Rerun instructions${newline}${newline}"
summary+="To request Azure to rerun jobs, click the \`Re-run all jobs\` button on the [corresponding \`Trigger Azure CI\` run](https://github.com/ROCm/rocm-systems/actions/runs/${{ github.run_id }}).${newline}${newline}"
summary+="If there are any pending runs for this PR, they will be cancelled, and new runs will be started.${newline}${newline}"
summary+="If there are no pending runs, but there are existing failed or cancelled runs for this PR and merge SHA, the existing runs will be rerun.${newline}${newline}"
summary+="Otherwise, new runs will be started.${newline}${newline}"
text=""
if [[ -n "${success_run_ids[*]}" ]]; then
for i in "${!success_run_ids[@]}"; do
text+="${success_run_ids[i]}=success;"
done
fi
for i in "${!project_names[@]}"; do
text+="${run_ids[i]}=pending;"
done
gh_output=$(gh api repos/ROCm/rocm-systems/check-runs \
-f "name=Azure CI Summary" \
-f "head_sha=$pr_head_sha" \
-f "status=in_progress" \
-f "output[title]=Azure CI Summary" \
-f "output[summary]=$summary" \
-f "output[text]=$text")
echo "Created summary check with ID: $(echo "$gh_output" | jq -r '.id')"
echo "Summary check URL: https://github.com/ROCm/rocm-systems/pull/$pr_number/checks?check_run_id=$(echo "$gh_output" | jq -r '.id')"
+36
Ver Arquivo
@@ -0,0 +1,36 @@
name: Collect Labels
on:
workflow_dispatch:
inputs:
repoListFile:
description: 'Path to JSON file with repo list'
required: true
default: '.github/repos-config.json'
jobs:
collect-labels:
runs-on: ubuntu-latest
steps:
- name: Checkout super-repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
run: pip install PyYAML requests
- name: Collect labels from source repos
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python .github/scripts/collect-labels.py "${{ github.event.inputs.repoListFile }}"
- name: Print generated labels.yml
run: |
echo "Contents of labels.yml:"
cat .github/labels.yml
+27
Ver Arquivo
@@ -0,0 +1,27 @@
name: Clang format check
on:
pull_request:
types: [synchronize, opened]
paths:
- 'projects/hip/**'
- 'projects/clr/**'
- 'projects/hipother/**'
- 'projects/hip-tests/**'
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install clang-format
run: |
sudo apt update && sudo apt install -y clang-format
- name: Run clang-format-check
id: clang-format
run: |
chmod +x .github/hooks/clang-format-check.sh
./.github/hooks/clang-format-check.sh --range "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"
@@ -0,0 +1,27 @@
name: Validate HIP PR description
on:
pull_request:
types: [opened, edited, synchronize]
paths:
- "projects/hip/**"
- "projects/clr/**"
- "projects/hipother/**"
- "projects/hip-tests/**"
jobs:
validate-pr-description:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Validate PR description
env:
PR_DESCRIPTION: ${{ github.event.pull_request.body }}
run: python .github/scripts/hip_validate_pr_description.py
@@ -0,0 +1,44 @@
# Import Prep: Disable Workflows
# ------------------------------
# This GitHub Actions workflow disables all non-Import-related workflows in the repository.
# This is useful as a preparatory step before performing a bulk import of issues from another repository.
name: "Import Prep: Disable workflows"
on:
workflow_dispatch:
jobs:
disable-workflows:
runs-on: ubuntu-24.04
steps:
- name: Validate maintainer permissions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Actor is: ${{ github.actor }}"
PERMISSION=$(gh api \
repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission \
--jq .permission)
if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "maintain" ]]; then
echo "❌ User ${{ github.actor }} is not authorized to run this workflow"
exit 1
fi
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Disable Workflows except Import
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
workflows=$(gh api --paginate repos/${{ github.repository }}/actions/workflows --jq '.workflows[] | {id, name}')
echo "$workflows" | jq -c '. | select(.name | startswith("Import") | not)' | while read wf; do
id=$(echo "$wf" | jq '.id')
name=$(echo "$wf" | jq -r '.name')
gh api --method PUT repos/${{ github.repository }}/actions/workflows/$id/disable --silent
done
@@ -0,0 +1,44 @@
# Import Prep: Enable Workflows
# ------------------------------
# This GitHub Actions workflow enables all non-Import-related workflows in the repository.
# This is useful as a preparatory step before performing a bulk import of issues from another repository.
name: "Import Prep: Enable workflows"
on:
workflow_dispatch:
jobs:
disable-workflows:
runs-on: ubuntu-24.04
steps:
- name: Validate maintainer permissions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Actor is: ${{ github.actor }}"
PERMISSION=$(gh api \
repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission \
--jq .permission)
if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "maintain" ]]; then
echo "❌ User ${{ github.actor }} is not authorized to run this workflow"
exit 1
fi
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Enable Workflows except Import
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
workflows=$(gh api --paginate repos/${{ github.repository }}/actions/workflows --jq '.workflows[] | {id, name}')
echo "$workflows" | jq -c '. | select(.name | startswith("Import") | not)' | while read wf; do
id=$(echo "$wf" | jq '.id')
name=$(echo "$wf" | jq -r '.name')
gh api --method PUT repos/${{ github.repository }}/actions/workflows/$id/enable --silent
done
+68
Ver Arquivo
@@ -0,0 +1,68 @@
name: Import Subrepo PRs
on:
workflow_dispatch:
inputs:
subrepo-prefix:
description: "Superrepo path prefix (e.g., projects/rocblas)"
required: true
subrepo-pr-numbers:
description: "Commaseparated list of Subrepo PR numbers to import"
required: true
subrepo-repo:
description: "Full name of subrepo repo or fork (e.g., ROCm/rocBLAS or user/rocBLAS-fork)"
required: true
subrepo-upstream:
description: "Canonical subrepo repo (e.g., ROCm/rocBLAS)"
required: true
super-repo-target-branch:
description: "Target branch in the superrepo"
required: false
default: "develop"
jobs:
import-prs:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Generate GitHub App token
id: gen_token
uses: actions/create-github-app-token@v2.0.6
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout superrepo
uses: actions/checkout@v4
with:
token: ${{ steps.gen_token.outputs.token }}
fetch-depth: 0
sparse-checkout: |
.github/scripts/import_subrepo_prs.py
${{ github.event.inputs.subrepo-prefix }}
sparse-checkout-cone-mode: true
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install PyGithub GitPython
- name: Import Subrepo PRs
env:
GITHUB_TOKEN: ${{ steps.gen_token.outputs.token }}
SUBPREFIX: ${{ github.event.inputs.subrepo-prefix }}
SUBREPO: ${{ github.event.inputs.subrepo-repo }}
UPSTREAM: ${{ github.event.inputs.subrepo-upstream }}
TARGET: ${{ github.event.inputs.super-repo-target-branch }}
PR_LIST: ${{ github.event.inputs.subrepo-pr-numbers }}
run: |
python .github/scripts/import_subrepo_prs.py
+57
Ver Arquivo
@@ -0,0 +1,57 @@
name: Setup super-repo
on:
workflow_dispatch:
env:
SUPER_REPO_URL: github.com/ROCm/rocm-systems.git
SUPER_REPO_BRANCH: develop
jobs:
setup-super-repo:
runs-on: ubuntu-24.04
steps:
- name: Validate maintainer permissions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Actor is: ${{ github.actor }}"
PERMISSION=$(gh api \
repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission \
--jq .permission)
if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "maintain" ]]; then
echo "❌ User ${{ github.actor }} is not authorized to run this workflow"
exit 1
fi
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout the Super-repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Set up Git user and Git LFS
run: |
git config user.name "systems-assistant[bot]"
git config user.email "systems-assistant[bot]@users.noreply.github.com"
- name: Add Repositories to the Super-repo
run: |
for repo in $(cat .github/repos-config.json | jq -r '.repositories[].name'); do
repo_name=$(cat .github/repos-config.json | jq -r ".repositories[] | select(.name == \"$repo\") | .reponame")
url=$(cat .github/repos-config.json | jq -r ".repositories[] | select(.name == \"$repo\") | .url")
branch=$(cat .github/repos-config.json | jq -r ".repositories[] | select(.name == \"$repo\") | .branch")
category=$(cat .github/repos-config.json | jq -r ".repositories[] | select(.name == \"$repo\") | .category")
git subtree add --prefix "${category}/${repo}" https://github.com/${url}.git "$branch"
done
- name: Push changes to Super-repo
run: git push https://${{ env.SUPER_REPO_URL }} ${{ env.SUPER_REPO_BRANCH }}
+135
Ver Arquivo
@@ -0,0 +1,135 @@
# Import Issue Workflow
# ---------------------
# This workflow imports a single issue from a source repository into this super-repo repository,
# as part of a migration. It preserves key metadata including title, body, labels, and comment
# history with timestamps and authorship.
#
# Trigger: Manually via `workflow_dispatch` with the following inputs:
# - source_repo: Full source repository name (e.g., "ROCm/rocBLAS")
# - issue_number: Issue number in the source repository to import
#
# Steps:
# 1. Validate that the caller has 'admin' or 'maintain' permission on the super-repo
# 2. Fetch the issue body, title, labels, and comments using the GitHub CLI (`gh api`)
# 3. Create a new issue in the target repo, preserving:
# - Original title
# - Original body
# - All labels
# - A reference link back to the source issue
# 4. Recreate each comment from the original issue with:
# - Original comment body
# - Original author and timestamp
# 5. Post a comment on the original issue linking to the new one
#
# Notes:
# - This workflow requires GitHub App credentials (APP_ID and APP_PRIVATE_KEY)
# - Only issue metadata is migrated; cross-linked issues, reactions, assignees, and milestones are not yet handled
name: Import Subrepo Issue
on:
workflow_dispatch:
inputs:
source_repo:
description: 'Full name of subrepo repo (e.g., ROCm/rocBLAS)'
required: true
issue_number:
description: 'Issue number to import'
required: true
jobs:
import:
runs-on: ubuntu-24.04
permissions:
issues: write
contents: read
steps:
- name: Validate maintainer permissions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Actor is: ${{ github.actor }}"
PERMISSION=$(gh api \
repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission \
--jq .permission)
if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "maintain" ]]; then
echo "❌ User ${{ github.actor }} is not authorized to run this workflow"
exit 1
fi
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Fetch issue and comments from source repo
id: fetch
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
gh api "repos/${{ github.event.inputs.source_repo }}/issues/${{ github.event.inputs.issue_number }}" > issue.json
gh api "repos/${{ github.event.inputs.source_repo }}/issues/${{ github.event.inputs.issue_number }}/comments" > comments.json
- name: Create issue in target repo
id: create
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
TITLE=$(jq -r .title issue.json)
AUTHOR=$(jq -r .user.login issue.json)
BODY=$(jq -r .body issue.json)
LINK_TO_OLD="**[Migrated from original issue] ${{ github.event.inputs.source_repo }}#${{ github.event.inputs.issue_number }}**"
AUTHOR_LINE="*Original issue author: @$AUTHOR*"
FULL_BODY=$(printf "%b\n\n%b\n\n%s" "$LINK_TO_OLD" "$AUTHOR_LINE" "$BODY")
# Read labels into array
mapfile -t LABELS < <(jq -r '.labels[].name' issue.json)
# Prepare gh api args for labels
LABEL_ARGS=()
for label in "${LABELS[@]}"; do
LABEL_ARGS+=( -f "labels[]=$label" )
done
if [ ${#LABEL_ARGS[@]} -gt 0 ]; then
NEW_ISSUE_JSON=$(gh api repos/${{ github.repository }}/issues \
-f title="$TITLE" \
-f body="$FULL_BODY" \
"${LABEL_ARGS[@]}")
else
NEW_ISSUE_JSON=$(gh api repos/${{ github.repository }}/issues \
-f title="$TITLE" \
-f body="$FULL_BODY")
fi
echo "$NEW_ISSUE_JSON" > new_issue.json
echo "new_issue_number=$(jq -r .number new_issue.json)" >> "$GITHUB_OUTPUT"
- name: Recreate comments on new issue
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
jq -c '.[]' comments.json | while read -r comment; do
AUTHOR=$(echo "$comment" | jq -r .user.login)
CREATED_AT=$(echo "$comment" | jq -r .created_at)
BODY=$(echo "$comment" | jq -r .body | sed 's/"/\\"/g')
ORIG_AUTHOR="**Comment by @$AUTHOR on $CREATED_AT**"
FORMATTED_BODY=$(printf "%b\n\n%s" "$ORIG_AUTHOR" "$BODY")
gh api "repos/${{ github.repository }}/issues/${{ steps.create.outputs.new_issue_number }}/comments" \
-f body="$FORMATTED_BODY"
done
- name: Optionally comment back on original issue
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
COMMENT="This issue has been migrated to: https://github.com/${{ github.repository }}/issues/${{ steps.create.outputs.new_issue_number }}"
gh api "repos/${{ github.event.inputs.source_repo }}/issues/${{ github.event.inputs.issue_number }}/comments" \
-f body="$COMMENT"
+14
Ver Arquivo
@@ -0,0 +1,14 @@
name: Auto Label PR
on:
pull_request_target:
types: [opened, synchronize, reopened]
jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-24.04
steps:
- id: label-the-PR
uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
+40
Ver Arquivo
@@ -0,0 +1,40 @@
name: Merge CODEOWNERS Files
on:
workflow_dispatch:
jobs:
merge-codeowners:
runs-on: ubuntu-latest
permissions:
contents: write # Required to commit and push changes
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: pip install pyyaml
- name: Run merge script
run: python .github/scripts/merge-codeowners.py
- name: Commit and push if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .github/CODEOWNERS
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "chore: merge CODEOWNERS files"
git push
fi
+27
Ver Arquivo
@@ -0,0 +1,27 @@
name: Merge .gitmodules
on:
workflow_dispatch:
jobs:
combine-gitmodules:
runs-on: ubuntu-latest
steps:
- name: Checkout super-repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Run Merge Script
run: python .github/scripts/merge-submodules.py
- name: Commit Merged .gitmodules
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .gitmodules
git commit -m "Combine subrepo .gitmodules files into root" || echo "No changes"
git push
@@ -0,0 +1,58 @@
name: Setup additonal release subtrees for super-repo
on:
workflow_dispatch:
env:
SUPER_REPO_URL: github.com/ROCm/rocm-systems.git
SUPER_REPO_BRANCH: release/rocm-rel-7.0
jobs:
setup-super-repo:
runs-on: ubuntu-24.04
steps:
- name: Validate maintainer permissions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Actor is: ${{ github.actor }}"
PERMISSION=$(gh api \
repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission \
--jq .permission)
if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "maintain" ]]; then
echo "❌ User ${{ github.actor }} is not authorized to run this workflow"
exit 1
fi
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout the Super-repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ steps.generate-token.outputs.token }}
ref: ${{ env.SUPER_REPO_BRANCH }}
- name: Set up Git user and Git LFS
run: |
git config user.name "systems-assistant[bot]"
git config user.email "systems-assistant[bot]@users.noreply.github.com"
- name: Add Repositories to the Super-repo
run: |
for repo in $(cat .github/repos-added-config-release.json | jq -r '.repositories[].name'); do
repo_name=$(cat .github/repos-added-config-release.json | jq -r ".repositories[] | select(.name == \"$repo\") | .reponame")
url=$(cat .github/repos-added-config-release.json | jq -r ".repositories[] | select(.name == \"$repo\") | .url")
branch=$(cat .github/repos-added-config-release.json | jq -r ".repositories[] | select(.name == \"$repo\") | .branch")
category=$(cat .github/repos-added-config-release.json | jq -r ".repositories[] | select(.name == \"$repo\") | .category")
git subtree add --prefix "${category}/${repo}" https://github.com/${url}.git "$branch"
done
- name: Push changes to Super-repo
run: git push https://${{ env.SUPER_REPO_URL }} ${{ env.SUPER_REPO_BRANCH }}
+58
Ver Arquivo
@@ -0,0 +1,58 @@
name: Setup additonal subtrees for super-repo
on:
workflow_dispatch:
env:
SUPER_REPO_URL: github.com/ROCm/rocm-systems.git
SUPER_REPO_BRANCH: develop
jobs:
setup-super-repo:
runs-on: ubuntu-24.04
steps:
- name: Validate maintainer permissions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Actor is: ${{ github.actor }}"
PERMISSION=$(gh api \
repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission \
--jq .permission)
if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "maintain" ]]; then
echo "❌ User ${{ github.actor }} is not authorized to run this workflow"
exit 1
fi
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout the Super-repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ steps.generate-token.outputs.token }}
ref: ${{ env.SUPER_REPO_BRANCH }}
- name: Set up Git user and Git LFS
run: |
git config user.name "systems-assistant[bot]"
git config user.email "systems-assistant[bot]@users.noreply.github.com"
- name: Add Repositories to the Super-repo
run: |
for repo in $(cat .github/repos-added-config.json | jq -r '.repositories[].name'); do
repo_name=$(cat .github/repos-added-config.json | jq -r ".repositories[] | select(.name == \"$repo\") | .reponame")
url=$(cat .github/repos-added-config.json | jq -r ".repositories[] | select(.name == \"$repo\") | .url")
branch=$(cat .github/repos-added-config.json | jq -r ".repositories[] | select(.name == \"$repo\") | .branch")
category=$(cat .github/repos-added-config.json | jq -r ".repositories[] | select(.name == \"$repo\") | .category")
git subtree add --prefix "${category}/${repo}" https://github.com/${url}.git "$branch"
done
- name: Push changes to Super-repo
run: git push https://${{ env.SUPER_REPO_URL }} ${{ env.SUPER_REPO_BRANCH }}
+161
Ver Arquivo
@@ -0,0 +1,161 @@
# Import Subrepo PR Workflow
# --------------------------
# This workflow imports an open PR from a sub-repository into the super-repo.
# It is intended for maintainers to migrate pending pull requests from
# the subrepos, to help developers onboard to the super-repo sooner.
#
# Trigger: Manually via `workflow_dispatch` with the following inputs:
# - subrepo-prefix: Path within the super-repo where the subrepo lives (e.g., "projects/rocblas")
# - subrepo-pr-number: PR number in the subrepo to import
# - subrepo-repo: Full subrepo or fork name (e.g., "ROCm/rocBLAS" or "user/rocBLAS-fork")
# - subrepo-upstream: Canonical subrepo repo name (e.g., "ROCm/rocBLAS")
#
# Steps:
# 1. Validate that the caller has 'admin' or 'maintain' permission on the super-repo
# 2. Generate a GitHub App token for authenticated API access
# 3. Checkout only the necessary parts of the super-repo (sparse checkout)
# 4. Fetch PR metadata from the subrepo using GitHub CLI
# 5. Create a new branch and import the PR using `git subtree pull`
# 6. Create a corresponding draft PR in the super-repo with metadata preserved
#
# Notes:
# - This workflow requires GitHub App credentials (APP_ID and APP_PRIVATE_KEY)
# - The resulting super-repo PR is a draft and includes attribution to the original author
name: Import Subrepo PR
on:
workflow_dispatch:
inputs:
subrepo-prefix:
description: "super-repo path prefix (e.g., projects/rocblas)"
required: true
subrepo-pr-number:
description: "Subrepo PR number to import"
required: true
subrepo-repo:
description: "Full name of subrepo repo or fork (e.g., ROCm/rocBLAS or user/rocBLAS-fork)"
required: true
subrepo-upstream:
description: "Canonical subrepo repo (e.g., ROCm/rocBLAS)"
required: true
super-repo-target-branch:
description: "Target branch in the super-repo (default: develop)"
required: false
default: "develop"
jobs:
import:
runs-on: ubuntu-24.04
steps:
- name: Validate maintainer permissions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Actor is: ${{ github.actor }}"
PERMISSION=$(gh api \
repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission \
--jq .permission)
if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "maintain" ]]; then
echo "❌ User ${{ github.actor }} is not authorized to run this workflow"
exit 1
fi
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: |
.github
${{ github.event.inputs.subrepo-prefix }}
sparse-checkout-cone-mode: true
token: ${{ steps.generate-token.outputs.token }}
fetch-depth: 0 #for subtree operations
- name: Set up Git user
run: |
git config user.name "systems-assistant[bot]"
git config user.email "systems-assistant[bot]@users.noreply.github.com"
- name: Fetch subrepo PR info using gh
id: prdata
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
PR_JSON=$(gh pr view ${{ github.event.inputs.subrepo-pr-number }} \
--repo ${{ github.event.inputs.subrepo-upstream }} \
--json title,body,headRefName,headRepository,isDraft \
--jq '{title: .title, body: .body, head_ref: .headRefName, head_repo: .headRepository.cloneUrl, is_draft: .isDraft}')
echo "$PR_JSON" > pr.json
# properly escape backticks in title
TITLE=$(jq -r .title pr.json | sed 's/`/\\`/g')
echo "title=$TITLE" >> $GITHUB_OUTPUT
{
echo 'body<<EOF'
jq -r .body pr.json
echo 'EOF'
} >> $GITHUB_OUTPUT
echo "head_ref=$(jq -r .head_ref pr.json)" >> $GITHUB_OUTPUT
echo "head_repo=$(jq -r .head_repo pr.json)" >> $GITHUB_OUTPUT
echo "is_draft=$(jq -r .is_draft pr.json)" >> $GITHUB_OUTPUT
- name: Create new branch for import
id: import-branch
run: |
git fetch origin ${{ github.event.inputs.super-repo-target-branch }}
git checkout ${{ github.event.inputs.super-repo-target-branch }}
SANITIZED_BASE=$(echo "${{ github.event.inputs.super-repo-target-branch }}" | sed 's|/|_|g')
SANITIZED_REPO=$(echo "${{ github.event.inputs.subrepo-repo }}" | sed 's|/|_|g')
SANITIZED_REF=$(echo "${{ steps.prdata.outputs.head_ref }}" | sed 's|/|_|g')
IMPORT_BRANCH="import/${SANITIZED_BASE}/${SANITIZED_REPO}/${SANITIZED_REF}"
echo "import_branch=$IMPORT_BRANCH" >> $GITHUB_OUTPUT
git checkout -b "$IMPORT_BRANCH"
- name: Split subrepo prefix from main branch
run: |
git subtree pull --prefix=${{ github.event.inputs.subrepo-prefix }} https://github.com/${{ github.event.inputs.subrepo-repo }} ${{ steps.prdata.outputs.head_ref }}
git push origin ${{ steps.import-branch.outputs.import_branch }}
- name: Create super-repo PR
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
IMPORT_BRANCH="import/${{ github.event.inputs.subrepo-prefix }}/pr-${{ github.event.inputs.subrepo-pr-number }}"
PR_TITLE="${{ steps.prdata.outputs.title }}"
UPSTREAM_REPO="${{ github.event.inputs.subrepo-upstream }}"
SUBREPO_REPO="${{ github.event.inputs.subrepo-repo }}"
SUBREPO_PR_NUMBER="${{ github.event.inputs.subrepo-pr-number }}"
SUBREPO_URL="https://github.com/$UPSTREAM_REPO/pull/$SUBREPO_PR_NUMBER"
AUTHOR=$(gh pr view "$SUBREPO_PR_NUMBER" --repo "$UPSTREAM_REPO" --json author --jq .author.login)
echo "${{ steps.prdata.outputs.body }}" > pr_body.txt
{
echo ""
echo "---"
echo "🔁 Imported from [$UPSTREAM_REPO#$SUBREPO_PR_NUMBER]($SUBREPO_URL)"
echo "🧑‍💻 Originally authored by @$AUTHOR"
} >> pr_body.txt
DRAFT_FLAG=""
if [[ "${{ steps.prdata.outputs.is_draft }}" == "true" ]]; then
DRAFT_FLAG="--draft"
fi
gh pr create \
--base "${{ github.event.inputs.super-repo-target-branch }}" \
--head "${{ steps.import-branch.outputs.import_branch }}" \
--title "$PR_TITLE" \
--label "imported pr" \
$DRAFT_FLAG \
--body-file pr_body.txt
@@ -0,0 +1,109 @@
# Apply Patch to Subrepos After Merge (Manual Run)
# --------------------------------------------------
# This GitHub Actions workflow lets you manually run the patching logic for
# previously merged pull requests in the super-repo.
#
# It is useful for cases where the automatic patch workflow failed (e.g., due
# to fork PRs lacking secrets), or if configuration or credentials have changed.
#
# Key Steps:
# 1. Validate that the caller has 'admin' or 'maintain' permission on the super-repo.
# 2. Accept PR number as input.
# 3. Generate a GitHub App token for authentication.
# 4. Use a Python script to detect which subtrees were modified.
# 5. For each changed subtree:
# - Generate a patch from the merge commit for that subtree.
# - Determine the appropriate author (based on PR metadata or fallback).
# - Clone the target sub-repo and apply the patch.
# - Amend the commit message to include links to the super-repo PR and commit.
# - Push the commit directly to the sub-repo.
#
# This ensures downstream sub-repositories are updated to reflect changes
# made in the super-repo, even if the original automated job failed.
name: Manual Patch Rerun
on:
workflow_dispatch:
inputs:
pr:
description: 'Pull request number to rerun patch logic for'
required: true
jobs:
rerun-patch:
runs-on: ubuntu-24.04
steps:
- name: Validate maintainer permissions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Actor is: ${{ github.actor }}"
PERMISSION=$(gh api \
repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission \
--jq .permission)
if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "maintain" ]]; then
echo "❌ User ${{ github.actor }} is not authorized to run this workflow"
exit 1
fi
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: .github
sparse-checkout-cone-mode: true
token: ${{ steps.generate-token.outputs.token }}
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install pydantic requests
- name: Set up Git user
run: |
git config user.name "systems-assistant[bot]"
git config user.email "systems-assistant[bot]@users.noreply.github.com"
- name: Detect changed subtrees from merged PR
id: detect
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
python .github/scripts/pr_detect_changed_subtrees.py \
--repo "${{ github.repository }}" \
--pr "${{ github.event.inputs.pr }}" \
--config ".github/repos-config.json" \
--require-auto-push
- name: Checkout full repo with changed subtrees
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: |
.github
${{ steps.detect.outputs.subtrees }}
token: ${{ steps.generate-token.outputs.token }}
fetch-depth: 0
- name: Generate and apply patches
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
python .github/scripts/pr_merge_sync_patches.py \
--repo "${{ github.repository }}" \
--pr "${{ github.event.inputs.pr }}" \
--subtrees "${{ steps.detect.outputs.subtrees }}" \
--config ".github/repos-config.json" \
--debug
+127
Ver Arquivo
@@ -0,0 +1,127 @@
# Apply Patch to Subrepos After Merge
# -----------------------------------
# This GitHub Actions workflow runs on push commits. If it detects the push is from
# a pull request merged into the super-repo, then it continues to run the workflow.
# It identifies which subtrees (defined in .github/repos-config.json) were affected,
# generates a patch from the merge commit, and applies that patch to the corresponding
# sub-repositories by cloning them and committing the patch directly.
#
# Key Steps:
# 1. Generate a GitHub App token for authentication.
# 2. Checkout the super-repo at the merge commit.
# 3. Use a Python script to detect which subtrees were modified.
# 4. For each changed subtree:
# - Generate a patch from the merge commit for that subtree.
# - Determine the appropriate author (based on PR metadata or fallback).
# - Clone the target sub-repo and apply the patch.
# - Amend the commit message to include links to the super-repo PR and commit.
# - Push the commit directly to the sub-repo.
#
# This ensures downstream sub-repositories are updated to reflect changes
# made in the super-repo immediately after merge.
name: Merged PR to Patch Subrepos
on:
push:
branches:
- 'develop'
concurrency:
group: pr-merge-sync-patch-${{ github.sha }}
cancel-in-progress: false
jobs:
patch:
runs-on: ubuntu-24.04
outputs:
pr_number: ${{ steps.pr-check.outputs.pr }}
steps:
- name: Check if commit is a merged PR
id: pr-check
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "🔍 Checking if commit is a merged PR..."
PR_NUMBER=$(gh api repos/${{ github.repository }}/commits/${{ github.sha }}/pulls --jq '.[0].number')
if [ -z "$PR_NUMBER" ]; then
echo "❌ No PR found for commit ${{ github.sha }}. Skipping."
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "✅ Found PR #$PR_NUMBER"
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "pr=$PR_NUMBER" >> "$GITHUB_OUTPUT"
- name: Stop early if not a merged PR
if: steps.pr-check.outputs.skip == 'true'
run: echo "Skipping job."
- name: Generate a token
id: generate-token
if: steps.pr-check.outputs.skip != 'true'
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout config files only
if: steps.pr-check.outputs.skip != 'true'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: .github
sparse-checkout-cone-mode: true
token: ${{ steps.generate-token.outputs.token }}
- name: Set up Python
if: steps.pr-check.outputs.skip != 'true'
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
- name: Install python dependencies
if: steps.pr-check.outputs.skip != 'true'
run: |
python -m pip install --upgrade pip
pip install pydantic requests
- name: Set up Git user
if: steps.pr-check.outputs.skip != 'true'
run: |
git config user.name "systems-assistant[bot]"
git config user.email "systems-assistant[bot]@users.noreply.github.com"
- name: Detect changed subtrees from merged PR
id: detect
if: steps.pr-check.outputs.skip != 'true'
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
python .github/scripts/pr_detect_changed_subtrees.py \
--repo "${{ github.repository }}" \
--pr "${{ steps.pr-check.outputs.pr }}" \
--config ".github/repos-config.json" \
--require-auto-push
- name: Checkout full repo with changed subtrees
if: steps.detect.outputs.subtrees
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: |
.github
${{ steps.detect.outputs.subtrees }}
token: ${{ steps.generate-token.outputs.token }}
fetch-depth: 0
- name: Generate and apply patches
if: steps.detect.outputs.subtrees
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
python .github/scripts/pr_merge_sync_patches.py \
--repo "${{ github.repository }}" \
--pr "${{ steps.pr-check.outputs.pr }}" \
--subtrees "${{ steps.detect.outputs.subtrees }}" \
--config ".github/repos-config.json" \
--debug
+73
Ver Arquivo
@@ -0,0 +1,73 @@
# Label PRs by Author Org Membership
# -------------
# This workflow is designed to automatically label pull requests based on the author's membership in the ROCm organization.
name: "Label PRs by Author Org Membership"
on:
workflow_dispatch:
schedule:
- cron: "*/30 * * * *" # every 30 minutes
jobs:
label-prs:
if: github.repository == 'ROCm/rocm-systems'
runs-on: ubuntu-24.04
permissions:
contents: read
pull-requests: write
env:
ORG_TO_CHECK: ROCm
ORG_LABEL: "organization: ROCm"
EXTERNAL_LABEL: "external contribution"
steps:
- name: Generate GitHub App token
id: generate-token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: |
.github
${{ github.event.inputs.subrepo-prefix }}
sparse-checkout-cone-mode: true
token: ${{ steps.generate-token.outputs.token }}
fetch-depth: 0 #for subtree operations
- name: Get open PR numbers
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
gh pr list --state open --json number,labels \
--jq '[.[] | select(
([.labels[].name] | index(env.ORG_LABEL) | not) and
([.labels[].name] | index(env.EXTERNAL_LABEL) | not)
) | .number] | .[]' \
> pr_numbers.txt
- name: Label PRs based on author membership
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
while read pr; do
echo "Checking PR #$pr"
labels=$(gh pr view "$pr" --json labels --jq '.labels[].name')
if echo "$labels" | grep -qFx "${{ env.ORG_LABEL }}" || echo "$labels" | grep -qFx "${{ env.EXTERNAL_LABEL }}"; then
echo "PR #$pr already labeled, skipping."
continue
fi
author=$(gh pr view "$pr" --json author --jq '.author.login')
if gh api orgs/${{ env.ORG_TO_CHECK }}/members/$author --silent; then
gh pr edit "$pr" --add-label "${{ env.ORG_LABEL }}"
else
gh pr edit "$pr" --add-label "${{ env.EXTERNAL_LABEL }}"
fi
done < pr_numbers.txt
+103
Ver Arquivo
@@ -0,0 +1,103 @@
name: "Pre-commit Format & Lint"
on:
pull_request:
branches:
- testbranch
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
# - name: Generate a token
# id: generate-token
# uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e
# with:
# app-id: ${{ secrets.APP_ID }}
# private-key: ${{ secrets.APP_PRIVATE_KEY }}
# owner: ${{ github.repository_owner }}
- name: Checkout code (initial)
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
sparse-checkout: .github
sparse-checkout-cone-mode: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pydantic requests pre-commit
sudo apt-get update
sudo apt-get install -y clang-format
- name: Configure Git
run: |
git config user.name "systems-assistant[bot]"
git config user.email "systems-assistant[bot]@users.noreply.github.com"
- name: Detect changed subtrees
id: detect
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python .github/scripts/pr_detect_changed_subtrees.py \
--repo "${{ github.repository }}" \
--pr "${{ github.event.pull_request.number }}" \
--config ".github/repos-config.json"
- name: Checkout full repo with changed subtrees
if: steps.detect.outputs.subtrees
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
sparse-checkout: |
.github
${{ steps.detect.outputs.subtrees }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
submodules: false
- name: Get list of changed files
id: changed-files
shell: bash
run: |
git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1
changed=$(git diff --name-only FETCH_HEAD HEAD)
files=$(echo "$changed" | tr '\n' ' ' | sed 's/ *$//')
echo "all_modified_files=$files" >> $GITHUB_OUTPUT
- name: Show changed-files output
run: |
echo "Changed files are: ${{ steps.changed-files.outputs.all_modified_files }}"
- name: Disable submodule recursion
run: git config submodule.recurse false
- name: Run and auto-commit pre-commit fixes
env:
GIT_AUTHOR_NAME: "systems-assistant[bot]"
GIT_AUTHOR_EMAIL: "systems-assistant[bot]@users.noreply.github.com"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
var="${{ steps.changed-files.outputs.all_modified_files }}"
read -r -a files <<<"$var"
if [ ${#files[@]} -eq 0 ]; then
echo "No files changed, skipping pre-commit."
exit 0
fi
echo "Running pre-commit on these files:"
printf " %s\n" "${files[@]}"
set +e
pre-commit run --files "${files[@]}" --show-diff-on-failure
set -e
git add "${files[@]}"
git fetch origin "${{github.head_ref}}"
if ! git diff --cached --quiet; then
git commit -m "ci: apply pre-commit fixes"
git push --force-with-lease origin HEAD:${{ github.head_ref }}
fi
@@ -0,0 +1,213 @@
name: rocprofiler-compute Continuous Integration
run-name: rocprofiler-compute-ci
on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
inputs:
mode:
description: 'Build mode'
required: false
default: 'continuous'
type: choice
options:
- continuous
- nightly
push:
branches: [ develop ]
paths:
- '.github/workflows/rocprofiler-compute-continuous-integration.yml'
- 'projects/rocprofiler-compute/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/source/docs/**'
- '!projects/rocprofiler-compute/source/python/gui/**'
- '!projects/rocprofiler-compute/docker/**'
- '!projects/rocprofiler-compute/CMakePresets.json'
pull_request:
paths:
- '.github/workflows/rocprofiler-compute-continuous-integration.yml'
- 'projects/rocprofiler-compute/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/source/docs/**'
- '!projects/rocprofiler-compute/source/python/gui/**'
- '!projects/rocprofiler-compute/docker/**'
- '!projects/rocprofiler-compute/CMakePresets.json'
env:
ROCPROFSYS_CI: ON
ROCM_PATH: "/opt/rocm"
ROCM_VERSION: "7.0.0"
jobs:
prepare_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v5
with:
sparse-checkout: projects/rocprofiler-compute/.github
- name: Generate and output matrix
id: generate_matrix
working-directory: projects/rocprofiler-compute/.github
run: |
if [ '${{ github.event_name }}' = 'schedule' ] || [ '${{ inputs.mode }}' = 'nightly' ]; then
MATRIX_CONTENT=$(cat ci-matrix.yml | yq '.matrix-ubuntu-nightly' -I=0 -o=json)
else
MATRIX_CONTENT=$(cat ci-matrix.yml | yq '.matrix-ubuntu-ci' -I=0 -o=json)
fi
echo "matrix=${MATRIX_CONTENT}" >> $GITHUB_OUTPUT
ubuntu:
name: Ubuntu ${{ matrix.system.os-release }} • ${{ matrix.system.arch }}
needs: prepare_matrix
strategy:
fail-fast: false
matrix:
system: ${{ fromJSON(needs.prepare_matrix.outputs.matrix) }}
runs-on: ${{ matrix.system.runner }}
env:
HIP_PLATFORM: "amd"
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
permissions:
packages: read
container:
image: ghcr.io/rocm/rocprofiler-ubuntu:${{ matrix.system.os-release }}-systems-ci-${{ matrix.system.arch }}
options:
--privileged
--ipc host
--group-add video
--device /dev/kfd
--device /dev/dri
--cap-add CAP_SYS_ADMIN
steps:
- uses: actions/checkout@v5
with:
sparse-checkout: projects/rocprofiler-compute/
- name: Setup Environment
id: setup_env
run: |
if [ '${{ github.event_name }}' = 'schedule' ] || [ '${{ inputs.mode }}' = 'nightly' ]; then
MODE=Nightly
EXCLUDED_TESTS=""
ADD_COVERAGE="--coverage"
else
MODE=Continuous
EXCLUDED_TESTS="test_profile_live_attach_detach"
ADD_COVERAGE=""
fi
echo "mode=${MODE}" >> $GITHUB_OUTPUT
echo "excluded_tests=${EXCLUDED_TESTS}" >> $GITHUB_OUTPUT
echo "add_coverage=${ADD_COVERAGE}" >> $GITHUB_OUTPUT
if [ '${{ matrix.system.os-release }}' = '24.04' ]; then
CODE_NAME=noble
else
CODE_NAME=jammy
fi
echo "code_name=${CODE_NAME}" >> $GITHUB_OUTPUT
- name: Install amdgpu and dependencies
shell: bash
run: |
ROCM_MAJOR=$(echo ${{ env.ROCM_VERSION }} | sed 's/\./ /g' | awk '{print $1}')
ROCM_MINOR=$(echo ${{ env.ROCM_VERSION }} | sed 's/\./ /g' | awk '{print $2}')
ROCM_VERSN=$(( (${ROCM_MAJOR}*10000)+(${ROCM_MINOR}*100) ))
wget -N -P /tmp/ https://repo.radeon.com/amdgpu-install/${ROCM_MAJOR}.${ROCM_MINOR}/ubuntu/${{ steps.setup_env.outputs.code_name }}/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
apt-get install -y /tmp/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
apt-get update
apt install -y amd-smi-lib libdw-dev hip-dev
echo "✅ amdgpu and ROCm dependencies Installed!"
- name: Install Latest Nightly ROCm
run: |
set -e
TARBALL_ROCM_VERSION=$(ls /opt/*.tar.gz | grep -Eo '*([0-9]+\.[0-9]+\.[0-9]+)*')
tar -xf ${{ env.ROCM_PATH }}-${TARBALL_ROCM_VERSION}-${{ matrix.system.arch }}.tar.gz -C ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}
ln -s ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} ${{ env.ROCM_PATH }}
echo "ROCm installed to: ${{ env.ROCM_PATH }}"
echo "✅ ROCm Installation Complete!"
- name: Install Python Requirements
working-directory: projects/rocprofiler-compute
run: |
for i in 1 2 3; do
pip install -r requirements.txt --break-system-packages --ignore-installed --timeout 60 && break
echo "⚠️ pip install attempt $i failed, retrying..."
sleep 10
done
for i in 1 2 3; do
pip install -r requirements-test.txt --break-system-packages --ignore-installed --timeout 60 && break
echo "⚠️ pip install attempt $i failed, retrying..."
sleep 10
done
echo "✅ pip requirements installed!"
- name: Configure, Build, and Test
id: test
continue-on-error: true
timeout-minutes: ${{ steps.setup_env.outputs.mode == 'Nightly' && 120 || 90 }}
working-directory: projects/rocprofiler-compute
run: |
set -e
git config --global --add safe.directory ${GITHUB_WORKSPACE}
git config --global --add safe.directory ${PWD}
PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH \
LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:${{ env.ROCM_PATH }}/lib/rocm_sysdeps/lib:$LD_LIBRARY_PATH \
python3 ./tools/run-ci.py \
--name "ROCm/rocprofiler-compute-${{ github.ref_name }}-ubuntu-${{ matrix.system.os-release }}-${{ matrix.system.gpu }}" \
--actor "${{ github.actor }}" \
--site ${{ matrix.system.runner }} \
--mode ${{ steps.setup_env.outputs.mode }} \
--build-jobs 16 \
${{ steps.setup_env.outputs.add_coverage }} \
-- \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }} \
-DENABLE_TESTS=ON \
-DINSTALL_TESTS=ON \
-DPYTEST_NUMPROCS=8 \
-- \
-E "${{ steps.setup_env.outputs.excluded_tests }}"
- name: Output Logs
if: steps.test.outcome == 'failure'
working-directory: projects/rocprofiler-compute
run: |
echo "❌ Run Failed: Outputting available log files..."
for log in build/Testing/Temporary/LastTest*.log build/Testing/Temporary/LastConfigure*.log; do
if [ -f "$log" ]; then
echo "=== $log ==="
cat "$log"
fi
done
- name: Check Test Results
if: always()
shell: bash
run: |
if [[ "${{ steps.test.outcome }}" == "failure" ]]; then
echo "::error::Tests failed - see CDash for details: https://my.cdash.org/index.php?project=rocprofiler-compute"
exit 1
fi
echo "✅ All tests passed!"
@@ -0,0 +1,137 @@
name: rocprofiler-compute Formatting
on:
push:
branches:
- develop
paths:
- 'projects/rocprofiler-compute/**'
pull_request:
paths:
- '.github/workflows/rocprofiler-compute-formatting.yml'
- 'projects/rocprofiler-compute/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!docs/**'
- '!projects/*/docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
python:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-compute
- name: Set up Python '3.x'
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
working-directory: projects/rocprofiler-compute
run: |
python -m pip install --upgrade pip
python -m pip install ruff==0.14.11
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
- name: Run Ruff Linter and Import Sorter
run: |
ruff check . --fix --exit-zero
- name: Run Ruff Formatter
run: |
ruff format .
- name: Check for formatting/linting changes
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git add -A .
if ! git diff --cached --quiet; then
echo "::error::Files were modified by ruff. Please run 'ruff check . --fix && ruff format .' locally and commit the changes."
git diff --cached --patch # Show the diff in the logs
exit 1
else
echo "Ruff found no issues or all issues were fixed and files are clean."
fi
cmake:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-compute
- name: Install dependencies
working-directory: projects/rocprofiler-compute
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install gersemi
- name: gersemi
working-directory: projects/rocprofiler-compute
run: |
set +e
gersemi -i $(find . -type f | egrep 'CMakeLists.txt|\.cmake$')
if [ $(git diff | wc -l) -gt 0 ]; then
echo -e "\nError! CMake code not formatted. Run gersemi...\n"
echo -e "\nFiles:\n"
git diff --name-only
echo -e "\nFull diff:\n"
git diff
exit 1
fi
cxx:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-compute
- name: Install dependencies
working-directory: projects/rocprofiler-compute
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install clang-format
- name: clang-format
working-directory: projects/rocprofiler-compute
run: |
set +e
clang-format -i $(find src -type f | egrep '\.(h|hpp|hh|c|cc|cpp)(|\.in)$')
if [ $(git diff | wc -l) -gt 0 ]; then
echo -e "\nError! cxx code not formatted. Run clang-format...\n"
echo -e "\nFiles:\n"
git diff --name-only
echo -e "\nFull diff:\n"
git diff
exit 1
fi
python-bytecode:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-compute
- name: find-bytecode
working-directory: projects/rocprofiler-compute
run: |
set +e
FILES=$(find . -type f | egrep '__pycache__|\.pyc$')
if [ -n "${FILES}" ]; then
echo -e "\nError! Python bytecode included in commit\n"
echo -e "### FILES: ###"
echo -e "${FILES}"
echo -e "##############"
exit 1
fi
@@ -0,0 +1,136 @@
name: Publish GHCR Packages for rocprofiler-compute CI Images
on:
workflow_dispatch:
schedule:
- cron: 0 5 * * *
push:
branches:
- develop
paths:
- '.github/workflows/rocprofiler-compute-ghcr.yml'
- 'projects/rocprofiler-compute/docker/**'
pull_request:
paths:
- '.github/workflows/rocprofiler-compute-ghcr.yml'
- 'projects/rocprofiler-compute/docker/**'
jobs:
prepare_matrix_ci:
if: github.repository == 'ROCm/rocm-systems'
runs-on: ubuntu-latest
outputs:
matrix_data: ${{ steps.generate_matrix_ci.outputs.matrix_data }}
steps:
- uses: actions/checkout@v5
with:
sparse-checkout: projects/rocprofiler-compute/docker
- name: Output data for containers matrix
working-directory: projects/rocprofiler-compute/docker
id: generate_matrix_ci
run: |
MATRIX_CONTENT=$(cat containers-ci.yml | yq '.matrix' -I=0 -o=json)
echo "matrix_data=$MATRIX_CONTENT" >> $GITHUB_OUTPUT
rocprofiler-compute-ci-gfx:
needs: prepare_matrix_ci
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
system: ${{ fromJSON(needs.prepare_matrix_ci.outputs.matrix_data) }}
gpu: [ 'gfx94X', 'gfx950' ]
steps:
- name: Checkout Repository
uses: actions/checkout@v5
with:
sparse-checkout: projects/rocprofiler-compute
submodules: recursive
- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker variables
id: setup_vars_gfx
run: |
if [ ${{ matrix.system.distro }} = "opensuse" ]; then
DISTRO_IMAGE="opensuse/leap"
elif [ ${{ matrix.system.distro }} = "rhel" ]; then
DISTRO_IMAGE="rockylinux/rockylinux"
else
DISTRO_IMAGE=${{ matrix.system.distro }}
fi
echo "distro_image=${DISTRO_IMAGE}" >> $GITHUB_OUTPUT
if [ ${{ matrix.system.distro }} = "debian" ]; then
DOCKER_FILE=Dockerfile.ubuntu.ci
else
DOCKER_FILE=Dockerfile.${{ matrix.system.distro }}.ci
fi
echo "docker_file=${DOCKER_FILE}" >> $GITHUB_OUTPUT
- name: Get the latest build of The Rock tarball
id: therock
run: |
sudo apt-get install -y python3-pip
python3 -m pip install -U pip
python3 -m pip install -U awscli
export PATH=~/.local/bin:$PATH
KEY=$(aws s3api list-objects-v2 \
--bucket therock-nightly-tarball \
--no-sign-request \
--output json \
--query "sort_by(Contents[?contains(Key, 'linux-${{ matrix.gpu }}')], &LastModified)[-1].Key")
KEY=${KEY//\"/}
test -n "$KEY" || { echo "No ${{ matrix.gpu }} tarball found"; exit 1; }
echo "tarball=${KEY}" >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
with:
images: ghcr.io/ROCm/rocprofiler-${{ matrix.system.distro }}
- name: Build CI GFX Container (Does not Push on PR)
id: docker_build
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
file: projects/rocprofiler-compute/docker/${{ steps.setup_vars_gfx.outputs.docker_file }}
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
build-args: |
DISTRO=${{ steps.setup_vars_gfx.outputs.distro_image }}
VERSION=${{ matrix.system.version }}
GPU_TYPE=${{ matrix.gpu }}
GPU_TARBALL=${{ steps.therock.outputs.tarball }}
tags: |
ghcr.io/rocm/rocprofiler-${{ matrix.system.distro }}:${{ matrix.system.version }}-compute-ci-${{ matrix.gpu }}
labels: ${{ steps.meta.outputs.labels }}
# Retry a copy of docker_build if Docker build failed due to intermittent failure
- name: Build CI GFX Container Retry (Does not Push on PR)
if: steps.docker_build.outcome != 'success'
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
file: projects/rocprofiler-compute/docker/${{ steps.setup_vars_gfx.outputs.docker_file }}
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
build-args: |
DISTRO=${{ steps.setup_vars_gfx.outputs.distro_image }}
VERSION=${{ matrix.system.version }}
GPU_TYPE=${{ matrix.gpu }}
GPU_TARBALL=${{ steps.therock.outputs.tarball }}
tags: |
ghcr.io/rocm/rocprofiler-${{ matrix.system.distro }}:${{ matrix.system.version }}-compute-ci-${{ matrix.gpu }}
labels: ${{ steps.meta.outputs.labels }}
@@ -0,0 +1,121 @@
name: rocprofiler-compute RHEL
on:
push:
branches:
- develop
paths:
- '.github/workflows/rocprofiler-compute-rhel-8.yml'
- 'projects/rocprofiler-compute/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/docker/**'
pull_request:
paths:
- '.github/workflows/rocprofiler-compute-rhel-8.yml'
- 'projects/rocprofiler-compute/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/docker/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ROCM_VERSION: "7.2.0"
jobs:
build-rhel:
# The type of runner that the job will run on
# Using rocprofiler-systems images and later installing rocm, the official rocm images for al8 red hat variant are too large- this is a workaround.
runs-on: ubuntu-latest
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-rhel-${{ matrix.os-release }}
strategy:
fail-fast: false
matrix:
os-release: [ '8.10', '9.4' ]
build-type: ['Release']
# Steps represent a sequence of tasks that will be executed as part of the job
# Note- RHEL8 references python3.9 as python39, whereas RHEL9 default version is already 3.9, so we only need to call it as python3
steps:
- name: Install baseline OS dependencies
run: |
yum clean all
yum makecache
yum -y install git
if [ ${{ matrix.os-release }} == "8.10" ]; then
yum -y install python39
yum -y install python39-devel
alternatives --set python3 /usr/bin/python3.9
rm /usr/bin/python3.11
else
yum -y install python3-devel
fi
yum -y install cmake3
yum -y install which
yum -y install glibc-langpack-en
- name: Install ROCm Packages
timeout-minutes: 30
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 30
timeout_minutes: 30
max_attempts: 3
command: |
ROCM_MAJOR=$(echo ${{ env.ROCM_VERSION }} | sed 's/\./ /g' | awk '{print $1}')
ROCM_MINOR=$(echo ${{ env.ROCM_VERSION }} | sed 's/\./ /g' | awk '{print $2}')
ROCM_VERSN=$(( (${ROCM_MAJOR}*10000)+(${ROCM_MINOR}*100) ))
if [ ${{ matrix.os-release }} == "8.10" ]; then
yum install -y https://repo.radeon.com/amdgpu-install/${ROCM_MAJOR}.${ROCM_MINOR}/rhel/8.10/amdgpu-install-${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1.el8.noarch.rpm
else
yum install -y https://repo.radeon.com/amdgpu-install/${ROCM_MAJOR}.${ROCM_MINOR}/rhel/9.4/amdgpu-install-${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1.el9.noarch.rpm
fi
yum install -y rocm-dev
- name: Checkout
uses: actions/checkout@v5
with:
sparse-checkout: projects/rocprofiler-compute
- name: Install Python prereqs
working-directory: projects/rocprofiler-compute
run: |
python3 -m pip install -r requirements.txt
python3 -m pip install -r requirements-test.txt
python3 -m pip install cmake
- name: Configure and install
working-directory: projects/rocprofiler-compute
run: |
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-compute -DPYTEST_NUMPROCS=4 ..
make install
- name: CTest- Analyze Commands
working-directory: projects/rocprofiler-compute
run: |
cd build
ctest --verbose -R test_analyze_commands
- name: CTest- Analyze Workloads
working-directory: projects/rocprofiler-compute
run: |
cd build
ctest --verbose -R test_analyze_workloads
@@ -0,0 +1,165 @@
name: rocprofiler-compute tarball
on:
push:
branches:
- develop
paths:
- '.github/workflows/rocprofiler-compute-tarball.yml'
- 'projects/rocprofiler-compute/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/docker/**'
pull_request:
paths:
- '.github/workflows/rocprofiler-compute-tarball.yml'
- 'projects/rocprofiler-compute/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/docker/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ROCM_VERSION: "7.1.0"
jobs:
distbuild:
runs-on: ubuntu-latest
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-ubuntu-24.04
name: Create distribution tarball
env:
INSTALL_DIR: /tmp/foo1
steps:
- name: Set git sha mode
id: sha-mode
run: |
if [ "$EVENT" == 'pull_request' ]; then
echo "sha=${{github.event.pull_request.head.sha}}" >> $GITHUB_OUTPUT
else
echo "sha=$GITHUB_SHA" >> $GITHUB_OUTPUT
fi
- name: Checkout code
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-compute
ref: ${{ steps.sha-mode.sha }}
- name: Install ROCm Dependencies
shell: bash
run: |
ROCM_MAJOR=$(echo ${{ env.ROCM_VERSION }} | sed 's/\./ /g' | awk '{print $1}')
ROCM_MINOR=$(echo ${{ env.ROCM_VERSION }} | sed 's/\./ /g' | awk '{print $2}')
ROCM_VERSN=$(( (${ROCM_MAJOR}*10000)+(${ROCM_MINOR}*100) ))
wget -N -P /tmp/ https://repo.radeon.com/amdgpu-install/${ROCM_MAJOR}.${ROCM_MINOR}/ubuntu/noble/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
apt-get install -y /tmp/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
apt-get update
apt install -y rocm-dev
echo "✅ ROCm Dependencies Installed!"
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Python dependency installs
working-directory: projects/rocprofiler-compute
run: python3 -m pip install -t${INSTALL_DIR}/python-libs -r requirements.txt
- name: Configure
working-directory: projects/rocprofiler-compute
run: |
mkdir build
cd build
cmake -DPYTHON_DEPS=${INSTALL_DIR}/python-libs ..
- name: Release tarball
working-directory: projects/rocprofiler-compute
run: |
cd build
make package_source
- name: Archive tarball
uses: actions/upload-artifact@v4
with:
name: tarball-testing
path: projects/rocprofiler-compute/build/rocprofiler-compute-*.tar.gz
retention-days: 3
disttest:
runs-on: ubuntu-latest
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-ubuntu-24.04
needs: [distbuild]
name: Tarball tests
env:
INSTALL_DIR: /tmp/foo2
steps:
- name: Access tarball
uses: actions/download-artifact@v4
with:
name: tarball-testing
- name: Expand
run: tar xfz rocprofiler-compute-*.tar.gz; rm rocprofiler-compute-*.tar.gz
- name: Install ROCm Dependencies
shell: bash
run: |
ROCM_MAJOR=$(echo ${{ env.ROCM_VERSION }} | sed 's/\./ /g' | awk '{print $1}')
ROCM_MINOR=$(echo ${{ env.ROCM_VERSION }} | sed 's/\./ /g' | awk '{print $2}')
ROCM_VERSN=$(( (${ROCM_MAJOR}*10000)+(${ROCM_MINOR}*100) ))
wget -N -P /tmp/ https://repo.radeon.com/amdgpu-install/${ROCM_MAJOR}.${ROCM_MINOR}/ubuntu/noble/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
apt-get install -y /tmp/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
apt-get update
apt install -y rocm-dev
echo "✅ ROCm Dependencies Installed!"
- name: Python dependency installs
run: |
cd rocprofiler-compute-*
python3 -m pip install -t${INSTALL_DIR}/python-libs -r requirements.txt
- name: Configure
run: |
cd rocprofiler-compute-*
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}/rocprofiler-compute \
-DPYTHON_DEPS=${INSTALL_DIR}/python-libs ..
- name: Install
run: |
cd rocprofiler-compute-*
cd build
make install
- name: Verify expected paths
run: |
# find $INSTALL_DIR
test -d $INSTALL_DIR/rocprofiler-compute
test -x $INSTALL_DIR/rocprofiler-compute/bin/rocprof-compute
test -s $INSTALL_DIR/rocprofiler-compute/libexec/rocprofiler-compute/VERSION
test -s $INSTALL_DIR/rocprofiler-compute/libexec/rocprofiler-compute/VERSION.sha
test -d $INSTALL_DIR/rocprofiler-compute/libexec/rocprofiler-compute/rocprof_compute_analyze
test -d $INSTALL_DIR/rocprofiler-compute/libexec/rocprofiler-compute/rocprof_compute_profile
test -d $INSTALL_DIR/rocprofiler-compute/libexec/rocprofiler-compute/rocprof_compute_soc
test -d $INSTALL_DIR/rocprofiler-compute/libexec/rocprofiler-compute/utils
test -s $INSTALL_DIR/rocprofiler-compute/share/rocprofiler-compute/sample/vcopy.cpp
test -d $INSTALL_DIR/rocprofiler-compute/share/rocprofiler-compute/modulefiles
test -s $INSTALL_DIR/rocprofiler-compute/share/doc/rocprofiler-compute/LICENSE.md
- name: Query version (setting PYTHONPATH by hand)
run: |
export PYTHONPATH=${INSTALL_DIR}/python-libs:$PYTHONPATH
$INSTALL_DIR/rocprofiler-compute/bin/rocprof-compute --version
- name: Install Lmod
run: sudo apt-get install -y lmod
- name: Access rocprofiler-compute using modulefile
run: |
. /etc/profile.d/lmod.sh
module use $INSTALL_DIR/rocprofiler-compute/share/rocprofiler-compute/modulefiles
module load rocprofiler-compute
module list
rocprof-compute --version
@@ -0,0 +1,83 @@
name: rocprofiler-compute Ubuntu 22.04
on:
push:
branches:
- develop
paths:
- '.github/workflows/rocprofiler-compute-ubuntu-jammy.yml'
- 'projects/rocprofiler-compute/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/docker/**'
pull_request:
paths:
- '.github/workflows/rocprofiler-compute-ubuntu-jammy.yml'
- 'projects/rocprofiler-compute/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/docker/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-ubuntu-jammy:
# The type of runner that the job will run on
# https://hub.docker.com/r/rocm/dev-ubuntu-22.04/tags
runs-on: ubuntu-latest
container:
image: rocm/dev-ubuntu-22.04:7.1
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Install baseline OS dependencies
run: |
apt-get update
apt-get install -y git
apt-get install -y python3-pip
apt-get install -y cmake
- name: Checkout
uses: actions/checkout@v5
with:
sparse-checkout: projects/rocprofiler-compute
- name: Install Python prereqs
working-directory: projects/rocprofiler-compute
run: |
python3 -m pip install -r requirements.txt
python3 -m pip install -r requirements-test.txt
- name: Configure and install
working-directory: projects/rocprofiler-compute
run: |
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-compute -DPYTEST_NUMPROCS=4 ..
make install
- name: CTest- Analyze Commands
working-directory: projects/rocprofiler-compute
run: |
cd build
ctest --verbose -R test_analyze_commands
- name: CTest- Analyze Workloads
working-directory: projects/rocprofiler-compute
run: |
cd build
ctest --verbose -R test_analyze_workloads
@@ -0,0 +1,29 @@
name: rocprofiler GHCR Package Cleanup
on:
workflow_dispatch:
schedule:
# Runs daily at 6 AM UTC, 1 hour after the GHCR containers are updated
- cron: 0 6 * * *
pull_request:
paths:
- '.github/workflows/rocprofiler-ghcr-cleanup.yml'
jobs:
cleanup-rocprofiler-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
os: [ 'ubuntu', 'rhel', 'opensuse', 'debian' ]
steps:
- name: Clean up GHCR rocprofiler-${{ matrix.os }} Docker CI Images
uses: dataaxiom/ghcr-cleanup-action@v1
with:
package: rocprofiler-${{ matrix.os }}
older-than: 7 days
dry-run: ${{ github.event_name == 'pull_request' }}
@@ -0,0 +1,240 @@
name: rocprofiler-register Continuous Integration
on:
push:
branches:
- develop
paths:
- 'projects/rocprofiler-register/**'
- '.github/workflows/rocprofiler-register-continuous-integration.yml'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
pull_request:
paths:
- 'projects/rocprofiler-register/**'
- '.github/workflows/rocprofiler-register-continuous-integration.yml'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
strategy:
fail-fast: false
matrix:
compiler: ['clang-14', 'clang-15', 'gcc-11', 'gcc-12']
ci-args: ['']
ci-tag: ['']
include:
- compiler: 'gcc-12'
ci-args: '--coverage'
ci-tag: '-codecov'
- compiler: 'clang-15'
ci-args: '--linter clang-tidy'
ci-tag: '-clang-tidy'
- compiler: 'clang-13'
ci-args: ''
ci-tag: ''
- compiler: 'gcc-12'
ci-args: '--memcheck ThreadSanitizer'
ci-tag: '-thread-sanitizer'
- compiler: 'gcc-12'
ci-args: '--memcheck AddressSanitizer'
ci-tag: '-address-sanitizer'
- compiler: 'gcc-12'
ci-args: '--memcheck LeakSanitizer'
ci-tag: '-leak-sanitizer'
# - compiler: 'gcc-12'
# ci-args: '--memcheck UndefinedBehaviorSanitizer'
# ci-tag: '-undefined-behavior-sanitizer'
runs-on: linux-mi325-1gpu-ossci-rocm-frac
container:
image: docker.io/rocm/rocprofiler-private:ubuntu-22.04-gfx94X-latest
credentials:
username: ${{ secrets.ROCPROFILER_AZURE_CI_USER }}
password: ${{ secrets.ROCPROFILER_AZURE_CI_PASS }}
options: --privileged --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
env:
BUILD_TYPE: RelWithDebInfo
INSTALL_PREFIX: /opt/rocprofiler-register
PACKAGING_INSTALL_PREFIX: /opt/rocm
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
PATH: /usr/bin:$PATH
steps:
- name: Install Latest Nightly ROCm
shell: bash
working-directory: /tmp
run: |
tar -xf ${{ env.PACKAGING_INSTALL_PREFIX }}-gfx94X.tar.gz -C ${{ env.PACKAGING_INSTALL_PREFIX }}
echo "ROCm installed to: ${{ env.PACKAGING_INSTALL_PREFIX }}"
- name: Setup Git
shell: bash
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:git-core/ppa
apt update
apt install -y git
- uses: actions/checkout@v5
with:
sparse-checkout: projects/rocprofiler-register
submodules: true
set-safe-directory: true
- name: Install Packages
timeout-minutes: 25
run: |
cd projects/rocprofiler-register
CC=${{ matrix.compiler }} &&
CXX=$(echo ${{ matrix.compiler }} | sed 's/clang-/clang++-/1' | sed 's/gcc-/g++-/1') &&
apt-get update &&
apt-get install -y build-essential python3 environment-modules ${{ matrix.compiler }} ${CXX} &&
update-alternatives --install /usr/bin/cc cc /usr/bin/${CC} 100 &&
update-alternatives --install /usr/bin/c++ c++ /usr/bin/${CXX} 100 &&
python3 -m pip install --upgrade pip &&
python3 -m pip install 'cmake==3.22.0' &&
python3 -m pip install -r requirements.txt
- name: Setup GCov
timeout-minutes: 25
if: ${{ matrix.compiler == 'gcc-12' }}
run: |
cd projects/rocprofiler-register
update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-12 100
- name: Setup Clang-Tidy
timeout-minutes: 25
if: ${{ matrix.compiler == 'clang-15' }}
run: |
cd projects/rocprofiler-register
apt-get install -y clang-tidy-15
update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 100
- name: Configure, Build, and Test
timeout-minutes: 115
shell: bash
working-directory: projects/rocprofiler-register
run:
python3 ./scripts/run-ci.py -B build
--name ${{ github.repository_owner }}-${{ github.ref_name }}-azure-mi300x-${{ matrix.compiler }}${{ matrix.ci-tag }}
--build-jobs 2
--site GitHub
${{ matrix.ci-args }}
--disable-cdash
--
-DCMAKE_C_COMPILER=/usr/bin/cc
-DCMAKE_CXX_COMPILER=/usr/bin/c++
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
-DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PREFIX }}
-DROCPROFILER_REGISTER_BUILD_TESTS=ON
-DROCPROFILER_REGISTER_BUILD_SAMPLES=ON
--
-VV
- name: Install
timeout-minutes: 10
working-directory: projects/rocprofiler-register
run:
cmake --build build --target install --parallel 2
- name: CPack and Install
working-directory: projects/rocprofiler-register
run: |
cd build
cpack -G STGZ
rm -rf ${{ env.PACKAGING_INSTALL_PREFIX }}/lib/*rocprofiler-register* \
${{ env.PACKAGING_INSTALL_PREFIX }}/lib/cmake/*rocprofiler-register* \
${{ env.PACKAGING_INSTALL_PREFIX }}/share/*rocprofiler-register* \
${{ env.PACKAGING_INSTALL_PREFIX }}/libexec/*rocprofiler-register* \
${{ env.PACKAGING_INSTALL_PREFIX }}/include/rocprofiler-register
mkdir -p ${{ env.PACKAGING_INSTALL_PREFIX }}
./rocprofiler-register-*-Linux.sh --prefix=${{ env.PACKAGING_INSTALL_PREFIX }} --exclude-subdir --skip-license
ls -lah ${{ env.PACKAGING_INSTALL_PREFIX }}/lib
- name: Test Installed Packages
if: ${{ contains(matrix.compiler, 'clang-15') }}
timeout-minutes: 10
shell: bash
run: |
cd projects/rocprofiler-register
CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-tests-deb
cmake --build build-tests-deb --target all --parallel 16
export PATH=${{ env.PACKAGING_INSTALL_PREFIX }}/bin:$PATH
export LD_LIBRARY_PATH=${{ env.PACKAGING_INSTALL_PREFIX }}/lib:$LD_LIBRARY_PATH
ctest --test-dir build-tests-deb --output-on-failure
- name: Test Install Modulefile
timeout-minutes: 15
shell: bash
run: |
cd projects/rocprofiler-register
set -v
source /usr/share/modules/init/$(basename ${SHELL})
module use ${{ env.INSTALL_PREFIX }}/share/modulefiles
module avail
module load rocprofiler-register
pushd tests
BUILD_DIR=${PWD}/build-rocp-reg-modulefile
cmake -B ${BUILD_DIR} .
cmake --build ${BUILD_DIR} --target all
rm -rf ${BUILD_DIR}
- name: Test Install Setup Env
timeout-minutes: 15
shell: bash
run: |
cd projects/rocprofiler-register
set -v
source ${{ env.INSTALL_PREFIX }}/share/rocprofiler-register/setup-env.sh
pushd samples/library-implementation
BUILD_DIR=${PWD}/build-rocp-reg-setup-env
cmake -B ${BUILD_DIR} .
cmake --build ${BUILD_DIR} --target all
rm -rf ${BUILD_DIR}
- name: Test Install CPack Modulefile
timeout-minutes: 15
shell: bash
run: |
cd projects/rocprofiler-register
set -v
source /usr/share/modules/init/$(basename ${SHELL})
module use ${{ env.PACKAGING_INSTALL_PREFIX }}/share/modulefiles
module avail
module load rocprofiler-register
pushd tests
BUILD_DIR=${PWD}/build-rocp-reg-modulefile-cpack
cmake -B ${BUILD_DIR} .
cmake --build ${BUILD_DIR} --target all
rm -rf ${BUILD_DIR}
- name: Test Install CPack Setup Env
timeout-minutes: 15
shell: bash
run: |
cd projects/rocprofiler-register
set -v
source ${{ env.PACKAGING_INSTALL_PREFIX }}/share/rocprofiler-register/setup-env.sh
pushd samples/library-implementation
BUILD_DIR=${PWD}/build-rocp-reg-setup-env-cpack
cmake -B ${BUILD_DIR} .
cmake --build ${BUILD_DIR} --target all
rm -rf ${BUILD_DIR}
@@ -0,0 +1,85 @@
name: rocprofiler-sdk Build CI Docker Images
on:
workflow_dispatch:
schedule:
- cron: '0 7 * * *'
push:
branches: [ develop ]
paths:
- '.github/workflows/rocprofiler-sdk-build-ci-docker-images.yml'
- 'projects/rocprofiler-sdk/docker/Dockerfile.ci'
pull_request:
paths:
- '.github/workflows/rocprofiler-sdk-build-ci-docker-images.yml'
- 'projects/rocprofiler-sdk/docker/Dockerfile.ci'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Needed to push/pull cached Docker layers + GHCR images
permissions:
contents: read
packages: write
jobs:
# -----------------------------------------------------------------------------
# Build a cached CI base image per OS using Buildx + GHA cache (Item #6)
# -----------------------------------------------------------------------------
build-ci-base:
name: Build CI Base Image • ${{ matrix.gpu }} • ${{ matrix.os }}
runs-on: azure-linux-scale-rocm
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-22.04', 'rhel-8.8', 'rhel-9.5', 'sles-15.6' ]
gpu: [ 'gfx94X', 'gfx950', 'gfx110X', 'gfx120X' ]
steps:
- name: Checkout (shallow)
uses: actions/checkout@v4
with:
sparse-checkout: |
projects/rocprofiler-sdk/requirements.txt
projects/rocprofiler-sdk/docker/Dockerfile.ci
- name: Get the latest therock build
id: therock
run: |
sudo apt-get update
sudo apt-get install -y python3-pip python3-venv
python3 -m venv /tmp/awscli-venv
/tmp/awscli-venv/bin/python -m pip install -U pip awscli
KEY=$(/tmp/awscli-venv/bin/aws s3api list-objects-v2 \
--bucket therock-nightly-tarball \
--no-sign-request \
--output json \
--query "sort_by(Contents[?contains(Key, 'linux-${{ matrix.gpu }}')], &LastModified)[-1].Key")
KEY=${KEY//\"/}
test -n "$KEY" || { echo "No ${{ matrix.gpu }} tarball found"; exit 1; }
echo "tarball=${KEY}" >> $GITHUB_OUTPUT
- name: Login to Docker Hub
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with:
registry: docker.io
username: ${{ secrets.ROCPROFILER_AZURE_CI_USER }}
password: ${{ secrets.ROCPROFILER_AZURE_CI_PASS }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Build & Push (to Docker Hub; cache to GHA)
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
file: projects/rocprofiler-sdk/docker/Dockerfile.ci
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
build-args: |
BASE_TAG=${{ matrix.os }}
GPU_TYPE=${{ matrix.gpu }}
GPU_TARBALL=${{ steps.therock.outputs.tarball }}
tags: |
docker.io/rocm/rocprofiler-private:${{ matrix.os }}-${{ matrix.gpu }}-latest
cache-from: type=gha,scope=rocprofiler-ci-${{ matrix.os }}-${{ matrix.gpu }}
cache-to: type=gha,mode=max,scope=rocprofiler-ci-${{ matrix.os }}-${{ matrix.gpu }}
@@ -0,0 +1,556 @@
name: rocprofiler-sdk Code Coverage
permissions:
contents: read
pull-requests: write
on:
workflow_dispatch:
push:
branches:
- develop
paths:
- 'projects/rocprofiler-sdk/**'
- '.github/workflows/rocprofiler-sdk-code_coverage.yml'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
pull_request:
paths:
- 'projects/rocprofiler-sdk/**'
- '.github/workflows/rocprofiler-sdk-code_coverage.yml'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# TODO(jrmadsen): replace LD_RUNPATH_FLAG, GPU_TARGETS, etc. with internal handling in cmake
ROCM_PATH: "/opt/rocm"
ROCM_VERSION: "7.0.0"
GPU_TARGETS: "gfx906 gfx908 gfx90a gfx942 gfx950 gfx1030 gfx1100 gfx1101 gfx1102 gfx1201"
PATH: "/usr/bin:$PATH"
## No tests should be excluded here except for extreme emergencies; tests should only be disabled in CMake
## A task should be assigned directly to fix the issue
## Scratch memory tests need to be fixed for ROCm 7.0 release
navi3_EXCLUDE_TESTS_REGEX: ""
vega20_EXCLUDE_TESTS_REGEX: ""
mi200_EXCLUDE_TESTS_REGEX: ""
mi300_EXCLUDE_TESTS_REGEX: ""
mi300a_EXCLUDE_TESTS_REGEX: ""
mi325_EXCLUDE_TESTS_REGEX: ""
mi3xx_EXCLUDE_TESTS_REGEX: ""
navi4_EXCLUDE_TESTS_REGEX: ""
navi3_EXCLUDE_LABEL_REGEX: ""
vega20_EXCLUDE_LABEL_REGEX: ""
mi200_EXCLUDE_LABEL_REGEX: ""
mi300_EXCLUDE_LABEL_REGEX: ""
mi300a_EXCLUDE_LABEL_REGEX: ""
mi325_EXCLUDE_LABEL_REGEX: ""
mi3xx_EXCLUDE_LABEL_REGEX: ""
navi4_EXCLUDE_LABEL_REGEX: ""
GLOBAL_CMAKE_OPTIONS: ""
ENABLE_ROCR_BUILD: "true"
ENABLE_HIP_CLR_BUILD: "true"
jobs:
code-coverage:
# TEMPORARILY DISABLED: pending CI stabilization
if: false
name: Code Coverage • ${{ matrix.system.gpu }} • ${{ matrix.system.os }}
strategy:
# fail-fast: false
matrix:
system:
- { gpu: 'mi300a', runner: 'rocprofiler-mi300a-dind', os: 'ubuntu-22.04', build-type: 'Release', gpu-target: 'gfx94X' }
runs-on: ${{ matrix.system.runner }}
container:
image: docker.io/rocm/rocprofiler-private:${{ matrix.system.os }}-${{ matrix.system.gpu-target }}-latest
credentials:
username: ${{ secrets.ROCPROFILER_AZURE_CI_USER }}
password: ${{ secrets.ROCPROFILER_AZURE_CI_PASS }}
env:
DEBIAN_FRONTEND: noninteractive
options: --privileged --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
GPU_RUNNER: ${{ matrix.system.runner }}
GCC_COMPILER_VERSION: 11
ROCPROFILER_PC_SAMPLING_BETA_ENABLED: 1
steps:
- name: Install Latest Nightly ROCm
shell: bash
working-directory: /tmp
run: |
tar -xf ${{ env.ROCM_PATH }}-${{ matrix.system.gpu-target }}.tar.gz -C ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}
ln -s ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} ${{ env.ROCM_PATH }}
echo "ROCm installed to: ${{ env.ROCM_PATH }}"
- name: Clone ROCProfiler SDK & AQLProfile & ROCProfiler Register & ROCR-Runtime
uses: actions/checkout@v5
with:
sparse-checkout: |
projects/rocprofiler-sdk
projects/aqlprofile
projects/rocprofiler-register
projects/rocr-runtime
projects/clr
projects/hip
submodules: false
set-safe-directory: true
- name: Compute submodule cache key
id: submods
shell: bash
run: |
git config --global --add safe.directory '*'
git submodule status --recursive | awk '{print $1,$2}' > .git-submodules-status
echo "hash=$(sha256sum .git-submodules-status | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
# collect submodule paths for cache 'path'
git config --file .gitmodules --get-regexp path | awk '{print $2}' > .git-submodule-paths
{ echo "paths<<EOF"; cat .git-submodule-paths; echo "EOF"; } >> "$GITHUB_OUTPUT"
- name: Restore submodule cache
uses: actions/cache@v4
with:
path: |
.git/modules
${{ steps.submods.outputs.paths }}
key: submods-${{ runner.os }}-${{ steps.submods.outputs.hash }}
restore-keys: |
submods-${{ runner.os }}-
submods-
- name: Init/Update submodules
run: git submodule update --init --recursive --jobs 16
- name: Clone ROCDecode
uses: actions/checkout@v5
with:
repository: 'ROCm/rocDecode'
ref: 'release/rocm-rel-7.0'
set-safe-directory: true
path: 'rocDecode'
- name: Clone ROCJPEG
uses: actions/checkout@v5
with:
repository: 'ROCm/rocJPEG'
ref: 'release/rocm-rel-7.0'
set-safe-directory: true
path: 'rocJPEG'
- name: Load Existing XML Code Coverage
if: github.event_name == 'pull_request'
id: load-coverage
uses: actions/cache@v4
with:
key: ${{ github.event.pull_request.base.sha }}-codecov
path: .codecov/**
- name: Copy Existing XML Code Coverage
if: github.event_name == 'pull_request'
shell: bash
run: |
if [ -d .codecov ]; then cp -r .codecov .codecov.ref; fi
- name: Configure Env
shell: bash
run: |
echo "${PATH}:/usr/local/bin:${HOME}/.local/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:${HOME}/.local/lib" >> $GITHUB_ENV
- name: Install requirements
timeout-minutes: 10
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
git config --global --add safe.directory '*'
apt-get update
apt-get install -y build-essential cmake python3-pip gcovr wkhtmltopdf xvfb xfonts-base xfonts-75dpi xfonts-100dpi xfonts-utils xfonts-encodings libfontconfig libdw-dev libsqlite3-dev libdrm-dev file autoconf pkg-config rpm libzstd-dev
python3 -m pip install -U --user -r requirements.txt
rm -rf \
${{ env.ROCM_PATH }}/lib/*rocprofiler-sdk* \
${{ env.ROCM_PATH }}/lib/cmake/*rocprofiler-sdk* \
${{ env.ROCM_PATH }}/share/*rocprofiler-sdk* \
${{ env.ROCM_PATH }}/libexec/*rocprofiler-sdk* \
${{ env.ROCM_PATH }}*/lib/python*/site-packages/roctx \
${{ env.ROCM_PATH }}*/lib/python*/site-packages/rocpd
- name: Sync gcov with compilers
timeout-minutes: 10
shell: bash
run:
apt-get install -y gcc-${{ env.GCC_COMPILER_VERSION }} g++-${{ env.GCC_COMPILER_VERSION }} &&
update-alternatives
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_COMPILER_VERSION }} 500
--slave /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_COMPILER_VERSION }}
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_COMPILER_VERSION }}
- name: List Files
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
echo "PATH: ${PATH}"
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
cat ${{ env.ROCM_PATH }}/.info/version
ls -la
- name: Enable PC Sampling
if: ${{ contains(matrix.system.gpu, 'mi200') || contains(matrix.system.gpu, 'mi300a') }}
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
- name: Setup ccache
uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
with:
key: ccache-${{ matrix.system.os }}-${{ matrix.system.runner }}-${{ matrix.system.gpu }}
max-size: 2G
save: true
- name: Install Missing ROCm Dependencies
shell: bash
run: |
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:/usr/local/bin:~/.local/bin:$PATH
echo -e "Building & Installing ROCDecode..."
cmake -B build-rocdecode \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }} \
-DCMAKE_CXX_COMPILER=${{ env.ROCM_PATH }}/bin/amdclang++ \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
${GITHUB_WORKSPACE}/rocDecode
cmake --build build-rocdecode --target all --parallel 16
cmake --build build-rocdecode --target install
echo -e "ROCDecode Installed Successfully!"
echo -e "Building & Installing ROCJPEG..."
cmake -B build-rocjpeg \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }} \
-DCMAKE_CXX_COMPILER=${{ env.ROCM_PATH }}/bin/amdclang++ \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
${GITHUB_WORKSPACE}/rocJPEG
cmake --build build-rocjpeg --target all --parallel 16
cmake --build build-rocjpeg --target install
echo -e "ROCJPEG Installed Successfully!"
- name: Build and Install ROCProfiler-Register
shell: bash
working-directory: projects/rocprofiler-register
run: |
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:/usr/local/bin:~/.local/bin:$PATH
echo "Install ROCProfiler-Register"
cmake -B build-rocprofiler-register \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
.
cmake --build build-rocprofiler-register --target all --parallel 16
cmake --build build-rocprofiler-register --target install
echo "✅ ROCProfiler-Register Installation complete!"
- name: Build and Install ROCR-Runtime
if: ${{ env.ENABLE_ROCR_BUILD == 'true' }}
shell: bash
working-directory: projects/rocr-runtime
run: |
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:/usr/local/bin:~/.local/bin:$PATH
echo "Install ROCR-Runtime..."
cmake -B build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }};${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}/llvm' \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
.
cmake --build build --target all --parallel 16
cmake --build build --target install
echo "✅ ROCR-Runtime Installation complete!"
- name: Build and Install HIP
if: ${{ env.ENABLE_HIP_CLR_BUILD == 'true' }}
shell: bash
working-directory: projects
run: |
export HIP_DIR=$PWD/hip
export CLR_DIR=$PWD/clr
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH
echo "Install HIP..."
cd $CLR_DIR
cmake \
-DHIP_COMMON_DIR=$HIP_DIR \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DHIP_PLATFORM=amd \
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }};${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}/llvm' \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DHIP_LLVM_ROOT=${{ env.ROCM_PATH }}/lib/llvm \
-DHIP_CATCH_TEST=0 \
-DCLR_BUILD_HIP=ON \
-DCLR_BUILD_OCL=ON \
-S $CLR_DIR \
-B build
cmake --build build --target all --parallel 16
cmake --build build --target install
echo "✅ HIP Installation complete!"
- name: Build and Install Aqlprofile
shell: bash
working-directory: projects/aqlprofile
run: |
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:/usr/local/bin:~/.local/bin:$PATH
echo "Install Aqlprofile..."
cmake -B build-aqlprofile \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
.
cmake --build build-aqlprofile --target all --parallel 16
cmake --build build-aqlprofile --target install
echo "✅ AQLProfile Installation complete!"
- name: Configure, Build, and Test (Total Code Coverage)
timeout-minutes: 30
shell: bash
working-directory: projects/rocprofiler-sdk
run:
LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-codecov
--build-jobs 16
--site ${{ matrix.system.runner }}
--gpu-targets ${{ env.GPU_TARGETS }}
--coverage all
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }}
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm'
-DPython3_EXECUTABLE=$(which python3)
${{ env.GLOBAL_CMAKE_OPTIONS }}
--
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}"
- name: Configure, Build, and Test (Tests Code Coverage)
timeout-minutes: 30
shell: bash
working-directory: projects/rocprofiler-sdk
run:
find build -type f | egrep '\.gcda$' | xargs rm &&
LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-codecov-tests
--build-jobs 16
--site ${{ matrix.system.runner }}
--gpu-targets ${{ env.GPU_TARGETS }}
--coverage tests
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }}
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm'
-DPython3_EXECUTABLE=$(which python3)
${{ env.GLOBAL_CMAKE_OPTIONS }}
--
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}"
- name: Configure, Build, and Test (Samples Code Coverage)
timeout-minutes: 30
working-directory: projects/rocprofiler-sdk
shell: bash
run:
find build -type f | egrep '\.gcda$' | xargs rm &&
LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-codecov-samples
--build-jobs 16
--site ${{ matrix.system.runner }}
--gpu-targets ${{ env.GPU_TARGETS }}
--coverage samples
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }}
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm'
-DPython3_EXECUTABLE=$(which python3)
${{ env.GLOBAL_CMAKE_OPTIONS }}
--
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}"
- name: Save XML Code Coverage
id: save-coverage
uses: actions/cache/save@v4
with:
key: ${{ github.sha }}-codecov
path: |
projects/rocprofiler-sdk/.codecov/*.xml
- id: generatereport
name: Generate Code Coverage Comment
if: github.event_name == 'pull_request'
timeout-minutes: 5
working-directory: projects/rocprofiler-sdk
shell: bash
run: |
echo "PWD: ${PWD}"
ls -la
for i in "all" "tests" "samples"; do
wkhtmltoimage --enable-local-file-access --quality 70 .codecov/${i}.html .codecov/${i}.png
done
ls -la .codecov
which -a git
git --version
./source/scripts/upload-image-to-github.py --bot --token ${{ secrets.ROCPROFILER_TOKEN }} --files .codecov/{all,tests,samples}.png --output-dir .codecov --name pr-${{ github.event.pull_request.number }}
echo -e "\n${PWD}:"
ls -la .
echo -e "\n.codecov:"
ls -la .codecov
get-base-md-contents() { cat .codecov/${1}.png.md; }
get-full-md-contents() { cat .codecov/${1}.png.md .codecov/${1}.md; }
cat << EOF > .codecov/report.md
# Code Coverage Report
## Tests Only
$(get-base-md-contents tests)
## Samples Only
$(get-base-md-contents samples)
## Tests + Samples
$(get-base-md-contents all)
<!-- code-coverage-comment-identifier -->
EOF
echo 'CODECOVERAGE_REPORT<<EOF' > $GITHUB_OUTPUT
cat .codecov/report.md >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Write Code Coverage Comment
if: github.event_name == 'pull_request'
timeout-minutes: 5
uses: actions/github-script@v6
env:
COMMENT_BODY: |
<details>
<summary><h2>Code Coverage Report</h2></summary>
<!-- Keep the empty line above to render markdown properly -->
${{ steps.generatereport.outputs.CODECOVERAGE_REPORT }}
</details>
with:
github-token: ${{ secrets.ROCPROFILER_TOKEN }}
script: |
const commentIdentifier = '<!-- code-coverage-comment-identifier -->'; // Used to identify codecov comment
const commentBody = process.env.COMMENT_BODY;
// Fetch existing comments
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
});
// Check for an existing comment
const existingComment = comments.find(comment => comment.body.includes(commentIdentifier));
if (existingComment) {
// Update the existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body: commentBody,
});
core.info(`Updated comment with ID: ${existingComment.id}`);
} else {
// Create a new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: commentBody,
});
core.info('Created a new comment.');
}
- name: Archive Code Coverage Data
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v4
with:
name: code-coverage-details
path: |
${{github.workspace}}/projects/rocprofiler-sdk/.codecov/*
- name: Verify Test Labels
timeout-minutes: 5
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
pushd build
#
# if following fails, there is a test that does not have
# a label identifying it as sample or test (unit or integration).
# Recommended labels are:
# - samples
# - unittests
# - integration-tests
#
ctest -N -LE 'samples|tests' -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" -O ctest.mislabeled.log
grep 'Total Tests: 0' ctest.mislabeled.log
#
# if following fails, then there is overlap between the labels.
# A test cannot both be a sample and (unit/integration) test.
#
ctest -N -O ctest.all.log
ctest -N -O ctest.samples.log -L samples
ctest -N -O ctest.tests.log -L tests
NUM_ALL=$(grep 'Total Tests:' ctest.all.log | awk '{print $NF}')
NUM_SAMPLE=$(grep 'Total Tests:' ctest.samples.log | awk '{print $NF}')
NUM_TEST=$(grep 'Total Tests:' ctest.tests.log | awk '{print $NF}')
NUM_SUM=$((${NUM_SAMPLE} + ${NUM_TEST}))
echo "Total tests: ${NUM_ALL}"
echo "Total labeled tests: ${NUM_SUM}"
if [ ${NUM_ALL} != ${NUM_SUM} ]; then
echo "Test label overlap"
exit 1
fi
popd
+158
Ver Arquivo
@@ -0,0 +1,158 @@
name: rocprofiler-sdk Advanced Analysis
on:
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/rocprofiler-sdk-codeql.yml'
- 'projects/rocprofiler-sdk/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
push:
branches:
- develop
paths:
- '.github/workflows/rocprofiler-sdk-codeql.yml'
- 'projects/rocprofiler-sdk/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
env:
ROCM_PATH: "/opt/rocm"
GPU_TARGETS: "gfx906;gfx908;gfx90a;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1102;gfx1201"
PATH: "/usr/bin:$PATH"
EXCLUDED_PATHS: "external /tmp/build/external"
GLOBAL_CMAKE_OPTIONS: "-DROCPROFILER_INTERNAL_RCCL_API_TRACE=ON"
ENABLE_HIP_CLR_BUILD: "false"
jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ubuntu-latest
container: rocm/dev-ubuntu-22.04:latest
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
# cpp analysis disabled - takes too long and frequently times out
# - language: cpp
# build-mode: manual
- language: python
build-mode: none
- language : actions
build-mode: none
steps:
- name: Install requirements
timeout-minutes: 10
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt update -y
sudo apt upgrade -y
sudo apt install -y software-properties-common wget rocm-llvm-dev
sudo apt-add-repository ppa:git-core/ppa
wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
sudo tee /etc/apt/sources.list.d/rocm.list << EOF
deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.1 jammy main
deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/graphics/7.1/ubuntu jammy main
EOF
sudo apt update -y
sudo apt upgrade -y
sudo apt install -y git build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev rccl-dev libva-amdgpu-dev rocdecode-dev rocjpeg-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
git config --global --add safe.directory '*'
- uses: actions/checkout@v4
with:
sparse-checkout: |
projects/rocprofiler-sdk
projects/clr
projects/hip
.github/workflows/rocprofiler-sdk-codeql.yml
.github/workflows/rocprofiler-sdk-formatting.yml
submodules: 'true'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
queries: security-extended
- name: Build and Install HIP
if: ${{ env.ENABLE_HIP_CLR_BUILD == 'true' }}
shell: bash
working-directory: projects
run: |
export HIP_DIR=$PWD/hip
export CLR_DIR=$PWD/clr
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH
echo "Install HIP..."
cd $CLR_DIR
pip install CppHeaderParser
cmake \
-DHIP_COMMON_DIR=$HIP_DIR \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DHIP_PLATFORM=amd \
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm' \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }} \
-DHIP_LLVM_ROOT=${{ env.ROCM_PATH }}/lib/llvm \
-DHIP_CATCH_TEST=0 \
-DCLR_BUILD_HIP=ON \
-DCLR_BUILD_OCL=ON \
-S $CLR_DIR \
-B build
cmake --build build --target all --parallel 8
cmake --build build --target install
echo "✅ HIP Installation complete!"
- name: Configure and Build
timeout-minutes: 30
shell: bash
run: |
cd projects/rocprofiler-sdk
python3 -m pip install -r requirements.txt
cmake -B /tmp/build -DCMAKE_PREFIX_PATH=/opt/rocm ${{ env.GLOBAL_CMAKE_OPTIONS }} -DPython3_EXECUTABLE=$(which python3) .
cmake --build /tmp/build --target all --parallel 16
rm -rf ${EXCLUDED_PATHS}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
@@ -0,0 +1,873 @@
name: rocprofiler-sdk Continuous Integration
on:
workflow_dispatch:
schedule:
- cron: '0 7 * * *'
push:
branches: [ develop ]
paths:
- 'projects/rocprofiler-sdk/**'
- '.github/workflows/rocprofiler-sdk-continuous_integration.yml'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
pull_request:
paths:
- 'projects/rocprofiler-sdk/**'
- '.github/workflows/rocprofiler-sdk-continuous_integration.yml'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Needed to push/pull cached Docker layers + GHCR images
permissions:
contents: read
packages: write
env:
# TODO(jrmadsen): replace LD_RUNPATH_FLAG, GPU_TARGETS, etc. with internal handling in cmake
ROCM_PATH: "/opt/rocm"
ROCM_VERSION: "7.2.0"
PYTHON_VENV_PATH: "rocprofiler-sdk"
PYTHON_VENV_ACTIVATE: "rocprofiler-sdk/bin/activate"
GPU_TARGETS: "gfx906 gfx908 gfx90a gfx942 gfx950 gfx1030 gfx1100 gfx1101 gfx1102 gfx1201"
PATH: "/usr/bin:$PATH"
## No tests should be excluded here except for extreme emergencies; tests should only be disabled in CMake
## A task should be assigned directly to fix the issues
## Scratch memory tests need to be fixed for ROCm 7.0 release
navi3_EXCLUDE_TESTS_REGEX: ""
vega20_EXCLUDE_TESTS_REGEX: ""
mi200_EXCLUDE_TESTS_REGEX: ""
mi300_EXCLUDE_TESTS_REGEX: ""
mi300a_EXCLUDE_TESTS_REGEX: ""
mi325_EXCLUDE_TESTS_REGEX: ""
mi3xx_EXCLUDE_TESTS_REGEX: ""
navi4_EXCLUDE_TESTS_REGEX: ""
navi3_EXCLUDE_LABEL_REGEX: ""
vega20_EXCLUDE_LABEL_REGEX: ""
mi200_EXCLUDE_LABEL_REGEX: ""
mi300_EXCLUDE_LABEL_REGEX: ""
mi300a_EXCLUDE_LABEL_REGEX: ""
mi325_EXCLUDE_LABEL_REGEX: ""
mi3xx_EXCLUDE_LABEL_REGEX: ""
navi4_EXCLUDE_LABEL_REGEX: ""
GLOBAL_CMAKE_OPTIONS: ""
ENABLE_ROCR_BUILD: "true"
ENABLE_HIP_CLR_BUILD: "true"
CI_MODE: ${{ github.event_name == 'schedule' && 'Nightly' || 'Continuous' }}
jobs:
# -----------------------------------------------------------------------------
# Ubuntu / DEB job(s)
# -----------------------------------------------------------------------------
core-deb:
name: Core • ${{ matrix.system.gpu }} • ${{ matrix.system.os }}
strategy:
fail-fast: false
matrix:
system:
# TEMPORARILY DISABLED: navi3/navi4 jobs pending CI stabilization
# - { gpu: 'navi4', runner: 'rocprofiler-navi4-dind', os: 'ubuntu-22.04', build-type: 'RelWithDebInfo', ci-flags: '--linter clang-tidy', gpu-target: 'gfx120X' }
# - { gpu: 'navi3', runner: 'rocprofiler-navi3-dind', os: 'ubuntu-22.04', build-type: 'RelWithDebInfo', ci-flags: '--linter clang-tidy', gpu-target: 'gfx110X' }
- { gpu: 'mi325', runner: 'linux-mi325-1gpu-ossci-rocm-frac', os: 'ubuntu-22.04', build-type: 'RelWithDebInfo', ci-flags: '--linter clang-tidy', gpu-target: 'gfx94X' }
runs-on: ${{ matrix.system.runner }}
container:
image: docker.io/rocm/rocprofiler-private:${{ matrix.system.os }}-${{ matrix.system.gpu-target }}-latest
credentials:
username: ${{ secrets.ROCPROFILER_AZURE_CI_USER }}
password: ${{ secrets.ROCPROFILER_AZURE_CI_PASS }}
env:
DEBIAN_FRONTEND: noninteractive
options: --privileged
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
CORE_EXT_RUNNER: mi325
GPU_RUNNER: ${{ matrix.system.gpu }}
steps:
- name: Install Latest Nightly ROCm
shell: bash
working-directory: /tmp
run: |
tar -xf ${{ env.ROCM_PATH }}-${{ matrix.system.gpu-target }}.tar.gz -C ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}
ln -s ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} ${{ env.ROCM_PATH }}
echo "ROCm installed to: ${{ env.ROCM_PATH }}"
- name: Clone ROCProfiler SDK & AQLProfile & ROCProfiler Register & ROCR-Runtime
uses: actions/checkout@v5
with:
sparse-checkout: |
projects/rocprofiler-sdk
projects/aqlprofile
projects/rocprofiler-register
projects/rocr-runtime
projects/clr
projects/hip
submodules: false
set-safe-directory: true
- name: Compute submodule cache key
id: submods
shell: bash
run: |
git --version
git config --global --add safe.directory '*'
git submodule status --recursive | awk '{print $1,$2}' > .git-submodules-status
echo "hash=$(sha256sum .git-submodules-status | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
# collect submodule paths for cache 'path'
git config --file .gitmodules --get-regexp path | awk '{print $2}' > .git-submodule-paths
{ echo "paths<<EOF"; cat .git-submodule-paths; echo "EOF"; } >> "$GITHUB_OUTPUT"
- name: Restore submodule cache
uses: actions/cache@v4
with:
path: |
.git/modules
${{ steps.submods.outputs.paths }}
key: submods-${{ runner.os }}-${{ steps.submods.outputs.hash }}
restore-keys: |
submods-${{ runner.os }}-
submods-
- name: Init/Update submodules
run: git submodule update --init --recursive --jobs 16
- name: Clone ROCDecode
uses: actions/checkout@v5
with:
repository: 'ROCm/rocDecode'
ref: 'release/rocm-rel-7.0'
set-safe-directory: true
path: 'rocDecode'
- name: Clone ROCJPEG
uses: actions/checkout@v5
with:
repository: 'ROCm/rocJPEG'
ref: 'release/rocm-rel-7.0'
set-safe-directory: true
path: 'rocJPEG'
- name: Install requirements
timeout-minutes: 10
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
git config --global --add safe.directory '*'
apt-get update
apt-get install -y g++-11 g++-12 cmake python3-pip libdw-dev libsqlite3-dev libdrm-dev file autoconf pkg-config rpm libzstd-dev
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
python3 -m pip install -U --user -r requirements.txt
rm -rf \
${{ env.ROCM_PATH }}/lib/*rocprofiler-sdk* \
${{ env.ROCM_PATH }}/lib/cmake/*rocprofiler-sdk* \
${{ env.ROCM_PATH }}/share/*rocprofiler-sdk* \
${{ env.ROCM_PATH }}/libexec/*rocprofiler-sdk* \
${{ env.ROCM_PATH }}*/lib/python*/site-packages/roctx \
${{ env.ROCM_PATH }}*/lib/python*/site-packages/rocpd
- name: Setup ccache
uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
with:
key: ccache-${{ matrix.system.os }}-${{ matrix.system.runner }}-${{ matrix.system.gpu }}
max-size: 2G
save: true
- name: Install Missing ROCm Dependencies
shell: bash
run: |
echo -e "Building & Installing ROCDecode..."
cmake -B build-rocdecode \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }} \
-DCMAKE_CXX_COMPILER=${{ env.ROCM_PATH }}/bin/amdclang++ \
-DCMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache \
${GITHUB_WORKSPACE}/rocDecode
cmake --build build-rocdecode --target all --parallel 16
cmake --build build-rocdecode --target install
echo -e "ROCDecode Installed Successfully!"
echo -e "Building & Installing ROCJPEG..."
cmake -B build-rocjpeg \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }} \
-DCMAKE_CXX_COMPILER=${{ env.ROCM_PATH }}/bin/amdclang++ \
-DCMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache \
${GITHUB_WORKSPACE}/rocJPEG
cmake --build build-rocjpeg --target all --parallel 16
cmake --build build-rocjpeg --target install
echo -e "ROCJPEG Installed Successfully!"
- name: Build and Install ROCProfiler-Register
shell: bash
working-directory: projects/rocprofiler-register
run: |
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH
echo "Install ROCProfiler-Register"
cmake -B build-rocprofiler-register \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache \
.
cmake --build build-rocprofiler-register --target all --parallel 16
cmake --build build-rocprofiler-register --target install
echo "✅ ROCProfiler-Register Installation complete!"
- name: Build and Install ROCR-Runtime
if: ${{ env.ENABLE_ROCR_BUILD == 'true' }}
shell: bash
working-directory: projects/rocr-runtime
run: |
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH
echo "Install ROCR-Runtime..."
cmake -B build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }};${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}/llvm' \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
.
cmake --build build --target all --parallel 16
cmake --build build --target install
echo "✅ ROCR-Runtime Installation complete!"
- name: Build and Install HIP
if: ${{ env.ENABLE_HIP_CLR_BUILD == 'true' }}
shell: bash
working-directory: projects
run: |
export HIP_DIR=$PWD/hip
export CLR_DIR=$PWD/clr
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH
echo "Install HIP..."
cd $CLR_DIR
cmake \
-DHIP_COMMON_DIR=$HIP_DIR \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DHIP_PLATFORM=amd \
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }};${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}/llvm' \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DHIP_LLVM_ROOT=${{ env.ROCM_PATH }}/lib/llvm \
-DHIP_CATCH_TEST=0 \
-DCLR_BUILD_HIP=ON \
-DCLR_BUILD_OCL=ON \
-S $CLR_DIR \
-B build
cmake --build build --target all --parallel 16
cmake --build build --target install
echo "✅ HIP Installation complete!"
- name: Build and Install Aqlprofile
shell: bash
working-directory: projects/aqlprofile
run: |
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH
echo "Install Aqlprofile..."
cmake -B build-aqlprofile \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache \
.
cmake --build build-aqlprofile --target all --parallel 16
cmake --build build-aqlprofile --target install
echo "✅ AQLProfile Installation complete!"
- name: List Files
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
echo "PATH: ${PATH}"
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
cat ${{ env.ROCM_PATH }}/.info/version
ls -la
- name: Enable PC Sampling
if: ${{ contains(matrix.system.gpu, 'mi200') || contains(matrix.system.gpu, 'mi300a') }}
shell: bash
working-directory: projects/rocprofiler-sdk
run: echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
- name: Configure, Build, and Test
timeout-minutes: 30
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH \
PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH \
python3 ./source/scripts/run-ci.py \
-B build \
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-core \
--build-jobs 16 \
--mode ${CI_MODE} \
--site ${{ matrix.system.runner }} \
--gpu-targets ${{ env.GPU_TARGETS }} \
--run-attempt ${{ github.run_attempt }} \
${{ matrix.system.ci-flags }} -- \
-DROCPROFILER_DEP_ROCMCORE=ON \
-DROCPROFILER_BUILD_DOCS=OFF \
-DROCPROFILER_BUILD_FMT=OFF \
-DROCPROFILER_INTERNAL_RCCL_API_TRACE=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }} \
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-sdk \
-DCPACK_GENERATOR='DEB;RPM;TGZ' \
-DCPACK_PACKAGING_INSTALL_PREFIX="$(realpath ${{ env.ROCM_PATH }})" \
-DPython3_EXECUTABLE=$(which python3) \
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm' \
${{ env.GLOBAL_CMAKE_OPTIONS }} -- \
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" \
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}"
- name: Install
if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }}
timeout-minutes: 10
working-directory: projects/rocprofiler-sdk
run: |
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH
cmake --build build --target install --parallel 16
- name: Build Packaging
if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }}
timeout-minutes: 10
working-directory: projects/rocprofiler-sdk
run: |
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH
cmake --build build --target package --parallel 16
- name: Test Install Build
if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }}
timeout-minutes: 20
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH
CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-samples samples
CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-tests -DGPU_TARGETS="gfx942" tests
export LD_LIBRARY_PATH=/opt/rocprofiler-sdk/lib:${LD_LIBRARY_PATH}
cmake --build build-samples --target all --parallel 16
cmake --build build-tests --target all --parallel 16
ctest --test-dir build-samples -LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
ctest --test-dir build-tests -LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
- name: Install Packages
if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }}
timeout-minutes: 5
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH
export PATH=${PATH}:/usr/local/sbin:/usr/sbin:/sbin
ls -la
ls -la ./build
dpkg --force-all -i ./build/rocprofiler-sdk-roctx_*.deb
dpkg --force-all -i ./build/rocprofiler-sdk-rocpd_*.deb
for i in $(ls -S ./build/rocprofiler-sdk*.deb | egrep -v 'roctx|rocpd'); do dpkg --force-all -i ${i}; done;
- name: Test Installed Packages
if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }}
timeout-minutes: 20
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH
CMAKE_PREFIX_PATH=${{ env.ROCM_PATH }} cmake -B build-samples-deb ${{ env.ROCM_PATH }}/share/rocprofiler-sdk/samples
CMAKE_PREFIX_PATH=${{ env.ROCM_PATH }} cmake -B build-tests-deb -DGPU_TARGETS="gfx942" ${{ env.ROCM_PATH }}/share/rocprofiler-sdk/tests
cmake --build build-samples-deb --target all --parallel 16
cmake --build build-tests-deb --target all --parallel 16
ctest --test-dir build-samples-deb -LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
ctest --test-dir build-tests-deb -LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
- name: Archive production artifacts
if: ${{ github.event_name == 'workflow_dispatch' && contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }}
uses: actions/upload-artifact@v4
with:
name: installers-deb
path: |
${{github.workspace}}/build/*.deb
${{github.workspace}}/build/*.rpm
${{github.workspace}}/build/*.tgz
# -----------------------------------------------------------------------------
# RHEL/SLES (RPM) job(s)
# -----------------------------------------------------------------------------
core-rpm:
name: Core • ${{ matrix.system.gpu }} • ${{ matrix.system.os }}
strategy:
fail-fast: false
matrix:
system:
- { os: 'rhel-8.8', runner: 'linux-mi325-1gpu-ossci-rocm-frac', gpu: 'mi325', gpu-target: 'gfx94X', build-type: 'RelWithDebInfo', ci-flags: '' }
- { os: 'rhel-9.5', runner: 'linux-mi325-1gpu-ossci-rocm-frac', gpu: 'mi325', gpu-target: 'gfx94X', build-type: 'RelWithDebInfo', ci-flags: '' }
- { os: 'sles-15.6', runner: 'linux-mi325-1gpu-ossci-rocm-frac', gpu: 'mi325', gpu-target: 'gfx94X', build-type: 'RelWithDebInfo', ci-flags: '' }
runs-on: ${{ matrix.system.runner }}
container:
image: docker.io/rocm/rocprofiler-private:${{ matrix.system.os }}-${{ matrix.system.gpu-target }}-latest
credentials:
username: ${{ secrets.ROCPROFILER_AZURE_CI_USER }}
password: ${{ secrets.ROCPROFILER_AZURE_CI_PASS }}
options: --privileged
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
OS_TYPE: ${{ matrix.system.os }}
GPU_RUNNER: ${{ matrix.system.gpu }}
steps:
- name: Clone ROCProfiler SDK & AQLProfile & ROCProfiler Register & ROCR-Runtime
uses: actions/checkout@v5
with:
sparse-checkout: |
projects/rocprofiler-sdk
projects/aqlprofile
projects/rocprofiler-register
projects/rocr-runtime
projects/clr
projects/hip
submodules: false
set-safe-directory: true
- name: Compute submodule cache key
id: submods
shell: bash
run: |
git --version
git config --global --add safe.directory '*'
git submodule status --recursive | awk '{print $1,$2}' > .git-submodules-status
echo "hash=$(sha256sum .git-submodules-status | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
# collect submodule paths for cache 'path'
git config --file .gitmodules --get-regexp path | awk '{print $2}' > .git-submodule-paths
{ echo "paths<<EOF"; cat .git-submodule-paths; echo "EOF"; } >> "$GITHUB_OUTPUT"
- name: Restore submodule cache
uses: actions/cache@v4
with:
path: |
.git/modules
${{ steps.submods.outputs.paths }}
key: submods-${{ runner.os }}-${{ steps.submods.outputs.hash }}
restore-keys: |
submods-${{ runner.os }}-
submods-
- name: Init/Update submodules
run: git submodule update --init --recursive --jobs 16
- name: Install Latest Nightly ROCm using TheRock Tarballs
shell: bash
working-directory: /tmp
run: |
tar -xf ${{ env.ROCM_PATH }}-${{ matrix.system.gpu-target }}.tar.gz -C ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}
ln -s ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} ${{ env.ROCM_PATH }}
echo "ROCm installed to: ${{ env.ROCM_PATH }}"
- name: Install requirements (venv)
timeout-minutes: 10
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
git config --global --add safe.directory '*'
python3 -m venv ${{ env.PYTHON_VENV_PATH }}
source ${{ env.PYTHON_VENV_ACTIVATE }}
export PATH=/opt/rh/gcc-toolset-11/root/usr/bin:$PATH
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade -r requirements.txt
rm -rf \
${{ env.ROCM_PATH }}/lib/*rocprofiler-sdk* \
${{ env.ROCM_PATH }}/lib/cmake/*rocprofiler-sdk* \
${{ env.ROCM_PATH }}/share/*rocprofiler-sdk* \
${{ env.ROCM_PATH }}/libexec/*rocprofiler-sdk*
- name: Install Curl for RHEL 8.8
if: ${{ matrix.system.os == 'rhel-8.8' }}
run: |
dnf install -y curl
ln -s /usr/local/bin/curl /usr/bin/curl
- name: Setup ccache
uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
with:
key: ccache-${{ matrix.system.os }}-${{ matrix.system.runner }}-${{ matrix.system.gpu }}
max-size: 2G
save: true
variant: sccache
- name: Build and Install ROCProfiler-Register
shell: bash
working-directory: projects/rocprofiler-register
run: |
echo "Install ROCProfiler-Register"
cmake -B build-rocprofiler-register \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_C_COMPILER_LAUNCHER=/usr/local/bin/sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/sccache \
.
cmake --build build-rocprofiler-register --target all --parallel 16
cmake --build build-rocprofiler-register --target install
echo "✅ ROCProfiler-Register Installation complete!"
- name: Build and Install ROCR-Runtime
if: ${{ env.ENABLE_ROCR_BUILD == 'true' }}
shell: bash
working-directory: projects/rocr-runtime
run: |
python3 -m venv ${{ env.PYTHON_VENV_PATH }}
source ${{ env.PYTHON_VENV_ACTIVATE }}
export PATH=/opt/rh/gcc-toolset-11/root/usr/bin:$PATH
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade cmake
echo "Install ROCR-Runtime..."
cmake -B build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }};${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}/llvm' \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
.
cmake --build build --target all --parallel 16
cmake --build build --target install
echo "✅ ROCR-Runtime Installation complete!"
- name: Build and Install HIP
if: ${{ env.ENABLE_HIP_CLR_BUILD == 'true' }}
shell: bash
working-directory: projects
run: |
export HIP_DIR=$PWD/hip
export CLR_DIR=$PWD/clr
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH
echo "Install HIP..."
cd $CLR_DIR
cmake \
-DHIP_COMMON_DIR=$HIP_DIR \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DHIP_PLATFORM=amd \
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }};${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}/llvm' \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DHIP_LLVM_ROOT=${{ env.ROCM_PATH }}/lib/llvm \
-DHIP_CATCH_TEST=0 \
-DCLR_BUILD_HIP=ON \
-DCLR_BUILD_OCL=ON \
-S $CLR_DIR \
-B build
cmake --build build --target all --parallel 16
cmake --build build --target install
echo "✅ HIP Installation complete!"
- name: Build and Install Aqlprofile
shell: bash
working-directory: projects/aqlprofile
run: |
echo "Install Aqlprofile."
python3 -m venv ${{ env.PYTHON_VENV_PATH }}
source ${{ env.PYTHON_VENV_ACTIVATE }}
export PATH=/opt/rh/gcc-toolset-11/root/usr/bin:$PATH
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade cmake
cmake -B build-aqlprofile \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_C_COMPILER_LAUNCHER=/usr/local/bin/sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/sccache \
.
cmake --build build-aqlprofile --target all --parallel 16
cmake --build build-aqlprofile --target install
echo "✅ AQLProfile Installation complete!"
- name: Enable PC Sampling
if: ${{ contains(matrix.system.gpu, 'mi200') || contains(matrix.system.gpu, 'mi300a') }}
shell: bash
working-directory: projects/rocprofiler-sdk
run:
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
- name: List Files
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
source ${{ env.PYTHON_VENV_ACTIVATE }}
echo "PATH: ${PATH}"
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
cat ${{ env.ROCM_PATH }}/.info/version
ls -la
- name: Configure, Build, and Test
timeout-minutes: 30
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
source ${{ env.PYTHON_VENV_ACTIVATE }}
export PATH=~/.local/bin:/opt/rh/gcc-toolset-11/root/usr/bin:$PATH
python3 ./source/scripts/run-ci.py -B build \
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-core \
--mode ${CI_MODE} \
--build-jobs 16 \
--site ${{ matrix.system.runner }} \
--gpu-targets ${{ env.GPU_TARGETS }} \
--run-attempt ${{ github.run_attempt }} \
${{ matrix.system.ci-flags }} \
-- \
-DROCPROFILER_DEP_ROCMCORE=ON \
-DROCPROFILER_BUILD_DOCS=OFF \
-DROCPROFILER_BUILD_FMT=OFF \
-DROCPROFILER_INTERNAL_RCCL_API_TRACE=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }} \
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm' \
-DPython3_EXECUTABLE=$(which python3) \
${{ env.GLOBAL_CMAKE_OPTIONS }} \
-- \
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" \
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" \
sanitizers:
name: ${{ matrix.system.sanitizer }} • ${{ matrix.system.gpu }} • ${{ matrix.system.os }}
strategy:
fail-fast: false
matrix:
system:
- { sanitizer: 'AddressSanitizer', os: 'ubuntu-22.04', runner: 'linux-mi325-1gpu-ossci-rocm-frac', gpu: 'mi325', gpu-target: 'gfx94X', build-type: 'RelWithDebInfo' }
- { sanitizer: 'ThreadSanitizer', os: 'ubuntu-22.04', runner: 'linux-mi325-1gpu-ossci-rocm-frac', gpu: 'mi325', gpu-target: 'gfx94X', build-type: 'RelWithDebInfo' }
- { sanitizer: 'LeakSanitizer', os: 'ubuntu-22.04', runner: 'linux-mi325-1gpu-ossci-rocm-frac', gpu: 'mi325', gpu-target: 'gfx94X', build-type: 'RelWithDebInfo' }
- { sanitizer: 'UndefinedBehaviorSanitizer', os: 'ubuntu-22.04', runner: 'linux-mi325-1gpu-ossci-rocm-frac', gpu: 'mi325', gpu-target: 'gfx94X', build-type: 'RelWithDebInfo' }
if: ${{ contains(github.event_name, 'pull_request') }}
runs-on: ${{ matrix.system.runner }}
container:
image: docker.io/rocm/rocprofiler-private:${{ matrix.system.os }}-${{ matrix.system.gpu-target }}-latest
credentials:
username: ${{ secrets.ROCPROFILER_AZURE_CI_USER }}
password: ${{ secrets.ROCPROFILER_AZURE_CI_PASS }}
env:
DEBIAN_FRONTEND: noninteractive
options: --privileged --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
GCC_COMPILER_VERSION: 13
GPU_RUNNER: ${{ matrix.system.gpu }}
steps:
- name: Install Latest Nightly ROCm
shell: bash
working-directory: /tmp
run: |
ls -lah /opt/
tar -xf ${{ env.ROCM_PATH }}-${{ matrix.system.gpu-target }}.tar.gz -C ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}
ln -s ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} ${{ env.ROCM_PATH }}
echo "ROCm installed to: ${{ env.ROCM_PATH }}"
- name: Clone ROCProfiler SDK & AQLProfile & ROCProfiler Register & ROCR-Runtime
uses: actions/checkout@v5
with:
sparse-checkout: |
projects/rocprofiler-sdk
projects/aqlprofile
projects/rocprofiler-register
projects/rocr-runtime
projects/clr
projects/hip
submodules: false
set-safe-directory: true
- name: Compute submodule cache key
id: submods
shell: bash
run: |
git --version
git config --global --add safe.directory '*'
git submodule status --recursive | awk '{print $1,$2}' > .git-submodules-status
echo "hash=$(sha256sum .git-submodules-status | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
# collect submodule paths for cache 'path'
git config --file .gitmodules --get-regexp path | awk '{print $2}' > .git-submodule-paths
{ echo "paths<<EOF"; cat .git-submodule-paths; echo "EOF"; } >> "$GITHUB_OUTPUT"
- name: Restore submodule cache
uses: actions/cache@v4
with:
path: |
.git/modules
${{ steps.submods.outputs.paths }}
key: submods-${{ runner.os }}-${{ steps.submods.outputs.hash }}
restore-keys: |
submods-${{ runner.os }}-
submods-
- name: Init/Update submodules
run: git submodule update --init --recursive --jobs 16
- name: Install requirements
timeout-minutes: 10
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
git config --global --add safe.directory '*'
apt-get update
apt-get install -y build-essential cmake python3-pip libasan8 libtsan2 software-properties-common clang-15 libdw-dev libsqlite3-dev libdrm-dev file autoconf pkg-config
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get upgrade -y
apt-get install -y gcc-${{ env.GCC_COMPILER_VERSION }} g++-${{ env.GCC_COMPILER_VERSION }}
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_COMPILER_VERSION }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_COMPILER_VERSION }} --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_COMPILER_VERSION }}
python3 -m pip install -U --user -r requirements.txt
rm -rf ${{ env.ROCM_PATH }}/lib/*rocprofiler-sdk* ${{ env.ROCM_PATH }}/lib/cmake/*rocprofiler-sdk* ${{ env.ROCM_PATH }}/share/*rocprofiler-sdk* ${{ env.ROCM_PATH }}/libexec/*rocprofiler-sdk* ${{ env.ROCM_PATH }}*/lib/python*/site-packages/roctx ${{ env.ROCM_PATH }}*/lib/python*/site-packages/rocpd
- name: List Files
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
cat ${{ env.ROCM_PATH }}/.info/version
ls -la
- name: Enable PC Sampling
if: ${{ contains(matrix.system.gpu, 'mi200') || contains(matrix.system.gpu, 'mi300a') }}
shell: bash
working-directory: projects/rocprofiler-sdk
run: echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
- name: Setup ccache
uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
with:
key: ccache-${{ matrix.system.os }}-${{ matrix.system.runner }}-${{ matrix.system.gpu }}-${{ matrix.system.sanitizer}}
max-size: 2G
save: true
- name: Build and Install ROCProfiler-Register
shell: bash
working-directory: projects/rocprofiler-register
run: |
echo "Install ROCProfiler-Register"
cmake -B build-rocprofiler-register \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache \
.
cmake --build build-rocprofiler-register --target all --parallel 16
cmake --build build-rocprofiler-register --target install
echo "✅ ROCProfiler-Register Installation complete!"
- name: Build and Install ROCR-Runtime
if: ${{ env.ENABLE_ROCR_BUILD == 'true' }}
shell: bash
working-directory: projects/rocr-runtime
run: |
echo "Install ROCR-Runtime..."
cmake -B build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }};${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}/llvm' \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache \
.
cmake --build build --target all --parallel 16
cmake --build build --target install
echo "✅ ROCR-Runtime Installation complete!"
- name: Build and Install HIP
if: ${{ env.ENABLE_HIP_CLR_BUILD == 'true' }}
shell: bash
working-directory: projects
run: |
export HIP_DIR=$PWD/hip
export CLR_DIR=$PWD/clr
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH
echo "Install HIP..."
cd $CLR_DIR
cmake \
-DHIP_COMMON_DIR=$HIP_DIR \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DHIP_PLATFORM=amd \
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }};${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}/llvm' \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DHIP_LLVM_ROOT=${{ env.ROCM_PATH }}/lib/llvm \
-DHIP_CATCH_TEST=0 \
-DCLR_BUILD_HIP=ON \
-DCLR_BUILD_OCL=ON \
-S $CLR_DIR \
-B build
cmake --build build --target all --parallel 16
cmake --build build --target install
echo "✅ HIP Installation complete!"
- name: Build and Install Aqlprofile
shell: bash
working-directory: projects/aqlprofile
run: |
echo "Install Aqlprofile."
cmake -B build-aqlprofile \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
-DCMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache \
.
cmake --build build-aqlprofile --target all --parallel 16
cmake --build build-aqlprofile --target install
echo "✅ Installation complete!"
- name: Configure, Build, and Test
timeout-minutes: 45
shell: bash
working-directory: projects/rocprofiler-sdk
run:
sudo sysctl -w vm.mmap_rnd_bits=28;
export PATH="$HOME/.local/bin:$PATH";
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-${{ matrix.system.sanitizer }}
--build-jobs 16
--site ${{ matrix.system.runner }}
--gpu-targets ${{ env.GPU_TARGETS }}
--memcheck ${{ matrix.system.sanitizer }}
--run-attempt ${{ github.run_attempt }}
--
-DROCPROFILER_BUILD_FMT=OFF \
-DROCPROFILER_INTERNAL_RCCL_API_TRACE=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }}
-DCMAKE_INSTALL_PREFIX="${{ env.ROCM_PATH }}"
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm'
-DPython3_EXECUTABLE=$(which python3)
${{ env.GLOBAL_CMAKE_OPTIONS }}
--
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}"
+159
Ver Arquivo
@@ -0,0 +1,159 @@
name: rocprofiler-sdk Documentation
on:
workflow_dispatch:
push:
branches:
- develop
paths:
- 'projects/rocprofiler-sdk/*.md'
- 'projects/rocprofiler-sdk/VERSION'
- 'projects/rocprofiler-sdk/source/docs/**'
- 'projects/rocprofiler-sdk/source/scripts/update-docs.sh'
- 'projects/rocprofiler-sdk/source/include/rocprofiler-sdk/**'
- 'projects/rocprofiler-sdk/.github/workflows/docs.yml'
- '.github/workflows/rocprofiler-sdk-docs.yml'
pull_request:
paths:
- 'projects/rocprofiler-sdk/*.md'
- 'projects/rocprofiler-sdk/VERSION'
- 'projects/rocprofiler-sdk/source/docs/**'
- 'projects/rocprofiler-sdk/source/scripts/update-docs.sh'
- 'projects/rocprofiler-sdk/source/include/rocprofiler-sdk/**'
- 'projects/rocprofiler-sdk/.github/workflows/docs.yml'
- '.github/workflows/rocprofiler-sdk-docs.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
ROCM_PATH: "/opt/rocm"
ROCM_VERSION: "7.2.0"
jobs:
build-docs:
runs-on: ubuntu-latest
container: continuumio/miniconda3
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
submodules: true
set-safe-directory: true
- name: Create Docs Directory
run: |
git config --global --add safe.directory '*'
git config --global --add safe.directory ${GITHUB_WORKSPACE}
mkdir -p projects/rocprofiler-sdk/docs/_doxygen/rocprofiler-sdk
mkdir -p projects/rocprofiler-sdk/docs/_doxygen/roctx
- name: Install documentation dependencies
timeout-minutes: 10
shell: bash
run: |
apt-get update
apt-get install -y doxygen graphviz build-essential cmake
- name: Build Docs
shell: bash -el {0}
working-directory: projects/rocprofiler-sdk/source/docs
run: |
git config --global --add safe.directory '*'
git config --global --add safe.directory ${GITHUB_WORKSPACE}
conda init
conda env create -n rocprofiler-docs -f environment.yml
conda activate rocprofiler-docs
python3 -m pip install sphinx
python3 -m pip install doxysphinx rocm-docs-core
../scripts/update-docs.sh
build-docs-from-source:
runs-on: linux-mi325-1gpu-ossci-rocm-frac
container:
image: docker.io/rocm/rocprofiler-private:ubuntu-22.04-gfx94X-latest
credentials:
username: ${{ secrets.ROCPROFILER_AZURE_CI_USER }}
password: ${{ secrets.ROCPROFILER_AZURE_CI_PASS }}
env:
DEBIAN_FRONTEND: noninteractive
options: --privileged
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
CORE_EXT_RUNNER: mi325
GPU_RUNNER: mi325
steps:
- name: Install Latest Nightly ROCm
shell: bash
working-directory: /tmp
run: |
tar -xf ${{ env.ROCM_PATH }}-gfx94X.tar.gz -C ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}
ln -s ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} ${{ env.ROCM_PATH }}
echo "ROCm installed to: ${{ env.ROCM_PATH }}"
- name: Install os essentials
timeout-minutes: 10
shell: bash
run: |
apt update
apt install -y software-properties-common
apt-add-repository ppa:git-core/ppa
apt-get update
apt-get install -y git
echo "PATH=/usr/bin:$PATH" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
submodules: true
set-safe-directory: true
- name: Setup
shell: bash
run: |
git config --global --add safe.directory '*'
rm -rf /usr/local/bin/git
ln -s /usr/bin/git /usr/local/bin/git
git --version
- name: Create Docs Directory
shell: bash
working-directory: projects/rocprofiler-sdk/
run: |
git config --global --add safe.directory '*'
git config --global --add safe.directory ${GITHUB_WORKSPACE}
mkdir -p source/docs/_doxygen/rocprofiler-sdk
mkdir -p source/docs/_doxygen/roctx
- name: Install requirements
timeout-minutes: 10
shell: bash
working-directory: projects/rocprofiler-sdk/
run: |
apt-get update
apt-get install -y cmake gcc g++ libdw-dev libsqlite3-dev rpm
python3 -m pip install -r requirements.txt
- name: Configure, Build, Install, and Package
timeout-minutes: 60
shell: bash
working-directory: projects/rocprofiler-sdk/
run: |
CMAKE_PREFIX_PATH=/opt/rocm:${CMAKE_PREFIX_PATH} \
cmake -B build \
-DROCPROFILER_DEP_ROCMCORE=ON \
-DROCPROFILER_BUILD_DOCS=ON \
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-sdk \
-DCPACK_GENERATOR='DEB;RPM;TGZ' \
-DCPACK_PACKAGING_INSTALL_PREFIX="$(realpath /opt/rocm)" \
-DPython3_EXECUTABLE=$(which python3) \
.
cmake --build build --target docs --parallel 4
cmake --build build --target all --parallel 12
cmake --build build --target install --parallel 12
cmake --build build --target package --parallel 12
@@ -0,0 +1,177 @@
name: rocprofiler-sdk Formatting
on:
workflow_dispatch:
pull_request:
paths:
- 'projects/rocprofiler-sdk/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-sdk/.github/workflows/pull_*.yml'
- '!projects/rocprofiler-sdk/.github/workflows/linting.yml'
- '!projects/rocprofiler-sdk/.github/workflows/markdown_lint.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
cmake:
runs-on: ubuntu-22.04
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
- name: Extract branch name
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Install dependencies
working-directory: projects/rocprofiler-sdk
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install -r requirements.txt
- name: Run cmake-format
working-directory: projects/rocprofiler-sdk
run: |
FORMAT_FILES=$(find . -type f | egrep 'CMakeLists.txt|\.cmake$')
command -v cmake-format
cmake-format --version
set +e
cmake-format -i ${FORMAT_FILES}
if [ $(git diff | wc -l) -ne 0 ]; then
echo -e "\nError! CMake code not formatted. Run cmake-format...\n"
echo -e "\nFiles:\n"
git diff --name-only
echo -e "\nFull diff:\n"
git diff
exit 1
fi
source:
runs-on: ubuntu-22.04
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
- name: Extract branch name
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Install dependencies
working-directory: projects/rocprofiler-sdk
run: |
DISTRIB_CODENAME=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F '=' '{print $NF}')
sudo apt-get update
sudo apt-get install -y software-properties-common python3 python3-pip
python3 -m pip install -r requirements.txt
- name: Run clang-format
working-directory: projects/rocprofiler-sdk
run: |
FORMAT_FILES=$(find samples source tests benchmark -type f | egrep '\.(h|hpp|hh|c|cc|cpp)(|\.in)$')
command -v git
command -v clang-format
git --version
clang-format --version
set +e
FORMAT_OUT=$(clang-format -i ${FORMAT_FILES})
git status
if [ $(git diff | wc -l) -ne 0 ]; then
echo -e "\nError! Code not formatted. Run clang-format (version 11)...\n"
echo -e "\nFiles:\n"
git diff --name-only
echo -e "\nFull diff:\n"
git diff
exit 1
fi
python:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.10']
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
- name: Extract branch name
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: projects/rocprofiler-sdk
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: black format
working-directory: projects/rocprofiler-sdk
run: |
black .
if [ $(git diff | wc -l) -ne 0 ]; then
echo -e "\nError! Python code not formatted. Run black...\n"
echo -e "\nFiles:\n"
git diff --name-only
echo -e "\nFull diff:\n"
git diff
exit 1
fi
missing-new-line:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
- name: Extract branch name
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Find missing new line
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
OUTFILE=missing_newline.txt
for i in $(find source tests samples benchmark docker cmake -type f | egrep -v '\.(bin|png|csv)$|source/docs/_(build|doxygen)'); do VAL=$(tail -c 1 ${i}); if [ -n "${VAL}" ]; then echo "- ${i}" >> ${OUTFILE}; fi; done
if [[ -f ${OUTFILE} && $(cat ${OUTFILE} | wc -l) -gt 0 ]]; then
echo -e "\nError! Source code missing new line at end of file...\n"
echo -e "\nFiles:\n"
cat ${OUTFILE}
exit 1
fi
+62
Ver Arquivo
@@ -0,0 +1,62 @@
name: rocprofiler-sdk Python Linting
on:
workflow_dispatch:
push:
branches:
- develop
paths:
- 'projects/rocprofiler-sdk/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!docs/**'
- '!projects/*/docs/**'
pull_request:
paths:
- 'projects/rocprofiler-sdk/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!docs/**'
- '!projects/*/docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
linting:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.8', '3.10', '3.12']
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: projects/rocprofiler-sdk
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
working-directory: projects/rocprofiler-sdk
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 source --count --show-source --statistics --select=E9,F63,F7,F82
# flake8 options are defined in .flake8
flake8 source --count --show-source --statistics
@@ -0,0 +1,60 @@
name: rocprofiler-sdk Code Restrictions
permissions:
contents: read
# This workflow ensures that certain code restrictions are applied.
# For examples, rocprofiler-sdk cannot use std::regex because of issues
# when loaded into an application compiled with C++ dual ABI support because
# while std::regex itself (and std::regex_traits) being ABI-tagged,
# std::__detail::_Scanner is not. Applications compiled with dual ABI support
# will either throw an exception or produce a segfault and thus, this workflow
# attempts to catch usage of std::regex during CI.
on:
workflow_dispatch:
pull_request:
paths:
- 'projects/rocprofiler-sdk/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-sdk/.github/workflows/pull_*.yml'
- '!projects/rocprofiler-sdk/.github/workflows/linting.yml'
- '!projects/rocprofiler-sdk/.github/workflows/markdown_lint.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
regex:
runs-on: ubuntu-22.04
env:
FOLDERS: "source/lib/common source/lib/rocprofiler-sdk source/lib/rocprofiler-sdk-roctx source/lib/output source/lib/rocprofiler-sdk-tool"
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install -U cmake-format
- name: Apply restriction
working-directory: projects/rocprofiler-sdk
run: |
set +e
FILES="$(find ${FOLDERS} -type f -not -name "*.md" -not -name "*.txt")"
GREP="$(grep -E -n 'std::regex|<regex>' ${FILES})"
if [ "${GREP}" != "" ]; then
echo -e "\nError! std::regex is not allowed in ${FOLDERS}...\n"
echo -e "\nResults:\n"
echo "${GREP}"
exit 1
fi
@@ -0,0 +1,126 @@
name: rocprofiler-sdk ROCm Release Compatibility
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- develop
paths:
- '.github/workflows/rocprofiler-sdk-rocm_release_compatibility.yml'
- 'projects/rocprofiler-sdk/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
pull_request:
paths:
- '.github/workflows/rocprofiler-sdk-rocm_release_compatibility.yml'
- 'projects/rocprofiler-sdk/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ROCM_PATH: "/opt/rocm"
PATH: "/usr/bin:$PATH"
jobs:
rocm-release-compatibility:
strategy:
fail-fast: false
matrix:
rocm-release: ['6.2', '6.3', '6.4', 'latest']
os: ['ubuntu-22.04']
build-type: ['Release']
runs-on: ubuntu-latest
container:
image: rocm/dev-${{ matrix.os }}:${{ matrix.rocm-release }}
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
steps:
- name: Install Git
timeout-minutes: 25
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository -y ppa:git-core/ppa
apt-get update
apt-get install -y git
- uses: actions/checkout@v4
- name: Install requirements
timeout-minutes: 10
shell: bash
run: |
cd projects/rocprofiler-sdk
git config --global --add safe.directory '*'
apt update
apt install -y wget build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev
# Older ROCm versions don't provide these packages.
apt install -y rccl-dev rccl-unittests || true
apt install -y rocjpeg-dev rocjpeg-test rocdecode-dev rocdecode-test || true
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
python3 -m pip install -U --user -r requirements.txt
- name: List Files
shell: bash
run: |
cd projects/rocprofiler-sdk
echo "Number of processors: $(nproc)"
echo "PATH: ${PATH}"
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
cat /opt/rocm/.info/version
ls -la
- name: Configure and Build
timeout-minutes: 30
shell: bash
working-directory: projects/rocprofiler-sdk
run:
python3 source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-rocm-${{ matrix.rocm-release }}
--build-jobs 4
--site "$(hostname)"
--stages Start Update Configure Build Submit
--run-attempt ${{ github.run_attempt }}
--disable-cdash
--
-DROCPROFILER_DEP_ROCMCORE=ON
-DROCPROFILER_BUILD_{TESTS,SAMPLES,DOCS}=OFF
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DCMAKE_INSTALL_PREFIX="$(realpath /opt/rocm)"
-DPython3_EXECUTABLE=$(which python3)
- name: Install
timeout-minutes: 10
run:
cd projects/rocprofiler-sdk
cmake --build build --target install
@@ -0,0 +1,203 @@
name: rocprofiler-systems Continuous Integration Containers
run-name: ci-containers
# nightly build
on:
workflow_dispatch:
schedule:
- cron: 0 5 * * *
push:
branches:
- develop
paths:
- '.github/workflows/rocprofiler-systems-containers.yml'
- 'projects/rocprofiler-systems/docker/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!docs/**'
- '!projects/*/docs/**'
pull_request:
paths:
- '.github/workflows/rocprofiler-systems-containers.yml'
- 'projects/rocprofiler-systems/docker/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!docs/**'
- '!projects/*/docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
jobs:
prepare_matrix_ci:
if: github.repository == 'ROCm/rocm-systems'
runs-on: ubuntu-latest
outputs:
matrix_data: ${{ steps.generate_matrix_ci.outputs.matrix_data }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems/docker
- name: Output data for containers matrix
working-directory: projects/rocprofiler-systems/docker
id: generate_matrix_ci
run: |
MATRIX_CONTENT=$(cat containers-ci.yml | yq '.matrix' -I=0 -o=json)
echo "matrix_data=$MATRIX_CONTENT" >> $GITHUB_OUTPUT
rocprofiler-systems-ci:
needs: prepare_matrix_ci
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.prepare_matrix_ci.outputs.matrix_data) }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems/docker
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.ROCPROF_SYS_DOCKER_LOGIN }}
password: ${{ secrets.ROCPROF_SYS_DOCKER_TOKEN }}
- name: Build CI Container (PR - No Push)
if: github.event_name == 'pull_request'
timeout-minutes: 45
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 60
timeout_minutes: 45
max_attempts: 3
command: |
cd projects/rocprofiler-systems/docker
./build-docker-ci.sh \
--distro ${{ matrix.distro }} \
--versions ${{ matrix.version }} \
--user ${{ secrets.ROCPROF_SYS_DOCKER_LOGIN }} \
--jobs 2 \
--elfutils-version 0.188 \
--boost-version 1.79.0
- name: Build Base Container (Push)
if: github.event_name != 'pull_request'
timeout-minutes: 45
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 60
timeout_minutes: 45
max_attempts: 3
command: |
cd projects/rocprofiler-systems/docker
./build-docker-ci.sh \
--distro ${{ matrix.distro }} \
--versions ${{ matrix.version }} \
--user ${{ secrets.ROCPROF_SYS_DOCKER_LOGIN }} \
--jobs 2 \
--elfutils-version 0.188 \
--boost-version 1.79.0 \
--push
prepare_matrix_release:
if: github.repository == 'ROCm/rocm-systems'
runs-on: ubuntu-latest
outputs:
matrix_data: ${{ steps.generate_matrix_release.outputs.matrix_data }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems
- name: Output data for containers matrix
working-directory: projects/rocprofiler-systems/docker
id: generate_matrix_release
run: |
MATRIX_CONTENT=$(cat containers.yml | yq '.matrix' -I=0 -o=json)
echo "matrix_data=$MATRIX_CONTENT" >> $GITHUB_OUTPUT
rocprofiler-systems-release:
needs: prepare_matrix_release
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.prepare_matrix_release.outputs.matrix_data) }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.ROCPROF_SYS_DOCKER_LOGIN }}
password: ${{ secrets.ROCPROF_SYS_DOCKER_TOKEN }}
- name: Build Base Container (PR - No Push)
if: github.event_name == 'pull_request'
timeout-minutes: 45
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 60
timeout_minutes: 45
max_attempts: 3
command: |
cd projects/rocprofiler-systems/docker
./build-docker.sh \
--distro ${{ matrix.os-distro }} \
--versions ${{ matrix.os-version }} \
--rocm-versions ${{ matrix.rocm-version }} \
--user ${{ secrets.ROCPROF_SYS_DOCKER_LOGIN }}
- name: Build Base Container (Push)
if: github.event_name != 'pull_request'
timeout-minutes: 45
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 60
timeout_minutes: 45
max_attempts: 3
command: |
cd projects/rocprofiler-systems/docker
./build-docker.sh \
--distro ${{ matrix.os-distro }} \
--versions ${{ matrix.os-version }} \
--rocm-versions ${{ matrix.rocm-version }} \
--user ${{ secrets.ROCPROF_SYS_DOCKER_LOGIN }} \
--push
@@ -0,0 +1,211 @@
name: rocprofiler-systems Continuous Integration
run-name: rocprofiler-systems-ci
on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
inputs:
mode:
description: 'Build mode'
required: false
default: 'continuous'
type: choice
options:
- continuous
- nightly
push:
branches: [ develop ]
paths:
- '.github/workflows/rocprofiler-systems-continuous-integration.yml'
- 'projects/rocprofiler-systems/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/CMakePresets.json'
pull_request:
paths:
- '.github/workflows/rocprofiler-systems-continuous-integration.yml'
- 'projects/rocprofiler-systems/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/CMakePresets.json'
env:
ROCPROFSYS_CI: ON
ROCPROFSYS_TMPDIR: "%env{PWD}%/testing-tmp"
ROCM_PATH: "/opt/rocm"
ROCM_VERSION: "7.1.0"
jobs:
prepare_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v5
with:
sparse-checkout: projects/rocprofiler-systems/.github
- name: Generate and output matrix
id: generate_matrix
working-directory: projects/rocprofiler-systems/.github
run: |
if [ '${{ github.event_name }}' = 'schedule' ] || [ '${{ inputs.mode }}' = 'nightly' ]; then
MATRIX_CONTENT=$(cat ci-matrix.yml | yq '.matrix-nightly' -I=0 -o=json)
else
MATRIX_CONTENT=$(cat ci-matrix.yml | yq '.matrix-ci' -I=0 -o=json)
fi
echo "matrix=${MATRIX_CONTENT}" >> $GITHUB_OUTPUT
ubuntu:
name: Ubuntu ${{ matrix.system.os-release }} • ${{ matrix.system.arch }}
needs: prepare_matrix
strategy:
fail-fast: false
matrix:
system: ${{ fromJSON(needs.prepare_matrix.outputs.matrix) }}
runs-on: ${{ matrix.system.runner }}
env:
HIP_PLATFORM: "amd"
ROCPROFSYS_CI: ON
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
permissions:
packages: read
container:
image: ghcr.io/rocm/rocprofiler-ubuntu:${{ matrix.system.os-release }}-systems-ci-${{ matrix.system.arch }}
options:
--privileged
--ipc host
--group-add video
--device /dev/kfd
--device /dev/dri
--cap-add CAP_SYS_ADMIN
steps:
- uses: actions/checkout@v5
with:
sparse-checkout: projects/rocprofiler-systems/
- name: Setup Environment
id: setup_env
run: |
if [ '${{ github.event_name }}' = 'schedule' ] || [ '${{ inputs.mode }}' = 'nightly' ]; then
MODE=Nightly
else
MODE=Continuous
fi
echo "mode=${MODE}" >> $GITHUB_OUTPUT
if [ '${{ matrix.system.os-release }}' = '24.04']; then
CODE_NAME=noble
else
CODE_NAME=jammy
fi
echo "code_name=${CODE_NAME}" >> $GITHUB_OUTPUT
- name: Install amdgpu and dependencies
shell: bash
run: |
ROCM_MAJOR=$(echo ${{ env.ROCM_VERSION }} | sed 's/\./ /g' | awk '{print $1}')
ROCM_MINOR=$(echo ${{ env.ROCM_VERSION }} | sed 's/\./ /g' | awk '{print $2}')
ROCM_VERSN=$(( (${ROCM_MAJOR}*10000)+(${ROCM_MINOR}*100) ))
wget -N -P /tmp/ https://repo.radeon.com/amdgpu-install/${ROCM_MAJOR}.${ROCM_MINOR}/ubuntu/${{ steps.setup_env.outputs.code_name }}/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
apt-get install -y /tmp/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
apt-get update
apt install -y amd-smi-lib libdw-dev rocjpeg-test rocdecode-test rccl-dev
echo "✅ amdgpu and ROCm dependencies Installed!"
- name: Install MPI
run: |
apt install -y libopenmpi-dev
echo "✅ MPI Installed!"
# TODO: Remove this and replace with TheRock tarball when runtime error is fixed
- name: Install ROCm
run: |
apt install -y rocm-dev
echo "✅ ROCm Installation Complete!"
# TODO: Enable this step and remove the above step once runtime error is fixed
- name: Install Latest Nightly ROCm
if: false
run: |
set -e
TARBALL_ROCM_VERSION=$(ls /opt/*.tar.gz | grep -Eo '*([0-9]\.[0-9]\.[0-9])*')
tar -xf ${{ env.ROCM_PATH }}-${TARBALL_ROCM_VERSION}-${{ matrix.system.arch }}.tar.gz -C ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}
ln -s ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} ${{ env.ROCM_PATH }}
echo "ROCm installed to: ${{ env.ROCM_PATH }}"
echo "✅ ROCm Installation Complete!"
- name: Configure, Build, and Test
id: run_ci
timeout-minutes: 30
working-directory: projects/rocprofiler-systems
run: |
set -e
git config --global --add safe.directory ${GITHUB_WORKSPACE}
git config --global --add safe.directory ${PWD}
PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH \
LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH \
python3 ./scripts/run-ci.py -B build \
--name ${{ github.repository }}-${{ github.ref_name }}-ubuntu-${{ matrix.system.os-release }}-${{ matrix.system.gpu }} \
--build-jobs 16 \
--site ${{ matrix.system.runner }} \
--mode ${{ steps.setup_env.outputs.mode }} \
-- \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }} \
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-systems \
-DROCPROFSYS_BUILD_DYNINST=ON \
-DROCPROFSYS_BUILD_BOOST=ON \
-DROCPROFSYS_BUILD_TBB=ON \
-DROCPROFSYS_BUILD_ELFUTILS=ON \
-DROCPROFSYS_BUILD_LIBIBERTY=ON \
-DROCPROFSYS_BUILD_CI=ON \
-DROCPROFSYS_BUILD_TESTING=ON \
-DROCPROFSYS_USE_PYTHON=ON \
-DROCPROFSYS_USE_ROCM=ON \
-DROCPROFSYS_MAX_THREADS=64 \
-- \
-L "rocm" \
-LE "rccl|runtime|ompvv"
- name: Check for Leftover Buffered Files
timeout-minutes: 5
working-directory: projects/rocprofiler-systems/
run: |
set -v
if find /tmp -maxdepth 1 -name 'buffered*' -print -quit | grep -q .; then
echo "Error: Found leftover buffered storage files in /tmp:"
ls -lh /tmp/buffered*
exit 1
else
echo "✓ No buffered storage files found in /tmp"
fi
- name: Output Logs
if: failure() && steps.run_ci.outcome == 'failure'
working-directory: projects/rocprofiler-systems
run: |
echo "❌ Run Failed: Now outputting LastTest.log files for detailed logs..."
cat build/Testing/Temporary/LastTest*.log
@@ -0,0 +1,207 @@
name: rocprofiler-systems Installer Packaging (CPack)
run-name: cpack
on:
workflow_dispatch:
push:
branches:
- develop
paths:
- 'projects/rocprofiler-systems/docker/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
tags:
- "v[1-9].[0-9]+.[0-9]+*"
- "rocm-[1-9].[0-9]+.[0-9]+*"
pull_request:
paths:
- '.github/workflows/rocprofiler-systems-cpack.yml'
- 'projects/rocprofiler-systems/docker/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!docs/**'
- '!projects/*/docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
jobs:
installers:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# ubuntu 22.04
- os-distro: "ubuntu"
os-version: "22.04"
rocm-version: "0.0"
- os-distro: "ubuntu"
os-version: "22.04"
rocm-version: "6.3"
- os-distro: "ubuntu"
os-version: "22.04"
rocm-version: "6.4"
# ubuntu 24.04
- os-distro: "ubuntu"
os-version: "24.04"
rocm-version: "0.0"
- os-distro: "ubuntu"
os-version: "24.04"
rocm-version: "6.3"
- os-distro: "ubuntu"
os-version: "24.04"
rocm-version: "6.4"
# opensuse 15.5
- os-distro: "opensuse"
os-version: "15.5"
rocm-version: "0.0"
- os-distro: "opensuse"
os-version: "15.5"
rocm-version: "6.3"
# opensuse 15.6
- os-distro: "opensuse"
os-version: "15.6"
rocm-version: "0.0"
- os-distro: "opensuse"
os-version: "15.6"
rocm-version: "6.3"
- os-distro: "opensuse"
os-version: "15.6"
rocm-version: "6.4"
# RHEL 8.10
- os-distro: "rhel"
os-version: "8.10"
rocm-version: "0.0"
- os-distro: "rhel"
os-version: "8.10"
rocm-version: "6.3"
- os-distro: "rhel"
os-version: "8.10"
rocm-version: "6.4"
# RHEL 9.4
- os-distro: "rhel"
os-version: "9.4"
rocm-version: "0.0"
- os-distro: "rhel"
os-version: "9.4"
rocm-version: "6.3"
- os-distro: "rhel"
os-version: "9.4"
rocm-version: "6.4"
# RHEL 9.5
- os-distro: "rhel"
os-version: "9.5"
rocm-version: "0.0"
- os-distro: "rhel"
os-version: "9.5"
rocm-version: "6.3"
- os-distro: "rhel"
os-version: "9.5"
rocm-version: "6.4"
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@v1.2.0
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
swap-storage: false
- uses: actions/checkout@v4
with:
sparse-checkout: |
projects/rocprofiler-systems
.github
submodules: recursive
- name: Configure ROCm Version
if: ${{ matrix.rocm-version == 0 }}
run: |
echo "CI_SCRIPT_ARGS=--core +python" >> $GITHUB_ENV
- name: Configure ROCm Version
if: ${{ matrix.rocm-version > 0 }}
run: |
echo "CI_SCRIPT_ARGS=--rocm +python" >> $GITHUB_ENV
- name: Configure Generators
run: |
echo "CI_GENERATOR_ARGS=--generators STGZ" >> $GITHUB_ENV
- name: Build Base Container
timeout-minutes: 30
working-directory: projects/rocprofiler-systems
run: |
pushd docker
./build-docker.sh --distro ${{ matrix.os-distro }} --versions ${{ matrix.os-version }} --rocm-versions ${{ matrix.rocm-version }}
popd
- name: Build Release
timeout-minutes: 150
working-directory: projects/rocprofiler-systems
run: |
pushd docker
./build-docker-release.sh --distro ${{ matrix.os-distro }} --versions ${{ matrix.os-version }} --rocm-versions ${{ matrix.rocm-version }} -- ${CI_SCRIPT_ARGS} ${CI_GENERATOR_ARGS}
popd
- name: List Files
timeout-minutes: 10
working-directory: projects/rocprofiler-systems
run: |
find build-release -type f | egrep '\.(sh|deb|rpm)$'
- name: STGZ Artifacts
timeout-minutes: 10
uses: actions/upload-artifact@v4
with:
name: rocprofiler-systems-stgz-${{ matrix.os-distro }}-${{ matrix.os-version }}-rocm-${{ matrix.rocm-version }}-installer
path: |
projects/rocprofiler-systems/build-release/stgz/*.sh
# before testing remove any artifacts of the build
- name: Remove Build
timeout-minutes: 10
working-directory: projects/rocprofiler-systems
run: |
shopt -s nullglob
for i in $(find build-release -type f | egrep '/(stgz|deb|rpm)/.*\.(sh|deb|rpm)$'); do mv ${i} ./; done
sudo rm -rf build-release
sudo rm -rf /opt/rocprofiler-systems
- name: Test STGZ Install
timeout-minutes: 20
working-directory: projects/rocprofiler-systems
run: |
set -v
for i in rocprofiler-systems-*.sh
do
./docker/test-docker-release.sh --distro ${{ matrix.os-distro }} --versions ${{ matrix.os-version }} --rocm-versions ${{ matrix.rocm-version }} -- --stgz ${i}
done
- name: Upload STGZ Release Assets
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: True
files: |
projects/rocprofiler-systems/rocprofiler-systems-*.sh
@@ -0,0 +1,224 @@
name: rocprofiler-systems Debian (GCC, Python, ROCm)
run-name: debian
on:
push:
branches:
- develop
paths:
- '.github/workflows/rocprofiler-systems-debian.yml'
- 'projects/rocprofiler-systems/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/CMakePresets.json'
pull_request:
paths:
- '.github/workflows/rocprofiler-systems-debian.yml'
- 'projects/rocprofiler-systems/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/CMakePresets.json'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ROCPROFSYS_CI: ON
ROCPROFSYS_TMPDIR: "%env{PWD}%/testing-tmp"
jobs:
debian:
runs-on: ubuntu-latest
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-debian-${{ matrix.os-release }}
strategy:
fail-fast: false
matrix:
compiler: ['g++']
python: ['ON']
build-type: ['Release']
build-dyninst: ['ON']
os-release: ['12']
rocm-version: ['6.4', '7.0', '7.1']
env:
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
ROCPROFSYS_CI: 'ON'
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems/
- name: Install Packages
timeout-minutes: 25
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 30
timeout_minutes: 25
max_attempts: 5
command: |
apt-get update &&
apt-get upgrade -y &&
apt-get install -y libomp-dev libopenmpi-dev &&
apt-get autoclean
- name: Install ROCm Packages
if: ${{ matrix.rocm-version > 0 }}
timeout-minutes: 115
shell: bash
working-directory: projects/rocprofiler-systems/
run: |
ROCM_VERSION=${{ matrix.rocm-version }}
ROCM_MAJOR=$(echo ${ROCM_VERSION} | sed 's/\./ /g' | awk '{print $1}')
ROCM_MINOR=$(echo ${ROCM_VERSION} | sed 's/\./ /g' | awk '{print $2}')
ROCM_VERSN=$(( (${ROCM_MAJOR}*10000)+(${ROCM_MINOR}*100) ))
echo "ROCM_MAJOR=${ROCM_MAJOR} ROCM_MINOR=${ROCM_MINOR} ROCM_VERSN=${ROCM_VERSN}"
wget -q https://repo.radeon.com/amdgpu-install/${{ matrix.rocm-version }}/ubuntu/jammy/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
apt-get install -y ./amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
apt-get update
apt-get install -y rocm-dev rocdecode-dev libavformat-dev libavcodec-dev
apt-get autoclean
- name: Configure, Build and Test
timeout-minutes: 115
shell: bash
working-directory: projects/rocprofiler-systems/
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE} &&
git config --global --add safe.directory ${PWD}
echo "CMake version: $(cmake --version | head -n 1)"
echo "Compiler version: $(${{ matrix.compiler }} --version | head -n 1)"
echo "ROCm version: ${{ matrix.rocm-version }}"
USE_ROCM=OFF
if [ "${{ matrix.rocm-version }}" != "0.0" ]; then
CMAKE_PREFIX_PATH_ARG="-DCMAKE_PREFIX_PATH=/opt/rocm"
USE_ROCM=ON
else
CMAKE_PREFIX_PATH_ARG=""
fi
TAG=""
python3 ./scripts/run-ci.py -B build \
--name ${{ github.repository_owner }}-${{ github.ref_name }}-debian-${{matrix.os-release}}-${{ matrix.compiler }}${TAG} \
--build-jobs 2 \
--site GitHub \
-- \
-DCMAKE_C_COMPILER=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g') \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-systems \
-DROCPROFSYS_BUILD_TESTING=ON \
-DROCPROFSYS_USE_ROCM=$USE_ROCM \
-DROCPROFSYS_USE_PYTHON=ON \
-DROCPROFSYS_BUILD_DYNINST=${{ matrix.build-dyninst }} \
-DROCPROFSYS_BUILD_BOOST=${{ matrix.build-dyninst }} \
-DROCPROFSYS_BUILD_TBB=${{ matrix.build-dyninst }} \
-DROCPROFSYS_BUILD_ELFUTILS=${{ matrix.build-dyninst }} \
-DROCPROFSYS_BUILD_LIBIBERTY=${{ matrix.build-dyninst }} \
-DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs \
-DROCPROFSYS_PYTHON_ENVS="py3.8;py3.9;py3.10;py3.11;py3.12;py3.13" \
-DROCPROFSYS_MAX_THREADS=64 \
-DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl;openmp-target;openmp-vv-offload;videodecode;jpegdecode;network" \
-DROCPROFSYS_BUILD_NUMBER=1 \
-DUSE_CLANG_OMP=OFF \
$CMAKE_PREFIX_PATH_ARG \
-- \
-LE "transpose|rccl|videodecode|jpegdecode|network"
- name: Check for Leftover Buffered Files
timeout-minutes: 5
working-directory: projects/rocprofiler-systems/
run: |
set -v
if find /tmp -maxdepth 1 -name 'buffered*' -print -quit | grep -q .; then
echo "Error: Found leftover buffered storage files in /tmp:"
ls -lh /tmp/buffered*
exit 1
else
echo "✓ No buffered storage files found in /tmp"
fi
- name: Test Clean Up
timeout-minutes: 10
working-directory: projects/rocprofiler-systems/
run: |
set -v
du /tmp -d 1 -h
du build/rocprof-sys-tests-output -d 1 -h
df -h
rm -fr /tmp/* build/rocprof-sys-tests-output/*
- name: Install
timeout-minutes: 10
working-directory: projects/rocprofiler-systems/
run: |
cmake --build build --target install --parallel 2
rm -rf /opt/rocprofiler-systems
- name: CPack and Install
working-directory: projects/rocprofiler-systems/
run: |
cd build
cpack -G STGZ
mkdir -p /opt/rocprofiler-systems
./rocprofiler-systems-*.sh --prefix=/opt/rocprofiler-systems --exclude-subdir --skip-license
- name: Test Install with Modulefile
working-directory: projects/rocprofiler-systems/
timeout-minutes: 15
shell: bash
run: |
set -v
source /usr/share/modules/init/$(basename ${SHELL})
module use /opt/rocprofiler-systems/share/modulefiles
module avail
module load rocprofiler-systems
./scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,python,rewrite,runtime}=1
- name: Test User API
timeout-minutes: 10
working-directory: projects/rocprofiler-systems/
run: |
set -v
./scripts/test-find-package.sh --install-dir /opt/rocprofiler-systems
- name: CTest Artifacts
if: failure()
continue-on-error: True
uses: actions/upload-artifact@v4
with:
name: ctest-${{ github.job }}-${{ strategy.job-index }}-log
path: |
projects/rocprofiler-systems/build/*.log
- name: Data Artifacts
if: failure()
continue-on-error: True
uses: actions/upload-artifact@v4
with:
name: data-${{ github.job }}-${{ strategy.job-index }}-files
path: |
projects/rocprofiler-systems/build/rocprofsys-tests-config/*.cfg
projects/rocprofiler-systems/build/rocprofsys-tests-output/**/*.txt
projects/rocprofiler-systems/build/rocprofsys-tests-output/**/*-instr*.json
@@ -0,0 +1,187 @@
name: rocprofiler-systems Formatting
run-name: formatting
on:
push:
branches:
- develop
paths:
- 'projects/rocprofiler-systems/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!docs/**'
- '!projects/*/docs/**'
pull_request:
paths:
- '.github/workflows/rocprofiler-systems-formatting.yml'
- 'projects/rocprofiler-systems/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!docs/**'
- '!projects/*/docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-md:
name: "Markdown"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems
- name: Fetch config
shell: sh
working-directory: projects/rocprofiler-systems/
run: |
test -f .markdownlint.yaml && echo "Using local config file" || curl --silent --show-error --fail --location https://raw.github.com/ROCm/rocm-docs-core/develop/.markdownlint.yaml -O
- name: Use markdownlint-cli2
uses: DavidAnson/markdownlint-cli2-action@v10.0.1
with:
globs: "projects/rocprofiler-systems/**/*.md"
spelling:
name: "Spelling"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems
- name: Fetch config
working-directory:
shell: sh
run: |
cp projects/rocprofiler-systems/.wordlist.txt .
curl --silent --show-error --fail --location https://raw.github.com/ROCm/rocm-docs-core/develop/.spellcheck.yaml -o .spellcheck.yaml
curl --silent --show-error --fail --location https://raw.github.com/ROCm/rocm-docs-core/develop/.wordlist.txt >> .wordlist.txt
sed -i "s|docs/\*\*/\*.md|projects/rocprofiler-systems/docs/**/*.md|g" .spellcheck.yaml
- name: Run spellcheck
uses: rojopolis/spellcheck-github-actions@0.46.0
- name: On fail
if: failure()
run: |
echo "Please check for spelling mistakes or add them to '.wordlist.txt' in either the root of this project or in rocm-docs-core."
python:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: black format
run: |
cd projects/rocprofiler-systems
black --diff --check .
cmake:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install gersemi==0.23.1
- name: gersemi
working-directory: projects/rocprofiler-systems/
run: |
set +e
gersemi -i $(find . -type f ! -path '*/external/*' | grep -E 'CMakeLists.txt|\.cmake$')
if [ $(git diff | wc -l) -gt 0 ]; then
echo -e "\nError! CMake code not formatted. Run gersemi ...\n"
echo -e "\nFiles:\n"
git diff --name-only
echo -e "\nFull diff:\n"
git diff
exit 1
fi
source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems
- name: Install dependencies
run: |
DISTRIB_CODENAME=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F '=' '{print $NF}')
sudo apt-get update
sudo apt-get install -y software-properties-common wget curl clang-format-18
- name: clang-format
working-directory: projects/rocprofiler-systems/
run: |
set +e
FILES=$(find source examples tests -type f | egrep '\.(h|hpp|c|cpp)(|\.in)$')
FORMAT_OUT=$(clang-format-18 -output-replacements-xml ${FILES})
RET=$(echo ${FORMAT_OUT} | grep -c '<replacement ')
if [ "${RET}" -ne 0 ]; then
echo -e "\nError! Code not formatted. Detected ${RET} lines\n"
clang-format-18 -i ${FILES}
git diff
exit ${RET}
fi
includes:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems
- name: check-includes
working-directory: projects/rocprofiler-systems/
run: |
set +e
FILES=$(find source examples -type f | egrep '\.(hpp|cpp)(|\.in)$')
MATCHES=$(egrep 'include "timemory/|include <bits/' ${FILES})
if [ -n "${MATCHES}" ]; then
echo -e "\nError! Included timemory header with quotes or bits folder included\n"
echo -e "### MATCHES: ###"
echo -e "${MATCHES}"
echo -e "################"
exit 1
fi
@@ -0,0 +1,163 @@
name: rocprofiler-systems GHCR Packages for CI Images
on:
workflow_dispatch:
schedule:
- cron: 0 5 * * *
push:
branches:
- develop
paths:
- '.github/workflows/rocprofiler-systems-ghcr.yml'
- 'projects/rocprofiler-systems/docker/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!docs/**'
- '!projects/*/docs/**'
pull_request:
paths:
- '.github/workflows/rocprofiler-systems-ghcr.yml'
- 'projects/rocprofiler-systems/docker/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!docs/**'
- '!projects/*/docs/**'
jobs:
prepare_matrix_ci:
if: github.repository == 'ROCm/rocm-systems'
runs-on: ubuntu-latest
outputs:
matrix_data: ${{ steps.generate_matrix_ci_base.outputs.matrix_data }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems/docker
- name: Output data for containers matrix
working-directory: projects/rocprofiler-systems/docker
id: generate_matrix_ci_base
run: |
MATRIX_CONTENT=$(cat containers-ci.yml | yq '.matrix' -I=0 -o=json)
echo "matrix_data=$MATRIX_CONTENT" >> $GITHUB_OUTPUT
rocprofiler-systems-ci-gfx:
needs: prepare_matrix_ci
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
system: ${{ fromJSON(needs.prepare_matrix_ci.outputs.matrix_data) }}
gpu: [ 'gfx94X', 'gfx950' ]
steps:
- name: Checkout Repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
sparse-checkout: projects/rocprofiler-systems
submodules: recursive
- name: Login to GitHub Container Registry
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker variables
id: setup_vars_gfx
run: |
if [ ${{ matrix.system.distro }} = "opensuse" ]; then
DISTRO_IMAGE="opensuse/leap"
elif [ ${{ matrix.system.distro }} = "rhel" ]; then
DISTRO_IMAGE="rockylinux/rockylinux"
else
DISTRO_IMAGE=${{ matrix.system.distro }}
fi
echo "distro_image=${DISTRO_IMAGE}" >> $GITHUB_OUTPUT
if [ ${{ matrix.system.distro }} = "debian" ]; then
DOCKER_FILE=Dockerfile.ubuntu.ci
else
DOCKER_FILE=Dockerfile.${{ matrix.system.distro }}.ci
fi
echo "docker_file=${DOCKER_FILE}" >> $GITHUB_OUTPUT
- name: Get the latest build of The Rock tarball
id: therock
run: |
sudo apt-get install -y python3-pip
python3 -m pip install -U pip
python3 -m pip install -U awscli
export PATH=~/.local/bin:$PATH
KEY=$(aws s3api list-objects-v2 \
--bucket therock-nightly-tarball \
--no-sign-request \
--output json \
--query "sort_by(Contents[?contains(Key, 'linux-${{ matrix.gpu }}')], &LastModified)[-1].Key")
KEY=${KEY//\"/}
test -n "$KEY" || { echo "No ${{ matrix.gpu }} tarball found"; exit 1; }
echo "tarball=${KEY}" >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.7.9
with:
images: ghcr.io/ROCm/rocprofiler-${{ matrix.system.distro }}
- name: Build CI GFX Container (Does not Push on PR)
id: docker_build
continue-on-error: true
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
file: projects/rocprofiler-systems/docker/${{ steps.setup_vars_gfx.outputs.docker_file }}
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
build-args: |
DISTRO=${{ steps.setup_vars_gfx.outputs.distro_image }}
VERSION=${{ matrix.system.version }}
TYPE=${{ matrix.gpu }}
GPU_TYPE=${{ matrix.gpu }}
GPU_TARBALL=${{ steps.therock.outputs.tarball }}
NJOBS=2
ELFUTILS_DOWNLOAD_VERSION=0.188
BOOST_DOWNLOAD_VERSION=1.79.0
tags: |
ghcr.io/rocm/rocprofiler-${{ matrix.system.distro }}:${{ matrix.system.version }}-systems-ci-${{ matrix.gpu }}
labels: ${{ steps.meta.outputs.labels }}
# Retry a copy of docker_build if Docker build failed due to intermittent failure
- name: Build CI GFX Container Retry (Does not Push on PR)
if: steps.docker_build.outcome != 'success'
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
file: projects/rocprofiler-systems/docker/${{ steps.setup_vars_gfx.outputs.docker_file }}
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
build-args: |
DISTRO=${{ steps.setup_vars_gfx.outputs.distro_image }}
VERSION=${{ matrix.system.version }}
TYPE=${{ matrix.gpu }}
GPU_TYPE=${{ matrix.gpu }}
GPU_TARBALL=${{ steps.therock.outputs.tarball }}
NJOBS=2
ELFUTILS_DOWNLOAD_VERSION=0.188
BOOST_DOWNLOAD_VERSION=1.79.0
tags: |
ghcr.io/rocm/rocprofiler-${{ matrix.system.distro }}:${{ matrix.system.version }}-systems-ci-${{ matrix.gpu }}
labels: ${{ steps.meta.outputs.labels }}
@@ -0,0 +1,189 @@
name: rocprofiler-systems OpenSUSE 15 (GCC, Python)
run-name: opensuse-15
on:
push:
branches:
- develop
paths:
- '.github/workflows/rocprofiler-systems-opensuse.yml'
- 'projects/rocprofiler-systems/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/CMakePresets.json'
pull_request:
paths:
- '.github/workflows/rocprofiler-systems-opensuse.yml'
- 'projects/rocprofiler-systems/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/CMakePresets.json'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ROCPROFSYS_CI: ON
ROCPROFSYS_TMPDIR: "%env{PWD}%/testing-tmp"
jobs:
opensuse:
runs-on: ubuntu-latest
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-opensuse-${{ matrix.os-release }}
strategy:
fail-fast: false
matrix:
compiler: ['g++']
os-release: [ '15.5', '15.6' ]
build-type: ['Release']
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems/
- name: Install Packages
timeout-minutes: 25
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 30
timeout_minutes: 25
max_attempts: 5
command: |
if [ "${{ matrix.os-release }}" == "15.5" ]; then
wget https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v47.0/linux-amd64/trace_processor_shell -P /opt/trace_processor/bin &&
chmod +x /opt/trace_processor/bin/trace_processor_shell
fi
python3 -m pip install --upgrade pip &&
python3 -m pip install --upgrade numpy perfetto dataclasses &&
python3 -m pip install 'cmake==3.21' &&
for i in 6 7 8 9 10 11; do /opt/conda/envs/py3.${i}/bin/python -m pip install --upgrade numpy perfetto dataclasses; done
- name: Configure Env
working-directory: projects/rocprofiler-systems/
run:
echo "CC=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g')" >> $GITHUB_ENV &&
echo "CXX=${{ matrix.compiler }}" >> $GITHUB_ENV &&
echo "/opt/rocprofiler-systems/bin:${HOME}/.local/bin" >> $GITHUB_PATH &&
echo "LD_LIBRARY_PATH=/opt/rocprofiler-systems/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
- name: Configure, Build, and Test
timeout-minutes: 115
shell: bash
working-directory: projects/rocprofiler-systems/
run:
git config --global --add safe.directory ${GITHUB_WORKSPACE} &&
git config --global --add safe.directory ${PWD} &&
cmake --version &&
python3 ./scripts/run-ci.py -B build
--name ${{ github.repository_owner }}-${{ github.ref_name }}-opensuse-${{ matrix.os-release }}-${{ matrix.compiler }}-nompi-python
--build-jobs 2
--site GitHub
--
-DCMAKE_C_COMPILER=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g')
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-systems
-DROCPROFSYS_BUILD_TESTING=ON
-DROCPROFSYS_USE_MPI=OFF
-DROCPROFSYS_USE_ROCM=OFF
-DROCPROFSYS_USE_OMPT=OFF
-DROCPROFSYS_USE_PYTHON=ON
-DROCPROFSYS_BUILD_DYNINST=ON
-DROCPROFSYS_BUILD_BOOST=ON
-DROCPROFSYS_BUILD_TBB=ON
-DROCPROFSYS_BUILD_ELFUTILS=ON
-DROCPROFSYS_BUILD_LIBIBERTY=ON
-DROCPROFSYS_INSTALL_PERFETTO_TOOLS=OFF
-DROCPROFSYS_USE_MPI_HEADERS=ON
-DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs
-DROCPROFSYS_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10;py3.11"
-DROCPROFSYS_CI_MPI_RUN_AS_ROOT=ON
-DROCPROFSYS_MAX_THREADS=64
-DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl;openmp-target;openmp-vv-offload;videodecode;jpegdecode"
-DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }}
--
-LE "transpose|rccl|videodecode|jpegdecode|network|mpi"
- name: Install
timeout-minutes: 10
working-directory: projects/rocprofiler-systems/
run:
cmake --build build --target install --parallel 2
- name: Test Install
timeout-minutes: 10
working-directory: projects/rocprofiler-systems/
run: |
set -v
export ROCPROFSYS_DEBUG=ON
which rocprof-sys-avail
ldd $(which rocprof-sys-avail)
rocprof-sys-avail --help
rocprof-sys-avail -a
which rocprof-sys-instrument
ldd $(which rocprof-sys-instrument)
rocprof-sys-instrument --help
rocprof-sys-instrument -e -v 1 -o ls.inst --simulate -- ls
for i in $(find rocprofsys-ls.inst-output -type f); do echo -e "\n\n --> ${i} \n\n"; cat ${i}; done
rocprof-sys-instrument -e -v 1 -o ls.inst -- ls
rocprof-sys-run -- ./ls.inst
rocprof-sys-instrument -e -v 1 --simulate -- ls
for i in $(find rocprofsys-ls-output -type f); do echo -e "\n\n --> ${i} \n\n"; cat ${i}; done
rocprof-sys-instrument -e -v 1 -- ls
- name: Test User API
timeout-minutes: 10
working-directory: projects/rocprofiler-systems/
run: |
set -v
./scripts/test-find-package.sh --install-dir /opt/rocprofiler-systems
- name: CTest Artifacts
if: failure()
continue-on-error: True
uses: actions/upload-artifact@v4
with:
name: ctest-${{ github.job }}-${{ strategy.job-index }}-log
path: |
projects/rocprofiler-systems/build/*.log
- name: Data Artifacts
if: failure()
continue-on-error: True
uses: actions/upload-artifact@v4
with:
name: data-${{ github.job }}-${{ strategy.job-index }}-files
path: |
projects/rocprofiler-systems/build/rocprofsys-tests-config/*.cfg
projects/rocprofiler-systems/build/rocprofsys-tests-output/**/*.txt
projects/rocprofiler-systems/build/rocprofsys-tests-output/**/*-instr*.json
- name: Kill Perfetto
if: success() || failure()
continue-on-error: True
working-directory: projects/rocprofiler-systems/
run: |
set +e
RUNNING_PROCS=$(pgrep trace_processor_shell)
if [ -n "${RUNNING_PROCS}" ]; then kill -s 9 ${RUNNING_PROCS}; fi
@@ -0,0 +1,67 @@
name: rocprofiler-systems Python Linting
run-name: Python
on:
push:
branches:
- develop
paths:
- 'projects/rocprofiler-systems/**'
- 'projects/rocprofiler-systems/source/python/gui/*.py'
- 'projects/rocprofiler-systems/source/python/gui/**/*.py'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!docs/**'
- '!projects/*/docs/**'
pull_request:
paths:
- 'projects/rocprofiler-systems/**'
- 'projects/rocprofiler-systems/source/python/gui/*.py'
- 'projects/rocprofiler-systems/source/python/gui/**/*.py'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!docs/**'
- '!projects/*/docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
linting:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: projects/rocprofiler-systems/source/python/gui
run: |
python -m pip install --upgrade pip
pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
working-directory: projects/rocprofiler-systems/source/python/gui
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# flake8 options are defined in setup.cfg
flake8 . --count --statistics
@@ -0,0 +1,220 @@
name: rocprofiler-systems RedHat Linux (GCC, Python, ROCm)
run-name: redhat
on:
push:
branches:
- develop
paths:
- '.github/workflows/rocprofiler-systems-redhat.yml'
- 'projects/rocprofiler-systems/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/CMakePresets.json'
pull_request:
paths:
- '.github/workflows/rocprofiler-systems-redhat.yml'
- 'projects/rocprofiler-systems/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/CMakePresets.json'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ROCPROFSYS_CI: ON
ROCPROFSYS_TMPDIR: "%env{PWD}%/testing-tmp"
jobs:
rhel:
runs-on: ubuntu-latest
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-rhel-${{ matrix.os-release }}
strategy:
fail-fast: false
matrix:
compiler: ['g++']
os-release: [ '8.10', '9.4' ]
rocm-version: [ '0.0', '6.3', '6.4', '7.0', '7.1' ]
build-type: ['Release']
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems/
- name: Configure Env
shell: bash
working-directory: projects/rocprofiler-systems/
run:
echo "CC=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g')" >> $GITHUB_ENV &&
echo "CXX=${{ matrix.compiler }}" >> $GITHUB_ENV &&
echo "OS_VERSION_MAJOR=$(cat /etc/os-release | grep 'VERSION_ID' | sed 's/=/ /1' | awk '{print $NF}' | sed 's/"//g' | sed 's/\./ /g' | awk '{print $1}')" >> $GITHUB_ENV &&
env
- name: Install Packages
shell: bash
working-directory: projects/rocprofiler-systems/
run: |
if [ $OS_VERSION_MAJOR -eq 8 ]; then
wget https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v47.0/linux-amd64/trace_processor_shell -P /opt/trace_processor/bin &&
chmod +x /opt/trace_processor/bin/trace_processor_shell
fi
python3 -m pip install --upgrade pip &&
python3 -m pip install --upgrade numpy perfetto dataclasses &&
python3 -m pip install 'cmake==3.21' &&
for i in 6 7 8 9 10 11; do /opt/conda/envs/py3.${i}/bin/python -m pip install --upgrade numpy perfetto dataclasses; done
- name: Install ROCm Packages
if: ${{ matrix.rocm-version > 0 }}
timeout-minutes: 30
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 30
timeout_minutes: 30
max_attempts: 3
command: |
RPM_TAG=".el${OS_VERSION_MAJOR}"
ROCM_VERSION=${{ matrix.rocm-version }}
ROCM_MAJOR=$(echo ${ROCM_VERSION} | sed 's/\./ /g' | awk '{print $1}')
ROCM_MINOR=$(echo ${ROCM_VERSION} | sed 's/\./ /g' | awk '{print $2}')
ROCM_VERSN=$(( (${ROCM_MAJOR}*10000)+(${ROCM_MINOR}*100) ))
if [ "${OS_VERSION_MAJOR}" -eq 8 ]; then PERL_REPO=powertools; else PERL_REPO=crb; fi
dnf -y --enablerepo=${PERL_REPO} install perl-File-BaseDir
yum install -y https://repo.radeon.com/amdgpu-install/${{ matrix.rocm-version }}/rhel/${{ matrix.os-release }}/amdgpu-install-${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1${RPM_TAG}.noarch.rpm
yum install -y rocm-dev rocdecode-devel
if [ "${OS_VERSION_MAJOR}" -gt 8 ]; then dnf install -y libavcodec-free-devel libavformat-free-devel; fi
- name: Configure, Build, and Test
timeout-minutes: 115
shell: bash
working-directory: projects/rocprofiler-systems/
run:
git config --global --add safe.directory ${GITHUB_WORKSPACE} &&
git config --global --add safe.directory ${PWD} &&
cmake --version &&
TAG="${{ github.repository_owner }}-${{ github.ref_name }}-rhel-${{ matrix.os-release }}-${{ matrix.compiler }}-python-mpip" &&
USE_HIP=OFF &&
if [ ${{ matrix.rocm-version }} != "0.0" ]; then USE_HIP=ON; TAG="${TAG}-rocm-${{ matrix.rocm-version }}"; fi &&
python3 ./scripts/run-ci.py -B build
--name ${TAG}
--build-jobs 2
--site GitHub
--
-DCMAKE_C_COMPILER=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g')
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-systems
-DROCPROFSYS_BUILD_TESTING=ON
-DROCPROFSYS_USE_MPI=OFF
-DROCPROFSYS_USE_ROCM=${USE_HIP}
-DROCPROFSYS_USE_OMPT=OFF
-DROCPROFSYS_USE_PYTHON=ON
-DROCPROFSYS_BUILD_DYNINST=ON
-DROCPROFSYS_BUILD_BOOST=ON
-DROCPROFSYS_BUILD_TBB=ON
-DROCPROFSYS_BUILD_ELFUTILS=ON
-DROCPROFSYS_BUILD_LIBIBERTY=ON
-DROCPROFSYS_USE_MPI_HEADERS=ON
-DROCPROFSYS_CI_MPI_RUN_AS_ROOT=ON
-DROCPROFSYS_MAX_THREADS=64
-DROCPROFSYS_INSTALL_PERFETTO_TOOLS=OFF
-DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs
-DROCPROFSYS_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10;py3.11"
-DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl;openmp-target;openmp-vv-offload"
-DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }}
--
-LE "transpose|rccl|videodecode|jpegdecode|network"
- name: Check for Leftover Buffered Files
timeout-minutes: 5
working-directory: projects/rocprofiler-systems/
run: |
set -v
if find /tmp -maxdepth 1 -name 'buffered*' -print -quit | grep -q .; then
echo "Error: Found leftover buffered storage files in /tmp:"
ls -lh /tmp/buffered*
exit 1
else
echo "✓ No buffered storage files found in /tmp"
fi
- name: Test Clean Up
timeout-minutes: 10
working-directory: projects/rocprofiler-systems/
run: |
du /tmp -d 1 -h
du build/rocprof-sys-tests-output -d 1 -h
df -h
rm -fr /tmp/* build/rocprof-sys-tests-output/*
- name: Install
timeout-minutes: 10
working-directory: projects/rocprofiler-systems/
run:
cmake --build build --target install --parallel 2
- name: Test Install
timeout-minutes: 10
shell: bash
working-directory: projects/rocprofiler-systems/
run: |
set -v
source /opt/rocprofiler-systems/share/rocprofiler-systems/setup-env.sh
./scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,rewrite,runtime,python}=1
- name: Test User API
timeout-minutes: 10
working-directory: projects/rocprofiler-systems/
run: |
set -v
./scripts/test-find-package.sh --install-dir /opt/rocprofiler-systems
- name: CTest Artifacts
if: failure()
continue-on-error: True
uses: actions/upload-artifact@v4
with:
name: ctest-${{ github.job }}-${{ strategy.job-index }}-log
path: |
projects/rocprofiler-systems/build/*.log
- name: Data Artifacts
if: failure()
continue-on-error: True
uses: actions/upload-artifact@v4
with:
name: data-${{ github.job }}-${{ strategy.job-index }}-files
path: |
projects/rocprofiler-systems/build/rocprofsys-tests-config/*.cfg
projects/rocprofiler-systems/build/rocprofsys-tests-output/**/*.txt
projects/rocprofiler-systems/build/rocprofsys-tests-output/**/*-instr*.json
- name: Kill Perfetto
if: success() || failure()
continue-on-error: True
working-directory: projects/rocprofiler-systems/
run: |
set +e
RUNNING_PROCS=$(pgrep trace_processor_shell)
if [ -n "${RUNNING_PROCS}" ]; then kill -s 9 ${RUNNING_PROCS}; fi

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais