Merge remote-tracking branch 'origin/develop' into preserved/rocprofiler-systemsnew1

This commit is contained in:
Ameya Keshava Mallya
2025-08-06 21:59:14 +00:00
کامیت dc6450327a
7913فایلهای تغییر یافته به همراه1650057 افزوده شده و 0 حذف شده
+45
مشاهده پرونده
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,61 @@
trigger: none
pr:
branches:
include:
- develop
paths:
include:
- projects/*
- shared/*
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: Trigger_Pipeline
displayName: 'Trigger Pipeline'
pool: rocm-ci-caller
steps:
- checkout: none
- script: |
rm -rf $(repo_name)
git clone $(gh_repo)
displayName: Checkout Code
- 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)
+43
مشاهده پرونده
@@ -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
@@ -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
@@ -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
@@ -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/rocprofiler-sdk
exclude:
- projects/rocprofiler-sdk/.github
- projects/rocprofiler-sdk/ISSUE_TEMPLATE
- projects/rocprofiler-sdk/*.md
- projects/rocprofiler-sdk/CODEOWNERS
- projects/rocprofiler-sdk/LICENSE
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
@@ -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
@@ -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
@@ -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
@@ -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')"
+91
مشاهده پرونده
@@ -0,0 +1,91 @@
# Generic Ownership (broadest rules first)
**/next-cmake/ @ROCm/rocm-math-lib-build-infra
# 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/aqlprofile/ @ammarwa @bgopesh
/projects/rdc/ @dmitrii-galantsev @bill-shuzhou-liu
/projects/rocm-core/ @nunnikri @frepaul @raramakr @ashutom @amd-isparry @arvindcheru
/projects/rocm-smi-lib/ @bill-shuzhou-liu @dmitrii-galantsev @charis-poag-amd @oliveiradan
/projects/rocminfo/ @dayatsin-amd @shwetagkhatri
/projects/rocprofiler/ @ammarwa @bgopesh
/projects/rocprofiler-compute/ @coleramos425 @feizheng10 @vedithal-amd @xuchen-amd @cfallows-amd @ywang103-amd @jamessiddeley-amd
/projects/rocprofiler-register/ @ammarwa @bgopesh
/projects/rocprofiler-sdk/ @jrmadsen @t-tye
/projects/rocprofiler-systems/ @ROCm/rocprof-sys @jrmadsen
/projects/rocr-runtime/ @kentrussell @fxkamd @dayatsin-amd
/projects/roctracer/ @ammarwa @bgopesh
# rocprofiler-sdk section-specific code owners
/projects/rocprofiler-sdk/source/docs @bgopesh
/projects/rocprofiler-sdk/source/include @jrmadsen @bwelton @ammarwa
/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/rccl @MythreyaK
/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/kfd @MythreyaK
/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/cxx/codeobj @ApoKalipse-V
/projects/rocprofiler-sdk/source/bin @SrirakshaNag @bgopesh
/projects/rocprofiler-sdk/source/libexec @SrirakshaNag
/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters @bwelton
/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/pc_sampling @vlaindic
/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/thread_trace @ApoKalipse-V
/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/rccl @MythreyaK
/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/kfd @MythreyaK
/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-tool @SrirakshaNag
/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-codeobj @ApoKalipse-V
# Documentation-specific ownership by project
/projects/aqlprofile/**/*.md @ammarwa @bgopesh @ROCm/rocm-documentation
/projects/aqlprofile/**/*.rst @ammarwa @bgopesh @ROCm/rocm-documentation
/projects/rdc/**/*.md @dmitrii-galantsev @bill-shuzhou-liu @ROCm/rocm-documentation
/projects/rdc/**/*.rst @dmitrii-galantsev @bill-shuzhou-liu @ROCm/rocm-documentation
/projects/rdc/**/.readthedocs.yaml @dmitrii-galantsev @bill-shuzhou-liu @ROCm/rocm-documentation
/projects/rdc/docs/ @dmitrii-galantsev @bill-shuzhou-liu @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 @bill-shuzhou-liu @dmitrii-galantsev @charis-poag-amd @oliveiradan @ROCm/rocm-documentation
/projects/rocm-smi-lib/**/*.rst @bill-shuzhou-liu @dmitrii-galantsev @charis-poag-amd @oliveiradan @ROCm/rocm-documentation
/projects/rocm-smi-lib/**/.readthedocs.yaml @bill-shuzhou-liu @dmitrii-galantsev @charis-poag-amd @oliveiradan @ROCm/rocm-documentation
/projects/rocm-smi-lib/docs/ @bill-shuzhou-liu @dmitrii-galantsev @charis-poag-amd @oliveiradan @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/**/*.md @ammarwa @bgopesh @ROCm/rocm-documentation
/projects/rocprofiler/**/*.rst @ammarwa @bgopesh @ROCm/rocm-documentation
/projects/rocprofiler/doc/ @ammarwa @bgopesh @ROCm/rocm-documentation
/projects/rocprofiler-compute/**/*.md @coleramos425 @feizheng10 @vedithal-amd @xuchen-amd @cfallows-amd @ywang103-amd @jamessiddeley-amd @ROCm/rocm-documentation
/projects/rocprofiler-compute/**/*.rst @coleramos425 @feizheng10 @vedithal-amd @xuchen-amd @cfallows-amd @ywang103-amd @jamessiddeley-amd @ROCm/rocm-documentation
/projects/rocprofiler-compute/**/.readthedocs.yaml @coleramos425 @feizheng10 @vedithal-amd @xuchen-amd @cfallows-amd @ywang103-amd @jamessiddeley-amd @ROCm/rocm-documentation
/projects/rocprofiler-compute/docs/ @coleramos425 @feizheng10 @vedithal-amd @xuchen-amd @cfallows-amd @ywang103-amd @jamessiddeley-amd @ROCm/rocm-documentation
/projects/rocprofiler-register/**/*.md @ammarwa @bgopesh @ROCm/rocm-documentation
/projects/rocprofiler-register/**/*.rst @ammarwa @bgopesh @ROCm/rocm-documentation
/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 @fxkamd @dayatsin-amd @ROCm/rocm-documentation
/projects/rocr-runtime/**/*.rst @kentrussell @fxkamd @dayatsin-amd @ROCm/rocm-documentation
/projects/rocr-runtime/**/.readthedocs.yaml @kentrussell @fxkamd @dayatsin-amd @ROCm/rocm-documentation
/projects/roctracer/**/*.md @ammarwa @bgopesh @ROCm/rocm-documentation
/projects/roctracer/**/*.rst @ammarwa @bgopesh @ROCm/rocm-documentation
/projects/roctracer/doc/ @ammarwa @bgopesh @ROCm/rocm-documentation
+60
مشاهده پرونده
@@ -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"
+388
مشاهده پرونده
@@ -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
+100
مشاهده پرونده
@@ -0,0 +1,100 @@
{
"repositories": [
{
"name": "aqlprofile",
"url": "ROCm/aqlprofile",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "rdc",
"url": "ROCm/rdc",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "rocm-core",
"url": "ROCm/rocm-core",
"branch": "master",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "rocminfo",
"url": "ROCm/rocminfo",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "rocm-smi-lib",
"url": "ROCm/rocm_smi_lib",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "rocprofiler",
"url": "ROCm/rocprofiler",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true
},
{
"name": "rocprofiler-compute",
"url": "ROCm/rocprofiler-compute",
"branch": "develop",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "rocprofiler-register",
"url": "ROCm/rocprofiler-register",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true
},
{
"name": "rocprofiler-sdk",
"url": "ROCm/rocprofiler-sdk",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "rocprofiler-systems",
"url": "ROCm/rocprofiler-systems",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true
},
{
"name": "rocr-runtime",
"url": "ROCm/ROCR-Runtime",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": true,
"auto_subtree_push": false
},
{
"name": "roctracer",
"url": "ROCm/roctracer",
"branch": "amd-staging",
"category": "projects",
"auto_subtree_pull": false,
"auto_subtree_push": true
}
]
}
+2
مشاهده پرونده
@@ -0,0 +1,2 @@
pydantic
requests
@@ -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])
@@ -0,0 +1,87 @@
#!/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 = {
}
# Azure pipeline IDs for each project, to be populated as projects are enabled
definition_ids = {
"projects/rocprofiler-register": 327,
}
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()
@@ -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])
@@ -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)
@@ -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,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}")
@@ -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")
@@ -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()
@@ -0,0 +1,139 @@
#!/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("--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]) -> Set[str]:
"""Extract valid subtree prefixes from the configuration."""
valid_prefixes = {
f"{entry.category}/{entry.name}"
for entry in config
}
logger.debug("Valid subtrees:\n" + "\n".join(sorted(valid_prefixes)))
return valid_prefixes
def get_valid_prefixes(config: List[RepoEntry], require_auto_pull: bool = False, require_auto_push: 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
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)
matched_subtrees = find_matched_subtrees(changed_files, valid_prefixes)
output_subtrees(matched_subtrees, args.dry_run)
if __name__ == "__main__":
main()
@@ -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()
@@ -0,0 +1,51 @@
#!/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").
"""
name: str
url: str
branch: str
category: str
auto_subtree_pull: bool
auto_subtree_push: bool
class RepoConfig(BaseModel):
"""
Represents the full config file structure.
Fields:
repositories : List of RepoEntry items.
"""
repositories: List[RepoEntry]
@@ -0,0 +1,73 @@
from pathlib import Path
import os
import sys
import unittest
sys.path.insert(0, os.fspath(Path(__file__).parent.parent))
import therock_configure_ci
class ConfigureCITest(unittest.TestCase):
def test_pull_request(self):
args = {
"is_pull_request": True,
"input_subtrees": "projects/rocprim\nprojects/hipcub"
}
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertEqual(len(project_to_run), 1)
def test_pull_request_empty(self):
args = {
"is_pull_request": True,
"input_subtrees": ""
}
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertEqual(len(project_to_run), 0)
def test_workflow_dispatch(self):
args = {
"is_workflow_dispatch": True,
"input_projects": "projects/rocprim projects/hipcub"
}
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertEqual(len(project_to_run), 1)
def test_workflow_dispatch_bad_input(self):
args = {
"is_workflow_dispatch": True,
"input_projects": "projects/rocprim$$projects/hipcub"
}
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertEqual(len(project_to_run), 0)
def test_workflow_dispatch_all(self):
args = {
"is_workflow_dispatch": True,
"input_projects": "all"
}
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertGreaterEqual(len(project_to_run), 1)
def test_workflow_dispatch_empty(self):
args = {
"is_workflow_dispatch": True,
"input_projects": ""
}
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertEqual(len(project_to_run), 0)
def test_is_push(self):
args = {
"is_push": True,
}
project_to_run = therock_configure_ci.retrieve_projects(args)
self.assertGreaterEqual(len(project_to_run), 1)
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,87 @@
"""
This script determines which build flag and tests to run based on SUBTREES
Required environment variables:
- SUBTREES
"""
import json
import logging
from therock_matrix import subtree_to_project_map, project_map
from typing import Mapping
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 retrieve_projects(args):
# TODO(geomin12): #590 Enable TheRock CI for forked PRs
if args.get("is_forked_pr"):
logging.info("Warning: not enabling any projects due to is_forked_pr. Builds/tests for forked PRs are disabled pending: https://github.com/ROCm/rocm-libraries/issues/590")
return []
if args.get("is_pull_request"):
subtrees = args.get("input_subtrees").split("\n")
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())
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 = []
for project in projects:
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"
is_forked_pr = os.getenv("IS_FORKED_PR")
args["is_forked_pr"] = is_forked_pr == "true"
input_subtrees = os.getenv("SUBTREES", "")
args["input_subtrees"] = input_subtrees
input_projects = os.getenv("PROJECTS", "")
args["input_projects"] = input_projects
logging.info(f"Retrieved arguments {args}")
run(args)
@@ -0,0 +1,23 @@
"""
This dictionary is used to map specific file directory changes to the corresponding build flag and tests
"""
subtree_to_project_map = {
"projects/rocprim": "prim",
"projects/rocthrust": "prim",
"projects/hipcub": "prim",
"projects/rocrand": "rand",
"projects/hiprand": "rand"
}
project_map = {
"prim": {
"cmake_options": "-DTHEROCK_ENABLE_PRIM=ON -DTHEROCK_ENABLE_ALL=OFF",
"project_to_test": "rocprim, rocthrust, hipcub",
"subtree_checkout": "projects/rocprim\nprojects/hipcub\nprojects/rocthrust",
},
"rand": {
"cmake_options": "-DTHEROCK_ENABLE_RAND=ON -DTHEROCK_ENABLE_ALL=OFF",
"project_to_test": "rocrand, hiprand",
"subtree_checkout": "projects/rocrand\nprojects/hiprand",
},
}
@@ -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 }}"
@@ -0,0 +1,118 @@
name: "AqlProfile CodeQL Advanced"
on:
push:
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,161 @@
name: AqlProfile Continuous Integration
on:
workflow_dispatch:
push:
paths:
- 'projects/aqlprofile/**'
- '!projects/aqlprofile/*.md'
- '!projects/aqlprofile/CODEOWNERS'
- '!projects/aqlprofile/source/docs/**'
pull_request:
paths:
- 'projects/aqlprofile/**'
- '!projects/aqlprofile/*.md'
- '!projects/aqlprofile/CODEOWNERS'
- '!projects/aqlprofile/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
PATH: "/usr/bin:$PATH"
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:
# 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:
runner: ['navi4', 'navi3', 'mi300']
os: ['ubuntu-22.04']
build-type: ['RelWithDebInfo']
runs-on: rocprofiler-${{ matrix.runner == 'mi300' && 'ubuntu-22' || matrix.runner }}
if: github.event.pull_request.head.repo.full_name == 'AMD-ROCm-Internal/aqlprofile'
permissions:
contents: read
pull-requests: write
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
CORE_EXT_RUNNER: mi300a
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/aqlprofile
- 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 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: |
cd projects/aqlprofile
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
pwd
- name: Configure, Build, and Test
timeout-minutes: 30
shell: bash
working-directory: projects/aqlprofile
run:
LD_LIBRARY_PATH=$(pwd)/build:$LD_LIBRARY_PATH ctest --output-on-failure -V -DCTEST_SOURCE_DIRECTORY="$(pwd)"
-DCTEST_BINARY_DIRECTORY="$(pwd)/build" -DAQLPROFILE_BUILD_NUM_JOBS="16" -DCTEST_SITE="${RUNNER_HOSTNAME}"
-DCTEST_BUILD_NAME=PR_${{ github.ref_name }}_${{ github.repository }}-${{ matrix.os }}-${{ matrix.runner }}-core
-DCMAKE_CTEST_ARGUMENTS=""
-DAQLPROFILE_BUILD_TESTS=ON
-DAQLPROFILE_EXTRA_CONFIGURE_ARGS=""
-S ./dashboard.cmake
core-rpm:
if: github.ref != 'refs/heads/amd-npi' && github.event.pull_request.head.repo.full_name == 'AMD-ROCm-Internal/aqlprofile'
# 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:
runner: ['mi300']
os: ['rhel', 'sles']
build-type: ['RelWithDebInfo']
ci-flags: ['--linter clang-tidy']
runs-on: rocprofiler-${{ matrix.os }}
permissions:
contents: read
pull-requests: write
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
CORE_EXT_RUNNER: mi300
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/aqlprofile
- name: Install requirements
timeout-minutes: 10
shell: bash
run: |
cd projects/aqlprofile
git config --global --add safe.directory '*'
- name: List Files
shell: bash
run: |
cd projects/aqlprofile
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
pwd
- name: Configure, Build, and Test
timeout-minutes: 30
shell: bash
working-directory: projects/aqlprofile
run:
LD_LIBRARY_PATH=$(pwd)/build:$LD_LIBRARY_PATH ctest --output-on-failure -V -DCTEST_SOURCE_DIRECTORY="$(pwd)"
-DCTEST_BINARY_DIRECTORY="$(pwd)/build" -DAQLPROFILE_BUILD_NUM_JOBS="16" -DCTEST_SITE="${RUNNER_HOSTNAME}"
-DCTEST_BUILD_NAME=PR_${{ github.ref_name }}_${{ github.repository }}-${{ matrix.os }}-${{ matrix.runner }}-core
-DCMAKE_CTEST_ARGUMENTS=""
-DAQLPROFILE_BUILD_TESTS=ON
-DAQLPROFILE_EXTRA_CONFIGURE_ARGS=""
-S ./dashboard.cmake
@@ -0,0 +1,35 @@
name: Aql ROCm CI Caller
on:
push:
paths:
- 'projects/aqlprofile/**'
- 'projects/rdc/**'
- 'projects/rocminfo/**'
- 'projects/rocprofiler/**'
- 'projects/roctracer/**'
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'projects/aqlprofile/**'
- 'projects/rdc/**'
- 'projects/rocminfo/**'
- 'projects/rocprofiler/**'
- 'projects/roctracer/**'
workflow_dispatch:
issue_comment:
types: [created]
jobs:
call-workflow:
if: ${{ github.event_name != 'issue_comment' || github.event.comment.body == '!verify' }}
uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/rocm_ci.yml@mainline
secrets: inherit
with:
input_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
input_pr_num: ${{ github.event_name == 'pull_request' && github.event.pull_request.number || 0 }}
input_pr_url: ${{ github.event_name == 'pull_request' && github.event.pull_request.html_url || '' }}
input_pr_title: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || '' }}
repository_name: ${{ github.repository }}
base_ref: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref }}
trigger_event_type: ${{ github.event_name }}
@@ -0,0 +1,345 @@
# 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.*
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-auto-push
- 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')"
@@ -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
@@ -0,0 +1,44 @@
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: 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 }}
@@ -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"
@@ -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
@@ -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,123 @@
# Auto Label PR
# -------------
# This GitHub Actions workflow automatically adds or removes labels on a pull request
# based on a custom Python script that analyzes the PR content and paths.
#
# Steps:
# - Run pr_category_label.py to determine which category labels to add/remove
# - Update labels on the PR using GitHub CLI (gh)
# - Check if the PR creator is a member of the specified organization and add/remove labels accordingly
name: Auto Label PR
on:
pull_request_target:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- 'develop'
- 'staging'
- 'main'
- 'release-staging/rocm-rel-7.*'
# Ignore changes to top-level files and directories
# that are not part of the subtree structure
paths-ignore:
- '.github/**'
- 'docs/**'
- '*.md'
# ensure that the workflow is not running for the same PR multiple times at once
concurrency:
group: pr-auto-label-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: false
env:
ORG_TO_CHECK: ROCm
ORG_LABEL: "organization: ROCm"
EXTERNAL_LABEL: "external contribution"
jobs:
auto-label-pr:
runs-on: ubuntu-24.04
steps:
- name: Generate GitHub App token (only for branch PRs)
id: generate-token
if: ${{ !github.event.pull_request.head.repo.fork }}
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 workflows
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
sparse-checkout: '.github'
token: ${{ github.event.pull_request.head.repo.fork && secrets.GITHUB_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: Compute Category Labels for PR
id: compute_labels
env:
# this env clause gets repeated, but it is safer than echo'ing secrets in the workflow
GH_TOKEN: ${{ github.event.pull_request.head.repo.fork && secrets.GITHUB_TOKEN || steps.generate-token.outputs.token }}
run: |
python .github/scripts/pr_category_label.py \
--repo ${{ github.repository }} \
--pr ${{ github.event.pull_request.number }}
- name: Update labels
env:
# this env clause gets repeated, but it is safer than echo'ing secrets in the workflow
GH_TOKEN: ${{ github.event.pull_request.head.repo.fork && secrets.GITHUB_TOKEN || steps.generate-token.outputs.token }}
run: |
if [ -n "${{ steps.compute_labels.outputs.label_add }}" ]; then
gh pr edit "${{ github.event.pull_request.number }}" --add-label "${{ steps.compute_labels.outputs.label_add }}"
fi
- name: Check if PR creator is in org or collaborator and label accordingly
env:
# this env clause gets repeated, but it is safer than echo'ing secrets in the workflow
GH_TOKEN: ${{ github.event.pull_request.head.repo.fork && secrets.GITHUB_TOKEN || steps.generate-token.outputs.token }}
run: |
if gh pr view "${{ github.event.pull_request.number }}" --json labels -q '.labels[].name' | grep -qFx "imported pr"; then
echo "Skipping org membership labeling for imported pull request."
exit 0
fi
PR_USER=$(gh pr view "${{ github.event.pull_request.number }}" --json author -q .author.login)
if [ "${{ github.event.pull_request.head.repo.fork }}" = true ]; then
# For fork PRs: check if user has any collaborator permission on the repo
PERMISSION=$(gh api repos/${{ github.repository }}/collaborators/$PR_USER/permission --jq '.permission')
if [ "$PERMISSION" = "admin" ] || [ "$PERMISSION" = "write" ] || [ "$PERMISSION" = "maintain" ]; then
gh pr edit "${{ github.event.pull_request.number }}" --add-label "${{ env.ORG_LABEL }}"
else
gh pr edit "${{ github.event.pull_request.number }}" --add-label "${{ env.EXTERNAL_LABEL }}"
fi
else
# For branch PRs (non-forks): check org membership via GitHub App token
if gh api orgs/${{ env.ORG_TO_CHECK }}/members/$PR_USER --silent; then
gh pr edit "${{ github.event.pull_request.number }}" --add-label "${{ env.ORG_LABEL }}"
else
gh pr edit "${{ github.event.pull_request.number }}" --add-label "${{ env.EXTERNAL_LABEL }}"
fi
fi
@@ -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
@@ -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
@@ -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,65 @@
name: rocprofiler-compute Documentation
on:
push:
paths:
- 'projects/rocprofiler-compute/docs/archive/docs-2.x/**'
- 'projects/rocprofiler-compute/docs/archive/docs-1.x/**'
- '.github/workflows/rocprofiler-compute-docs.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Build job
build:
runs-on: ubuntu-latest
container:
image: sphinxdoc/sphinx
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-compute
- name: Additional python packages
run: |
cd projects/rocprofiler-compute
pip3 install -r docs/archive/requirements-doc.txt
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build 1.x docs
run: |
cd docs/archive/docs-1.x
make html
- name: Build 2.x docs
run: |
cd docs/archive/docs-2.x
make html
- name: Relocate 1.x docs
run: |
mv docs/archive/docs-1.x/_build/html docs/archive/_build/html/1.x
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/archive/_build/html
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
@@ -0,0 +1,87 @@
name: rocprofiler-compute Formatting
on:
push:
paths:
- 'projects/rocprofiler-compute/**'
pull_request:
paths:
- 'projects/rocprofiler-compute/**'
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 black isort
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
- name: Run black formatter
working-directory: projects/rocprofiler-compute
run: black .
- name: Run isort formatter
working-directory: projects/rocprofiler-compute
run: isort .
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 cmake-format
- name: cmake-format
working-directory: projects/rocprofiler-compute
run: |
set +e
cmake-format -i $(find . -type f | egrep 'CMakeLists.txt|\.cmake$')
if [ $(git diff | wc -l) -gt 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
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,128 @@
name: rocprofiler-compute mi-rhel9
on:
push:
paths:
- 'projects/rocprofiler-compute/**'
# Allows manual execution
workflow_dispatch:
permissions:
contents: read
checks: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
profile:
strategy:
matrix:
version: [5.7.1, 6.0.2]
hardware: [mi100, mi200]
profiler: [default, rocprofv2]
exclude:
- profiler: rocprofv2
hardware: mi100
fail-fast: false
runs-on: [mi100, rhel9]
env:
PYTHONPATH: /home1/ciuser/rocprofiler-compute_deps
CI_VISIBLE_DEVICES: 1
name: ROCm v${{ matrix.version }} / ${{ matrix.hardware }} / ${{ matrix.profiler }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-compute
- name: Python Path
run: echo ${PYTHONPATH}
- name: Setup hardware-specific run details
working-directory: projects/rocprofiler-compute
run: |
if [ ${{ matrix.hardware }} == "mi100" ];then
echo "CI_QUEUE=ci" >> $GITHUB_ENV
echo "CI_ARCH=gfx908" >> $GITHUB_ENV
elif [ ${{ matrix.hardware }} == "mi200" ];then
echo "CI_QUEUE=mi2104x" >> $GITHUB_ENV
echo "CI_ARCH=gfx90a" >> $GITHUB_ENV
else
echo "Unsupported hardware"
exit 1
fi
- name: Setup profiling mode
working-directory: projects/rocprofiler-compute
run: |
if [ ${{ matrix.profiler }} == "rocprofv2" ];then
echo "ROCPROF=rocprofv2" >> $GITHUB_ENV
fi
- name: Install Python collateral (build and test)
working-directory: projects/rocprofiler-compute
run: |
pip3 install -t ${PYTHONPATH} -r requirements.txt
pip3 install -t ${PYTHONPATH} -r requirements-test.txt
- name: Load ROCm ${{ matrix.version}}
working-directory: projects/rocprofiler-compute
run: |
module load cmake
module load rocm/${{ matrix.version }}
echo $PATH > $GITHUB_PATH
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> "$GITHUB_ENV"
echo "ROCM_PATH=$ROCM_PATH" >> "$GITHUB_ENV"
- name: Check Environment
working-directory: projects/rocprofiler-compute
run: |
echo "PATH=$PATH"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
echo "ROCM_PATH=$ROCM_PATH"
echo "CI_QUEUE=$CI_QUEUE"
echo "CI_ARCH=$CI_ARCH"
echo "CI_VISIBLE_DEVICES=$CI_VISIBLE_DEVICES"
echo "ROCPROF=$ROCPROF"
- name: Configure
working-directory: projects/rocprofiler-compute
run: |
mkdir build
cd build
ml cmake
cmake -DENABLE_TESTS=ON -DCMAKE_HIP_ARCHITECTURES=$CI_ARCH -DENABLE_COVERAGE=ON -DPYTEST_NUMPROCS=8 ..
- name: Build tests and Run [profile] mode
working-directory: projects/rocprofiler-compute
run: |
cd build
make
srun -N 1 -J rocprof-compute -p $CI_QUEUE -t 00:20:00 ctest -j 4 --resource-spec-file ../tests/4gpus.json --verbose -L profile
- name: Run [analyze workloads] mode
working-directory: projects/rocprofiler-compute
if: '!cancelled()'
run: |
cd build
srun -N 1 -J rocprof-compute -p $CI_QUEUE -t 00:10:00 ctest --verbose -R test_analyze_workloads
- name: Run [analyze commands] mode
working-directory: projects/rocprofiler-compute
if: '!cancelled()'
run: |
cd build
srun -N 1 -J rocprof-compute -p $CI_QUEUE -t 00:10:00 ctest --verbose -R test_analyze_commands
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/linux@v2
if: always()
with:
files: |
projects/rocprofiler-compute/tests/**/test_*.xml
- name: Summarize code coverage
if: always()
run: coverage report
- name: Upload code coverage
uses: zgosalvez/github-actions-report-lcov@v4
if: always()
with:
coverage-files: projects/rocprofiler-compute/tests/coverage.info
minimum-coverage: 35
artifact-name: code-coverage-report-rocm${{ matrix.version }}-${{ matrix.hardware }}-${{ matrix.profiler }}
github-token: ${{ secrets.GITHUB_TOKEN }}
update-comment: true
@@ -0,0 +1,74 @@
name: rocprofiler-compute Packaging
on:
push:
paths:
- 'projects/rocprofiler-compute/**'
tags:
- "v[1-9].[0-9]+.[0-9]+*"
- "rocm-[0-9]+.[0-9]+.[0-9]+*"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
distbuild:
runs-on: ubuntu-latest
name: Create release distribution
env:
INSTALL_DIR: /tmp
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-compute
- name: Verify VERSION file consistent with tag
run: utils/ver_check.py --tag ${{github.ref_name}}
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- 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: Rename tarball
working-directory: projects/rocprofiler-compute
run: mv build/rocprofiler-compute-*.tar.gz build/rocprofiler-compute-${{github.ref_name}}.tar.gz
- name: Archive tarball
uses: actions/upload-artifact@v4
with:
name: rocprofiler-compute-${{github.ref_name}}.tar.gz
path: projects/rocprofiler-compute/build/rocprofiler-compute-${{github.ref_name}}.tar.gz
- name: Set version
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
- name: Determine release name
working-directory: projects/rocprofiler-compute
run: |
if [[ ${{github.ref_name}} == rocm-* ]]; then
echo "RELEASE_NAME=rocprofiler-compute ${{ env.VERSION }} for ${{github.ref_name}}"
else
echo "RELEASE_NAME=rocprofiler-compute ${{ env.VERSION }}"
fi >> $GITHUB_ENV
- name: Upload tarball Release Asset
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched: True
generate_release_notes: True
draft: False # toggle for debugging
files: |
projects/rocprofiler-computebuild/rocprofiler-compute-${{github.ref_name}}.tar.gz
name: ${{ env.RELEASE_NAME }}
@@ -0,0 +1,77 @@
# This is a basic workflow to help you get started with Actions
name: rocprofiler-compute RHEL 8/9
# Controls when the workflow will run
on:
push:
paths:
- 'projects/rocprofiler-compute/**'
- '!projects/rocprofiler-compute/*.md'
- '!projects/rocprofiler-compute/.github/**/*.md'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/docker/**'
pull_request:
paths:
- 'projects/rocprofiler-compute/**'
- '!projects/rocprofiler-compute/*.md'
- '!projects/rocprofiler-compute/.github/**/*.md'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/docker/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
# The type of runner that the job will run on
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.3']
build-type: ['Release']
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Install baseline OS dependencies
run: |
yum clean all
yum makecache
yum -y install git
yum -y install python39
yum -y install cmake3
yum -y install which
yum -y install glibc-langpack-en
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-compute
- name: Install Python prereqs
working-directory: projects/rocprofiler-compute
run: |
python3.9 -m pip install -r requirements.txt
python3.9 -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,118 @@
name: rocprofiler-compute tarball
on:
push:
paths:
- 'projects/rocprofiler-compute/**'
pull_request:
paths:
- 'projects/rocprofiler-compute/**'
- '!projects/rocprofiler-compute/*.md'
- '!projects/rocprofiler-compute/.github/**/*.md'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/docker/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
distbuild:
runs-on: ubuntu-latest
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 Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- 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
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: 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
- 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,67 @@
# This is a basic workflow to help you get started with Actions
name: rocprofiler-compute Ubuntu 22.04
on:
push:
paths:
- 'projects/rocprofiler-compute/**'
- '!projects/rocprofiler-compute/*.md'
- '!projects/rocprofiler-compute/.github/**/*.md'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/docker/**'
pull_request:
paths:
- 'projects/rocprofiler-compute/**'
- '!projects/rocprofiler-compute/*.md'
- '!projects/rocprofiler-compute/.github/**/*.md'
- '!projects/rocprofiler-compute/docs/**'
- '!projects/rocprofiler-compute/docker/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-ubuntu-22.04
# 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@v4
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,193 @@
name: rocprofiler-register Continuous Integration
on:
push:
paths:
- 'projects/rocprofiler-register/**'
- '!projects/rocprofiler-register/*.md'
pull_request:
paths:
- 'projects/rocprofiler-register/**'
- '!projects/rocprofiler-register/*.md'
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: rocprofiler-ubuntu-22
env:
BUILD_TYPE: RelWithDebInfo
INSTALL_PREFIX: /opt/rocprofiler-register
PACKAGING_INSTALL_PREFIX: /opt/rocm
steps:
- uses: actions/checkout@v4
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:
cmake --version &&
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
mkdir -p ${{ env.PACKAGING_INSTALL_PREFIX }}
./rocprofiler-register-*-Linux.sh --prefix=${{ env.PACKAGING_INSTALL_PREFIX }} --exclude-subdir --skip-license
- 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 /opt/rocm/share/rocprofiler-register/tests
cmake --build build-tests-deb --target all --parallel 16
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,340 @@
name: rocprofiler-sdk Code Coverage
permissions:
contents: read
pull-requests: write
on:
workflow_dispatch:
push:
paths:
- 'projects/rocprofiler-sdk/**'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
- '!projects/rocprofiler-sdk/*.md'
- '!projects/rocprofiler-sdk/**/README.md'
pull_request:
paths:
- 'projects/rocprofiler-sdk/**'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
- '!projects/rocprofiler-sdk/*.md'
- '!projects/rocprofiler-sdk/**/README.md'
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"
GPU_TARGETS: "gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 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: ""
jobs:
code-coverage:
if: ${{ contains(github.event_name, 'pull_request') }}
strategy:
# fail-fast: false
matrix:
runner: ['mi300']
os: ['ubuntu-22.04']
build-type: ['Release']
runs-on: rocprofiler-ubuntu-22
# define this for container
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
GCC_COMPILER_VERSION: 11
ROCPROFILER_PC_SAMPLING_BETA_ENABLED: 1
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
submodules: true
set-safe-directory: true
- 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
run: |
cd projects/rocprofiler-sdk
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
python3 -m pip install -U --user -r requirements.txt
rm -rf /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk*
- 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 /opt/rocm/.info/version
ls -la
- name: Enable PC Sampling
if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }}
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
- name: Configure, Build, and Test (Total Code Coverage)
timeout-minutes: 30
shell: bash
run:
python3 projects/rocprofiler-sdk/source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-codecov
--build-jobs 16
--site ${RUNNER_HOSTNAME}
--gpu-targets ${{ env.GPU_TARGETS }}
--coverage all
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DPython3_EXECUTABLE=$(which python3)
${{ env.GLOBAL_CMAKE_OPTIONS }}
--
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
- name: Configure, Build, and Test (Tests Code Coverage)
timeout-minutes: 30
shell: bash
run:
find build -type f | egrep '\.gcda$' | xargs rm &&
python3 projects/rocprofiler-sdk/source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-codecov-tests
--build-jobs 16
--site ${RUNNER_HOSTNAME}
--gpu-targets ${{ env.GPU_TARGETS }}
--coverage tests
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DPython3_EXECUTABLE=$(which python3)
${{ env.GLOBAL_CMAKE_OPTIONS }}
--
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
- name: Configure, Build, and Test (Samples Code Coverage)
timeout-minutes: 30
shell: bash
run:
find build -type f | egrep '\.gcda$' | xargs rm &&
python3 projects/rocprofiler-sdk/source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-codecov-samples
--build-jobs 16
--site ${RUNNER_HOSTNAME}
--gpu-targets ${{ env.GPU_TARGETS }}
--coverage samples
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DPython3_EXECUTABLE=$(which python3)
${{ env.GLOBAL_CMAKE_OPTIONS }}
--
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
- name: Save XML Code Coverage
id: save-coverage
uses: actions/cache/save@v4
with:
key: ${{ github.sha }}-codecov
path: |
.codecov/*.xml
- id: generatereport
name: Generate Code Coverage Comment
if: github.event_name == 'pull_request'
timeout-minutes: 5
shell: bash
run: |
cd projects/rocprofiler-sdk
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.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.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}}/.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.runner }}_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
@@ -0,0 +1,103 @@
name: rocprofiler-sdk Advanced Analysis
on:
workflow_dispatch:
pull_request:
paths:
- 'projects/rocprofiler-sdk/**'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
- '!projects/rocprofiler-sdk/*.md'
push:
paths:
- 'projects/rocprofiler-sdk/**'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
- '!projects/rocprofiler-sdk/*.md'
env:
ROCM_PATH: "/opt/rocm"
GPU_TARGETS: "gfx900;gfx906;gfx908;gfx90a;gfx940;gfx941;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"
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: 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
sudo apt install -y software-properties-common
sudo apt-add-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install -y git build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev rccl-dev rocdecode-dev rocjpeg-dev
git config --global --add safe.directory '*'
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
- uses: actions/checkout@v4
with:
sparse-checkout: |
projects/rocprofiler-sdk
.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: 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,351 @@
name: rocprofiler-sdk Continuous Integration
on:
workflow_dispatch:
push:
paths:
- 'projects/rocprofiler-sdk/**'
- '!projects/rocprofiler-sdk/*.md'
- '!projects/rocprofiler-sdk/**/README.md'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
pull_request:
paths:
- 'projects/rocprofiler-sdk/**'
- '!projects/rocprofiler-sdk/*.md'
- '!projects/rocprofiler-sdk/**/README.md'
- '!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"
GPU_TARGETS: "gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 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: ""
jobs:
core-deb:
# 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:
runner: ['navi4', 'navi3', 'mi300a']
os: ['ubuntu-22.04']
build-type: ['RelWithDebInfo']
runs-on: rocprofiler-${{ matrix.runner == 'mi3xx' && 'ubuntu-22' || matrix.runner }}
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
CORE_EXT_RUNNER: mi3xx
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
submodules: true
set-safe-directory: true
- 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 g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev rccl-dev rccl-unittests rocjpeg-dev rocjpeg-test rocdecode-dev rocdecode-test
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 /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk* /opt/rocm*/lib/python*/site-packages/roctx /opt/rocm*/lib/python*/site-packages/rocpd
- 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 /opt/rocm/.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:
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-core
--build-jobs 16
--site ${RUNNER_HOSTNAME}
--gpu-targets ${{ env.GPU_TARGETS }}
--run-attempt ${{ github.run_attempt }}
${{ matrix.system.ci-flags }}
--
-DROCPROFILER_DEP_ROCMCORE=ON
-DROCPROFILER_BUILD_DOCS=OFF
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }}
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-sdk
-DCPACK_GENERATOR='DEB;RPM;TGZ'
-DCPACK_PACKAGING_INSTALL_PREFIX="$(realpath /opt/rocm)"
-DPython3_EXECUTABLE=$(which python3)
${{ 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:
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:
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: |
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 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:
CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-samples-deb /opt/rocm/share/rocprofiler-sdk/samples
CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-tests-deb -DGPU_TARGETS="gfx942" /opt/rocm/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
core-rpm:
# 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:
runner: ['mi300']
os: ['rhel', 'sles']
build-type: ['RelWithDebInfo']
ci-flags: ['']
runs-on: rocprofiler-${{ matrix.os }}
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
OS_TYPE: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
- name: Install requirements
timeout-minutes: 10
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
git config --global --add safe.directory '*'
if [ "${OS_TYPE}" == "rhel-8" ]; then
dnf makecache
dnf groupinstall -y "Development Tools"
dnf remove -y gcc-c++
dnf install -y gcc-toolset-11-gcc-c++ llvm14-devel
fi
python3 -m pip install --upgrade pip
python3 -m pip install -U --user -r requirements.txt
rm -rf /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk*
- 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 /opt/rocm/.info/version
ls -la
- name: Enable PC Sampling
if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, '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:
if [ "${OS_TYPE}" == "rhel" ]; then source scl_source enable gcc-toolset-11; fi;
/usr/bin/python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-core
--build-jobs 16
--site ${RUNNER_HOSTNAME}
--gpu-targets ${{ env.GPU_TARGETS }}
--run-attempt ${{ github.run_attempt }}
${{ matrix.ci-flags }}
--
-DROCPROFILER_DEP_ROCMCORE=ON
-DROCPROFILER_BUILD_DOCS=OFF
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DPython3_EXECUTABLE=$(which python3)
${{ env.GLOBAL_CMAKE_OPTIONS }}
--
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
sanitizers:
strategy:
fail-fast: false
matrix:
runner: ['mi3xx']
sanitizer: ['AddressSanitizer', 'ThreadSanitizer', 'LeakSanitizer', 'UndefinedBehaviorSanitizer']
os: ['ubuntu-22.04']
build-type: ['RelWithDebInfo']
if: ${{ contains(github.event_name, 'pull_request') }}
runs-on: rocprofiler-${{ matrix.runner == 'mi3xx' && 'ubuntu-22' || matrix.runner }}
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
GCC_COMPILER_VERSION: 13
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
submodules: true
set-safe-directory: true
- 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
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 /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk*
- 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 /opt/rocm/.info/version
ls -la
- name: Enable PC Sampling
if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, '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: 45
shell: bash
working-directory: projects/rocprofiler-sdk
run:
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-${{ matrix.sanitizer }}
--build-jobs 16
--site ${RUNNER_HOSTNAME}
--gpu-targets ${{ env.GPU_TARGETS }}
--memcheck ${{ matrix.sanitizer }}
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DCMAKE_INSTALL_PREFIX="${{ env.ROCM_PATH }}"
-DPython3_EXECUTABLE=$(which python3)
${{ env.GLOBAL_CMAKE_OPTIONS }}
--
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
@@ -0,0 +1,120 @@
name: rocprofiler-sdk Documentation
on:
workflow_dispatch:
push:
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'
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'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
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 '*'
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: |
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
git config --global --add safe.directory '*'
../scripts/update-docs.sh
build-docs-from-source:
runs-on: ubuntu-latest
container: rocm/dev-ubuntu-22.04:latest
steps:
- name: Install os essentials
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-get install -y git
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
submodules: true
set-safe-directory: true
- name: Create Docs Directory
shell: bash
working-directory: projects/rocprofiler-sdk/
run: |
git config --global --add safe.directory '*'
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: |
sudo apt-get update
sudo 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:
export CMAKE_PREFIX_PATH=/opt/rocm:${CMAKE_PREFIX_PATH};
git submodule update --init -- .;
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;
sudo cmake --build build --target install --parallel 12;
cmake --build build --target package --parallel 12
@@ -0,0 +1,153 @@
name: rocprofiler-sdk Formatting
on:
workflow_dispatch:
pull_request:
paths:
- 'projects/rocprofiler-sdk/**'
- '!projects/rocprofiler-sdk/.github/workflows/pull_*.yml'
- '!projects/rocprofiler-sdk/.github/workflows/linting.yml'
- '!projects/rocprofiler-sdk/.github/workflows/markdown_lint.yml'
- '!projects/rocprofiler-sdk/*.md'
- '!projects/rocprofiler-sdk/**/README.md'
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
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install -U cmake-format
- name: Run cmake-format
run: |
set +e
cmake-format -i $(find . -type f | egrep 'CMakeLists.txt|\.cmake$')
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-latest
container: rocm/dev-ubuntu-22.04:latest
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-sdk
- 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 python3 python3-pip build-essential
sudo apt install -y wget curl clang-format-11
- name: Extract branch name
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Run clang-format
run: |
set +e
FILES=$(find samples source tests benchmark -type f | egrep '\.(h|hpp|hh|c|cc|cpp)(|\.in)$')
FORMAT_OUT=$(clang-format-11 -i ${FILES})
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
run: |
python -m pip install --upgrade pip
python -m pip install black
- name: black format
run: |
cd projects/rocprofiler-sdk
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: Find missing new line
shell: bash
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
@@ -0,0 +1,42 @@
name: rocprofiler-sdk Python Linting
on:
workflow_dispatch:
push:
paths:
- 'projects/rocprofiler-sdk/**'
pull_request:
paths:
- 'projects/rocprofiler-sdk/**'
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
run: |
cd projects/rocprofiler-sdk
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
cd projects/rocprofiler-sdk
# 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,55 @@
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/**'
- '!projects/rocprofiler-sdk/.github/workflows/pull_*.yml'
- '!projects/rocprofiler-sdk/.github/workflows/linting.yml'
- '!projects/rocprofiler-sdk/.github/workflows/markdown_lint.yml'
- '!projects/rocprofiler-sdk/*.md'
- '!projects/rocprofiler-sdk/**/README.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
regex:
runs-on: ubuntu-22.04
env:
FOLDERS: "projects/rocprofiler-sdk/source/lib/common projects/rocprofiler-sdk/source/lib/rocprofiler-sdk projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-roctx"
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
run: |
cd projects/rocprofiler-sdk
set +e
FILES="$(find ${FOLDERS} -type f)"
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,33 @@
name: rocprofiler-sdk ROCm CI Caller
on:
pull_request:
types: [opened, reopened, synchronize]
paths:
- 'projects/rocm-smi-lib/**'
- 'projects/rocprofiler-register/**'
- 'projects/rocprofiler-sdk/**'
- 'projects/rocr-runtime/**'
push:
paths:
- 'projects/rocm-smi-lib/**'
- 'projects/rocprofiler-register/**'
- 'projects/rocprofiler-sdk/**'
- 'projects/rocr-runtime/**'
workflow_dispatch:
issue_comment:
types: [created]
jobs:
call-workflow:
if: github.event_name != 'issue_comment' ||(github.event_name == 'issue_comment' && github.event.issue.pull_request && (startsWith(github.event.comment.body, '!verify') || startsWith(github.event.comment.body, '!verify release') || startsWith(github.event.comment.body, '!verify retest')))
uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/rocm_ci.yml@mainline
secrets: inherit
with:
input_sha: ${{github.event_name == 'pull_request' && github.event.pull_request.head.sha || (github.event_name == 'push' && github.sha) || (github.event_name == 'issue_comment' && github.event.issue.pull_request.head.sha) || github.sha}}
input_pr_num: ${{github.event_name == 'pull_request' && github.event.pull_request.number || (github.event_name == 'issue_comment' && github.event.issue.number) || 0}}
input_pr_url: ${{github.event_name == 'pull_request' && github.event.pull_request.html_url || (github.event_name == 'issue_comment' && github.event.issue.pull_request.html_url) || ''}}
input_pr_title: ${{github.event_name == 'pull_request' && github.event.pull_request.title || (github.event_name == 'issue_comment' && github.event.issue.pull_request.title) || ''}}
repository_name: ${{ github.repository }}
base_ref: ${{github.event_name == 'pull_request' && github.event.pull_request.base.ref || (github.event_name == 'issue_comment' && github.event.issue.pull_request.base.ref) || github.ref}}
trigger_event_type: ${{ github.event_name }}
comment_text: ${{ github.event_name == 'issue_comment' && github.event.comment.body || '' }}
@@ -0,0 +1,119 @@
name: rocprofiler-sdk ROCm Release Compatibility
permissions:
contents: read
on:
workflow_dispatch:
push:
paths:
- 'projects/rocprofiler-sdk/**'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
- '!projects/rocprofiler-sdk/*.md'
pull_request:
paths:
- 'projects/rocprofiler-sdk/**'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
- '!projects/rocprofiler-sdk/*.md'
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
if: ${{ matrix.rocm-release == '6.2' }}
timeout-minutes: 10
shell: bash
run: |
cd projects/rocprofiler-sdk
git config --global --add safe.directory '*'
apt-get update
apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-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
- name: Install requirements
if: ${{ matrix.rocm-release != '6.2' }}
timeout-minutes: 10
shell: bash
run: |
cd projects/rocprofiler-sdk
git config --global --add safe.directory '*'
apt-get update
apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev rccl-dev rccl-unittests rocjpeg-dev rocjpeg-test rocdecode-dev rocdecode-test
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,188 @@
name: rocprofiler-systems Continuous Integration Containers
run-name: ci-containers
# nightly build
on:
workflow_dispatch:
schedule:
- cron: 0 5 * * *
push:
paths:
- 'projects/rocprofiler-systems/.github/workflows/containers.yml'
- 'projects/rocprofiler-systems/docker/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
jobs:
rocprofiler-systems-ci:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- distro: "ubuntu"
version: "20.04"
- distro: "ubuntu"
version: "22.04"
- distro: "ubuntu"
version: "24.04"
- distro: "opensuse"
version: "15.5"
- distro: "opensuse"
version: "15.6"
- distro: "rhel"
version: "8.10"
- distro: "rhel"
version: "9.3"
- distro: "rhel"
version: "9.4"
- distro: "rhel"
version: "9.5"
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems
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.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build CI Container
timeout-minutes: 45
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 60
timeout_minutes: 45
max_attempts: 3
command: |
pushd projects/rocprofiler-systems/docker
./build-docker-ci.sh --distro ${{ matrix.distro }} --versions ${{ matrix.version }} --user ${{ secrets.DOCKERHUB_USERNAME }} --push --jobs 2 --elfutils-version 0.186 --boost-version 1.79.0
popd
rocprofiler-systems-release:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# ubuntu 20.04
- os-distro: "ubuntu"
os-version: "20.04"
rocm-version: "0.0"
- os-distro: "ubuntu"
os-version: "20.04"
rocm-version: "6.3"
# 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:
- 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.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Base Container
timeout-minutes: 45
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 60
timeout_minutes: 45
max_attempts: 3
command: |
pushd projects/rocprofiler-systems/docker
./build-docker.sh --distro ${{ matrix.os-distro }} --versions ${{ matrix.os-version }} --rocm-versions ${{ matrix.rocm-version }} --user ${{ secrets.DOCKERHUB_USERNAME }} --push
popd
@@ -0,0 +1,195 @@
name: rocprofiler-systems Installer Packaging (CPack)
run-name: cpack
on:
workflow_dispatch:
push:
paths:
- 'projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/*.md'
- '!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/**'
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 20.04
- os-distro: "ubuntu"
os-version: "20.04"
rocm-version: "0.0"
- os-distro: "ubuntu"
os-version: "20.04"
rocm-version: "6.3"
# 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
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,120 @@
name: rocprofiler-systems Formatting
run-name: formatting
on:
push:
paths:
- 'projects/rocprofiler-systems/**'
pull_request:
paths:
- 'projects/rocprofiler-systems/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
call-workflow-passing-data:
name: Documentation
uses: ROCm/rocm-docs-core/.github/workflows/linting.yml@develop
python:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8]
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
- name: gersemi
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
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
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,182 @@
name: rocprofiler-systems OpenSUSE 15 (GCC, Python)
run-name: opensuse-15
on:
push:
paths:
- 'projects/rocprofiler-systems/**'
- '!projects/rocprofiler-systems/*.md'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/.github/workflows/rocprofiler-systems-cpack.yml'
- '!projects/rocprofiler-systems/.github/workflows/rocprofiler-systems-containers.yml'
- '!projects/rocprofiler-systems/.github/workflows/rocprofiler-systems-formatting.yml'
- '!projects/rocprofiler-systems/.github/workflows/rocprofiler-systems-weekly-mainline-sync.yml'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/.wordlist.txt'
- '!projects/rocprofiler-systems/CMakePresets.json'
pull_request:
paths:
- 'projects/rocprofiler-systems/**'
- '!projects/rocprofiler-systems/*.md'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/.github/workflows/rocprofiler-systems-cpack.yml'
- '!projects/rocprofiler-systems/.github/workflows/rocprofiler-systems-containers.yml'
- '!projects/rocprofiler-systems/.github/workflows/rocprofiler-systems-formatting.yml'
- '!projects/rocprofiler-systems/.github/workflows/rocprofiler-systems-weekly-mainline-sync.yml'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/.wordlist.txt'
- '!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 ${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;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,47 @@
name: rocprofiler-systems Python Linting
run-name: Python
on:
push:
paths:
- 'projects/rocprofiler-systems/**'
- 'projects/rocprofiler-systems/source/python/gui/*.py'
- 'projects/rocprofiler-systems/source/python/gui/**/*.py'
pull_request:
paths:
- 'projects/rocprofiler-systems/**'
- 'projects/rocprofiler-systems/source/python/gui/*.py'
- 'projects/rocprofiler-systems/source/python/gui/**/*.py'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
linting:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "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: |
cd projects/rocprofiler-systems/source/python/gui
python -m pip install --upgrade pip
pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
cd projects/rocprofiler-systems/source/python/gui
# 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,190 @@
name: rocprofiler-systems RedHat Linux (GCC, Python, ROCm)
run-name: redhat
on:
push:
paths:
- 'projects/rocprofiler-systems/**'
- '!projects/rocprofiler-systems/*.md'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/.github/workflows/docs.yml'
- '!projects/rocprofiler-systems/.github/workflows/cpack.yml'
- '!projects/rocprofiler-systems/.github/workflows/containers.yml'
- '!projects/rocprofiler-systems/.github/workflows/formatting.yml'
- '!projects/rocprofiler-systems/.github/workflows/weekly-mainline-sync.yml'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/.wordlist.txt'
- '!projects/rocprofiler-systems/CMakePresets.json'
pull_request:
paths:
- 'projects/rocprofiler-systems/**'
- '!projects/rocprofiler-systems/*.md'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/.github/workflows/docs.yml'
- '!projects/rocprofiler-systems/.github/workflows/cpack.yml'
- '!projects/rocprofiler-systems/.github/workflows/containers.yml'
- '!projects/rocprofiler-systems/.github/workflows/formatting.yml'
- '!projects/rocprofiler-systems/.github/workflows/weekly-mainline-sync.yml'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/.wordlist.txt'
- '!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.3', '9.4' ]
rocm-version: [ '0.0', '6.3', '6.4' ]
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
shell: bash
working-directory: projects/rocprofiler-systems/
run: |
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 ${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"
-DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }}
--
-LE "transpose|rccl|videodecode|jpegdecode|network"
- 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
@@ -0,0 +1,44 @@
name: rocprofiler-systems Release
on:
workflow_dispatch:
push:
paths:
- "projects/rocprofiler-systems/**"
tags:
- "v[1-9].[0-9]+.[0-9]+*"
- "rocm-[1-9].[0-9]+.[0-9]+*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-systems/
- name: Generate generic installer script
shell: bash
working-directory: projects/rocprofiler-systems/
run: |
sudo apt-get update
sudo apt-get install -y cmake
cmake -D OUTPUT_DIR=${PWD} -P scripts/write-rocprof-sys-install.cmake
- name: Generate Release
uses: softprops/action-gh-release@v1
with:
draft: False
generate_release_notes: True
fail_on_unmatched_files: True
files: |
projects/rocprofiler-systems/rocprofiler-systems-install.py
@@ -0,0 +1,513 @@
name: Ubuntu 20.04 (GCC, Python, ROCm, MPICH, OpenMPI)
run-name: ubuntu-focal
on:
push:
paths:
- 'projects/rocprofiler-systems/**'
- '!projects/rocprofiler-systems/*.md'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/.github/workflows/docs.yml'
- '!projects/rocprofiler-systems/.github/workflows/cpack.yml'
- '!projects/rocprofiler-systems/.github/workflows/containers.yml'
- '!projects/rocprofiler-systems/.github/workflows/formatting.yml'
- '!projects/rocprofiler-systems/.github/workflows/weekly-mainline-sync.yml'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/.wordlist.txt'
- '!projects/rocprofiler-systems/CMakePresets.json'
pull_request:
paths:
- 'projects/rocprofiler-systems/**'
- '!projects/rocprofiler-systems/*.md'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/.github/workflows/docs.yml'
- '!projects/rocprofiler-systems/.github/workflows/cpack.yml'
- '!projects/rocprofiler-systems/.github/workflows/containers.yml'
- '!projects/rocprofiler-systems/.github/workflows/formatting.yml'
- '!projects/rocprofiler-systems/.github/workflows/weekly-mainline-sync.yml'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/.wordlist.txt'
- '!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:
ubuntu-focal-external:
runs-on: ubuntu-latest
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-ubuntu-20.04
strategy:
fail-fast: false
matrix:
compiler: ['g++-7', 'g++-8']
lto: ['OFF']
strip: ['OFF']
python: ['OFF']
build-type: ['Release']
mpi-headers: ['OFF']
static-libgcc: ['OFF']
static-libstdcxx: ['OFF']
include:
- compiler: 'g++-9'
lto: 'OFF'
strip: 'ON'
python: 'OFF'
build-type: 'Release'
mpi-headers: 'ON'
static-libgcc: 'ON'
static-libstdcxx: 'ON'
- compiler: 'g++-10'
lto: 'OFF'
strip: 'ON'
python: 'ON'
build-type: 'Release'
mpi-headers: 'ON'
static-libgcc: 'ON'
static-libstdcxx: 'OFF'
- compiler: 'g++-11'
lto: 'ON'
strip: 'ON'
python: 'OFF'
build-type: 'Release'
mpi-headers: 'ON'
static-libgcc: 'ON'
static-libstdcxx: 'OFF'
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: |
cd projects/rocprofiler-systems/
apt-get update &&
apt-get install -y software-properties-common &&
add-apt-repository -y ppa:ubuntu-toolchain-r/test &&
apt-get update &&
apt-get upgrade -y &&
apt-get install -y autoconf bison build-essential clang environment-modules gettext libiberty-dev libmpich-dev libtool m4 mpich python3-pip texinfo ${{ matrix.compiler }} &&
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 &&
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 &&
apt-get -y --purge autoremove &&
apt-get -y clean &&
/opt/conda/bin/conda clean -y -a
- name: Test Environment Modules
timeout-minutes: 15
shell: bash
working-directory: projects/rocprofiler-systems/
run: |
set -v
source /usr/share/modules/init/$(basename ${SHELL})
module avail
- 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
- name: Configure, Build, and Test
timeout-minutes: 115
shell: bash
working-directory: projects/rocprofiler-systems/
run:
git config --global --add safe.directory ${PWD} &&
TAG="" &&
append-tagname() { if [ "${1}" == "ON" ]; then TAG="${TAG}-${2}"; fi; } &&
append-tagname ${{ matrix.lto }} lto &&
append-tagname ${{ matrix.strip }} strip &&
append-tagname ${{ matrix.python }} python &&
append-tagname ${{ matrix.mpi-headers }} mpip &&
append-tagname ${{ matrix.static-libgcc }} libgcc &&
append-tagname ${{ matrix.static-libstdcxx }} libstdcxx &&
cmake --version &&
python3 ./scripts/run-ci.py -B build
--name ${{ github.repository_owner }}-${{ github.ref_name }}-ubuntu-focal-${{ 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_MPI=OFF
-DROCPROFSYS_USE_ROCM=OFF
-DROCPROFSYS_USE_OMPT=OFF
-DROCPROFSYS_USE_PAPI=OFF
-DROCPROFSYS_BUILD_DYNINST=ON
-DROCPROFSYS_BUILD_BOOST=ON
-DROCPROFSYS_BUILD_TBB=ON
-DROCPROFSYS_BUILD_ELFUTILS=ON
-DROCPROFSYS_BUILD_LIBIBERTY=ON
-DROCPROFSYS_USE_PYTHON=${{ matrix.python }}
-DROCPROFSYS_USE_MPI_HEADERS=${{ matrix.mpi-headers }}
-DROCPROFSYS_STRIP_LIBRARIES=${{ matrix.strip }}
-DROCPROFSYS_BUILD_LTO=${{ matrix.lto }}
-DROCPROFSYS_BUILD_STATIC_LIBGCC=${{ matrix.static-libgcc }}
-DROCPROFSYS_BUILD_STATIC_LIBSTDCXX=${{ matrix.static-libstdcxx }}
-DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs
-DROCPROFSYS_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10;py3.11"
-DROCPROFSYS_MAX_THREADS=64
-DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl;videodecode;jpegdecode;openmp-target"
-DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }}
-DMPI_HEADERS_ALLOW_MPICH=OFF
--
-LE "transpose|rccl|videodecode|jpegdecode|network"
- name: Test Build-Tree Module
timeout-minutes: 45
shell: bash
working-directory: projects/rocprofiler-systems/
run: |
cd build
source /usr/share/modules/init/$(basename ${SHELL})
module use ./share/modulefiles
module avail
module load rocprofiler-systems
echo $(which rocprof-sys-instrument)
ldd $(which rocprof-sys-instrument)
rocprof-sys-instrument --help
rocprof-sys-avail --help
rocprof-sys-sample --help
- name: Test Build-Tree Source Script
timeout-minutes: 45
shell: bash
working-directory: projects/rocprofiler-systems/
run: |
cd build
source ./share/rocprofiler-systems/setup-env.sh
echo $(which rocprof-sys-instrument)
ldd $(which rocprof-sys-instrument)
rocprof-sys-instrument --help
rocprof-sys-avail --help
rocprof-sys-sample --help
- name: Install
timeout-minutes: 10
working-directory: projects/rocprofiler-systems/
run:
cmake --build build --target install --parallel 2
- name: Test Install
timeout-minutes: 15
shell: bash
working-directory: projects/rocprofiler-systems/
run: |
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,rewrite,runtime}=1 --test-rocprof-sys-python=${{ matrix.python }}
- 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
ubuntu-focal-external-rocm:
runs-on: ubuntu-latest
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-ubuntu-20.04
strategy:
fail-fast: false
matrix:
compiler: ['g++']
rocm-version: ['6.3']
mpi-headers: ['OFF']
build-jobs: ['3']
ctest-exclude: ['-LE "transpose|videodecode|jpegdecode|network"']
env:
BUILD_TYPE: MinSizeRel
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
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: |
cd projects/rocprofiler-systems/
apt-get update &&
apt-get install -y software-properties-common wget gnupg2 &&
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/focal/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 autoconf bison build-essential clang curl gettext libfabric-dev libnuma1 libomp-dev libopenmpi-dev libpapi-dev libtool libudev1 m4 openmpi-bin python3-pip rocm-dev texinfo &&
apt-get install -y rocdecode-dev libavformat-dev libavcodec-dev &&
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 &&
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 &&
apt-get -y --purge autoremove &&
apt-get -y clean &&
/opt/conda/bin/conda clean -y -a
- 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 "CMAKE_PREFIX_PATH=/opt/dyninst:${CMAKE_PREFIX_PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/opt/rocm/lib:/usr/local/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
cat << EOF > test-install.cfg
ROCPROFSYS_PROFILE = ON
ROCPROFSYS_TRACE = ON
ROCPROFSYS_USE_PID = OFF
ROCPROFSYS_USE_SAMPLING = OFF
ROCPROFSYS_USE_PROCESS_SAMPLING = OFF
ROCPROFSYS_COUT_OUTPUT = ON
ROCPROFSYS_TIME_OUTPUT = OFF
ROCPROFSYS_TIMEMORY_COMPONENTS = cpu_clock cpu_util current_peak_rss kernel_mode_time monotonic_clock monotonic_raw_clock network_stats num_io_in num_io_out num_major_page_faults num_minor_page_faults page_rss peak_rss priority_context_switch process_cpu_clock process_cpu_util read_bytes read_char system_clock thread_cpu_clock thread_cpu_util timestamp trip_count user_clock user_mode_time virtual_memory voluntary_context_switch wall_clock written_bytes written_char
ROCPROFSYS_OUTPUT_PATH = rocprofsys-tests-output
ROCPROFSYS_OUTPUT_PREFIX = %tag%/
ROCPROFSYS_DEBUG = OFF
ROCPROFSYS_VERBOSE = 3
ROCPROFSYS_DL_VERBOSE = 3
ROCPROFSYS_PERFETTO_BACKEND = system
EOF
realpath test-install.cfg
cat test-install.cfg
- name: Configure, Build, and Test
timeout-minutes: 115
shell: bash
working-directory: projects/rocprofiler-systems/
run:
git config --global --add safe.directory ${PWD} &&
cmake --version &&
TAG="-rocm-${{ matrix.rocm-version }}" &&
TAG="$(echo ${TAG} | sed 's/debian/latest/g')" &&
python3 ./scripts/run-ci.py -B build
--name ${{ github.repository_owner }}-${{ github.ref_name }}-ubuntu-focal-rocm-${{ 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=${{ env.BUILD_TYPE }}
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-systems
-DROCPROFSYS_BUILD_TESTING=ON
-DROCPROFSYS_BUILD_DEVELOPER=ON
-DROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS=OFF
-DROCPROFSYS_BUILD_LTO=OFF
-DROCPROFSYS_USE_MPI=OFF
-DROCPROFSYS_USE_ROCM=ON
-DROCPROFSYS_MAX_THREADS=64
-DROCPROFSYS_USE_PAPI=OFF
-DROCPROFSYS_USE_OMPT=OFF
-DROCPROFSYS_USE_PYTHON=ON
-DROCPROFSYS_USE_MPI_HEADERS=${{ matrix.mpi-headers }}
-DROCPROFSYS_BUILD_DYNINST=ON
-DROCPROFSYS_BUILD_BOOST=ON
-DROCPROFSYS_BUILD_TBB=ON
-DROCPROFSYS_BUILD_ELFUTILS=ON
-DROCPROFSYS_BUILD_LIBIBERTY=ON
-DROCPROFSYS_USE_SANITIZER=OFF
-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=${{ matrix.mpi-headers }}
-DROCPROFSYS_CI_GPU=OFF
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF
-DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }}
--
${{ matrix.ctest-exclude }}
- name: Install
working-directory: projects/rocprofiler-systems/
run:
cmake --build build --target install --parallel 2
- name: Test Install
timeout-minutes: 15
shell: bash
working-directory: projects/rocprofiler-systems/
run: |
source /opt/rocprofiler-systems/share/rocprofiler-systems/setup-env.sh
./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-output/**/*.txt
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
ubuntu-focal-codecov:
runs-on: ubuntu-latest
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-ubuntu-20.04
options: --cap-add CAP_SYS_ADMIN
env:
ROCPROFSYS_VERBOSE: 2
ROCPROFSYS_CAUSAL_BACKEND: perf
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: |
cd projects/rocprofiler-systems/
apt-get update &&
apt-get install -y autoconf bison build-essential clang environment-modules gcc g++ libmpich-dev libomp-dev libtool m4 mpich python3-pip texinfo &&
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 &&
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 &&
apt-get -y --purge autoremove &&
apt-get -y clean &&
/opt/conda/bin/conda clean -y -a
- name: Configure Env
working-directory: projects/rocprofiler-systems/
run:
echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Configure, Build, and Test
timeout-minutes: 115
shell: bash
working-directory: projects/rocprofiler-systems/
run:
git config --global --add safe.directory ${PWD} &&
cmake --version &&
python3 ./scripts/run-ci.py -B build
--name ${{ github.repository_owner }}-${{ github.ref_name }}-ubuntu-focal-codecov-mpi-python-ompt-papi
--build-jobs 2
--site GitHub
--coverage
--
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-systems
-DROCPROFSYS_BUILD_CI=OFF
-DROCPROFSYS_BUILD_TESTING=ON
-DROCPROFSYS_BUILD_DYNINST=ON
-DROCPROFSYS_BUILD_BOOST=ON
-DROCPROFSYS_BUILD_TBB=ON
-DROCPROFSYS_BUILD_ELFUTILS=ON
-DROCPROFSYS_BUILD_LIBIBERTY=ON
-DROCPROFSYS_BUILD_DEBUG=OFF
-DROCPROFSYS_BUILD_HIDDEN_VISIBILITY=OFF
-DROCPROFSYS_USE_MPI=ON
-DROCPROFSYS_USE_PYTHON=ON
-DROCPROFSYS_USE_OMPT=ON
-DROCPROFSYS_USE_PAPI=ON
-DROCPROFSYS_USE_ROCM=OFF
-DROCPROFSYS_USE_RCCL=OFF
-DROCPROFSYS_MAX_THREADS=64
-DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl;videodecode;jpegdecode;openmp-target"
-DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }}
--
-LE "transpose|rccl|videodecode|jpegdecode|network"
@@ -0,0 +1,402 @@
name: rocprofiler-systems Ubuntu 22.04 (GCC, Python, ROCm)
run-name: ubuntu-jammy
on:
push:
paths:
- 'projects/rocprofiler-systems/**'
- '!projects/rocprofiler-systems/*.md'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/.github/workflows/docs.yml'
- '!projects/rocprofiler-systems/.github/workflows/cpack.yml'
- '!projects/rocprofiler-systems/.github/workflows/containers.yml'
- '!projects/rocprofiler-systems/.github/workflows/formatting.yml'
- '!projects/rocprofiler-systems/.github/workflows/weekly-mainline-sync.yml'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/.wordlist.txt'
- '!projects/rocprofiler-systems/CMakePresets.json'
pull_request:
paths:
- 'projects/rocprofiler-systems/**'
- '!projects/rocprofiler-systems/*.md'
- '!projects/rocprofiler-systems/docs/**'
- '!projects/rocprofiler-systems/source/docs/**'
- '!projects/rocprofiler-systems/source/python/gui/**'
- '!projects/rocprofiler-systems/.github/workflows/docs.yml'
- '!projects/rocprofiler-systems/.github/workflows/cpack.yml'
- '!projects/rocprofiler-systems/.github/workflows/containers.yml'
- '!projects/rocprofiler-systems/.github/workflows/formatting.yml'
- '!projects/rocprofiler-systems/.github/workflows/weekly-mainline-sync.yml'
- '!projects/rocprofiler-systems/docker/**'
- '!projects/rocprofiler-systems/.wordlist.txt'
- '!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:
ubuntu-jammy-external:
runs-on: ubuntu-latest
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-ubuntu-22.04
strategy:
fail-fast: false
matrix:
compiler: ['g++-11', 'g++-12']
rocm: ['OFF']
mpi: ['OFF']
ompt: ['OFF']
papi: ['OFF']
python: ['ON']
strip: ['OFF']
hidden: ['ON', 'OFF']
build-type: ['Release']
mpi-headers: ['ON', 'OFF']
build-dyninst: ['ON']
rocm-version: ['0.0']
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: |
cd projects/rocprofiler-systems/
apt-get update &&
apt-get install -y software-properties-common &&
apt-get upgrade -y &&
apt-get install -y autoconf bison build-essential clang environment-modules \
gettext libfabric-dev libiberty-dev libomp-dev libopenmpi-dev libtool m4 \
openmpi-bin python3-pip texinfo ${{ matrix.compiler }} &&
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: Test Environment Modules
timeout-minutes: 15
shell: bash
working-directory: projects/rocprofiler-systems/
run: |
set -v
source /usr/share/modules/init/$(basename ${SHELL})
module avail
- 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
- name: Configure, Build, and Test
timeout-minutes: 115
shell: bash
working-directory: projects/rocprofiler-systems/
run:
git config --global --add safe.directory ${PWD} &&
cmake --version &&
TAG="" &&
append-tagname() { if [ "${1}" == "ON" ]; then TAG="${TAG}-${2}"; fi; } &&
append-tagname ${{ matrix.mpi }} mpi &&
append-tagname ${{ matrix.ompt }} ompt &&
append-tagname ${{ matrix.papi }} papi &&
append-tagname ${{ matrix.python }} python &&
append-tagname ${{ matrix.mpi-headers }} mpip &&
append-tagname ${{ matrix.build-dyninst }} internal-dyninst &&
append-tagname ${{ matrix.strip }} strip &&
append-tagname ${{ matrix.hidden }} hidden-viz &&
python3 ./scripts/run-ci.py -B build
--name ${{ github.repository_owner }}-${{ github.ref_name }}-ubuntu-jammy-${{ 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-dev
-DROCPROFSYS_BUILD_TESTING=ON
-DROCPROFSYS_USE_MPI=${{ matrix.mpi }}
-DROCPROFSYS_USE_ROCM=${{ matrix.rocm }}
-DROCPROFSYS_USE_OMPT=${{ matrix.ompt }}
-DROCPROFSYS_USE_PAPI=${{ matrix.papi }}
-DROCPROFSYS_USE_PYTHON=${{ matrix.python }}
-DROCPROFSYS_USE_MPI_HEADERS=${{ matrix.mpi-headers }}
-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_BUILD_HIDDEN_VISIBILITY=${{ matrix.hidden }}
-DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs
-DROCPROFSYS_PYTHON_ENVS="py3.7;py3.8;py3.9;py3.10;py3.11"
-DROCPROFSYS_STRIP_LIBRARIES=${{ matrix.strip }}
-DROCPROFSYS_MAX_THREADS=64
-DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl;openmp-target"
-DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }}
-DUSE_CLANG_OMP=OFF
--
-LE "transpose|rccl|videodecode|jpegdecode|network"
- name: Install
timeout-minutes: 10
working-directory: projects/rocprofiler-systems/
run:
cmake --build build --target install --parallel 2
- 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
timeout-minutes: 15
shell: bash
working-directory: projects/rocprofiler-systems/
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
ubuntu-jammy-external-rocm:
runs-on: ubuntu-latest
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-ubuntu-22.04
strategy:
fail-fast: false
matrix:
compiler: ['g++']
rocm: ['ON']
mpi: ['OFF']
ompt: ['OFF']
papi: ['OFF']
python: ['ON']
strip: ['OFF']
hidden: ['ON']
build-type: ['Release']
mpi-headers: ['OFF']
build-dyninst: ['ON']
rocm-version: ['6.3', '6.4']
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: |
cd projects/rocprofiler-systems/
apt-get update &&
apt-get install -y software-properties-common &&
apt-get upgrade -y &&
apt-get install -y autoconf bison build-essential clang environment-modules \
gettext libfabric-dev libiberty-dev libomp-dev libopenmpi-dev libtool m4 \
openmpi-bin python3-pip texinfo ${{ matrix.compiler }} &&
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
timeout-minutes: 25
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 30
timeout_minutes: 25
max_attempts: 5
shell: bash
command: |
cd projects/rocprofiler-systems/
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
echo "/opt/rocm/bin" >> $GITHUB_PATH
echo "ROCM_PATH=/opt/rocm" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/opt/rocm/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
/opt/rocm/bin/hipcc -O3 -c ./examples/transpose/transpose.cpp -o /tmp/transpose.o
- name: Test Environment Modules
timeout-minutes: 15
shell: bash
working-directory: projects/rocprofiler-systems/
run: |
set -v
source /usr/share/modules/init/$(basename ${SHELL})
module avail
- 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
- name: Configure, Build, and Test
timeout-minutes: 115
shell: bash
working-directory: projects/rocprofiler-systems/
run:
git config --global --add safe.directory ${PWD} &&
cmake --version &&
TAG="" &&
append-tagname() { if [ "${1}" == "ON" ]; then TAG="${TAG}-${2}"; fi; } &&
append-tagname ${{ matrix.rocm }} rocm-${{ matrix.rocm-version }} &&
append-tagname ${{ matrix.mpi }} mpi &&
append-tagname ${{ matrix.ompt }} ompt &&
append-tagname ${{ matrix.papi }} papi &&
append-tagname ${{ matrix.python }} python &&
append-tagname ${{ matrix.mpi-headers }} mpip &&
append-tagname ${{ matrix.build-dyninst }} internal-dyninst &&
append-tagname ${{ matrix.strip }} strip &&
append-tagname ${{ matrix.hidden }} hidden-viz &&
python3 ./scripts/run-ci.py -B build
--name ${{ github.repository_owner }}-${{ github.ref_name }}-ubuntu-jammy-${{ 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-dev
-DROCPROFSYS_BUILD_TESTING=ON
-DROCPROFSYS_USE_MPI=${{ matrix.mpi }}
-DROCPROFSYS_USE_ROCM=${{ matrix.rocm }}
-DROCPROFSYS_USE_OMPT=${{ matrix.ompt }}
-DROCPROFSYS_USE_PAPI=${{ matrix.papi }}
-DROCPROFSYS_USE_PYTHON=${{ matrix.python }}
-DROCPROFSYS_USE_MPI_HEADERS=${{ matrix.mpi-headers }}
-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_BUILD_HIDDEN_VISIBILITY=${{ matrix.hidden }}
-DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs
-DROCPROFSYS_PYTHON_ENVS="py3.7;py3.8;py3.9;py3.10;py3.11"
-DROCPROFSYS_STRIP_LIBRARIES=${{ matrix.strip }}
-DROCPROFSYS_MAX_THREADS=64
-DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl;openmp-target"
-DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }}
-DUSE_CLANG_OMP=OFF
--
-LE "transpose|rccl|videodecode|jpegdecode|network"
- name: Install
timeout-minutes: 10
working-directory: projects/rocprofiler-systems/
run:
cmake --build build --target install --parallel 2
- 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
timeout-minutes: 15
shell: bash
working-directory: projects/rocprofiler-systems/
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,155 @@
name: TheRock CI Linux
on:
workflow_call:
inputs:
cmake_options:
type: string
project_to_test:
type: string
subtree_checkout:
type: string
permissions:
contents: read
jobs:
therock-build-linux:
name: Build Linux Packages
runs-on: azure-linux-scale-rocm
permissions:
id-token: write
container:
image: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:044b113562629f4bd2ec5d2e64b32eee11562d48fb1a75d7493daec9dd8d8292
strategy:
fail-fast: true
env:
CACHE_DIR: ${{ github.workspace }}/.container-cache
CCACHE_DIR: "${{ github.workspace }}/.container-cache/ccache"
CCACHE_MAXSIZE: "700M"
AMDGPU_FAMILIES: "gfx94X-dcgpu"
TEATIME_FORCE_INTERACTIVE: 0
steps:
- name: Generate a token for rocm-systems
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: "Checking out repository for rocm-systems"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: |
.github
${{ inputs.subtree_checkout }}
token: ${{ steps.generate-token.outputs.token }}
- name: Checkout TheRock repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "ROCm/TheRock"
path: "TheRock"
- name: Runner Health Settings
run: |
echo "CCACHE_DIR=${CCACHE_DIR}"
df -h
ccache -z
mkdir -p $CCACHE_DIR
cmake --version
echo "Installed Python versions:"
ls -d /opt/python
echo "python: $(which python), python3: $(which python3)"
echo "Git version: $(git --version)"
git config --global --add safe.directory $PWD
git config fetch.parallel 10
- name: Fetch sources
run: |
./TheRock/build_tools/fetch_sources.py --jobs 12 --no-include-math-libs
- name: Install python deps
run: |
pip install -r TheRock/requirements.txt
pip freeze
- name: Configure Projects
env:
amdgpu_families: ${{ env.AMDGPU_FAMILIES }}
package_version: ADHOCBUILD
extra_cmake_options: "-DTHEROCK_USE_EXTERNAL_ROCM_LIBRARIES=ON -DTHEROCK_ROCM_LIBRARIES_SOURCE_DIR=../ ${{ inputs.cmake_options }}"
BUILD_DIR: build
run: |
python3 TheRock/build_tools/github_actions/build_configure.py
- name: Build therock-dist
run: cmake --build TheRock/build --target therock-dist
- name: Build therock-archives
run: cmake --build TheRock/build --target therock-archives
- name: Report
if: ${{ !cancelled() }}
run: |
echo "Full SDK du:"
echo "------------"
du -h -d 1 TheRock/build/dist/rocm
echo "Artifact Archives:"
echo "------------------"
ls -lh TheRock/build/artifacts/*.tar.xz
echo "Artifacts:"
echo "----------"
du -h -d 1 TheRock/build/artifacts
echo "CCache Stats:"
echo "-------------"
ccache -s
- name: Configure AWS Credentials
if: always()
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::692859939525:role/therock-artifacts-external
- name: Create Logs index Files
if: always()
run: |
python3 TheRock/build_tools/github_actions/create_log_index.py \
--build-dir=TheRock/build \
--amdgpu-family=${{ env.AMDGPU_FAMILIES }}
- name: Upload artifacts
run: |
python TheRock/build_tools/github_actions/upload_build_artifacts.py \
--run-id ${{ github.run_id }} \
--amdgpu-family ${{ env.AMDGPU_FAMILIES }} \
--build-dir TheRock/build
- name: Upload Logs
if: always()
run: |
python3 TheRock/build_tools/github_actions/upload_build_logs_to_s3.py \
--build-dir=TheRock/build \
--run-id ${{ github.run_id }} \
--amdgpu-family ${{ env.AMDGPU_FAMILIES }}
- name: Add Links to Job Summary
if: always()
run: |
python TheRock/build_tools/github_actions/upload_build_summary.py \
--run-id ${{ github.run_id }} \
--amdgpu-family ${{ env.AMDGPU_FAMILIES }} \
--build-dir TheRock/build
therock-test-linux:
name: "Test"
needs: [therock-build-linux]
uses: ./.github/workflows/therock-test-packages.yml
with:
project_to_test: ${{ inputs.project_to_test }}
amdgpu_families: "gfx94X-dcgpu"
test_runs_on: "linux-mi325-1gpu-ossci-rocm"
platform: "linux"
@@ -0,0 +1,178 @@
name: TheRock CI Windows
on:
workflow_call:
inputs:
cmake_options:
type: string
project_to_test:
type: string
subtree_checkout:
type: string
permissions:
contents: read
jobs:
therock-build-windows:
name: Build Windows Packages
runs-on: azure-windows-scale-rocm
outputs:
AMDGPU_FAMILIES: ${{ env.AMDGPU_FAMILIES }}
permissions:
contents: read
id-token: write
defaults:
run:
shell: bash
env:
BUILD_DIR: B:\build
CCACHE_DIR: "${{ github.workspace }}/.container-cache/ccache"
CCACHE_MAXSIZE: "700M"
# TODO(geomin12): Add matrix of families
# To get a fast signal of windows building for TheRock, adding gfx110X
AMDGPU_FAMILIES: "gfx110X-dgpu"
steps:
- name: Generate a token for rocm-systems
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: "Checking out repository for rocm-systems"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: |
.github
${{ inputs.subtree_checkout }}
token: ${{ steps.generate-token.outputs.token }}
- name: Checkout TheRock repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "ROCm/TheRock"
path: "TheRock"
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
- name: Install python deps
run: |
pip install -r TheRock/requirements.txt
- name: Install requirements
run: |
choco install --no-progress -y ccache
choco install --no-progress -y ninja
choco install --no-progress -y strawberryperl
echo "$PATH;C:\Strawberry\c\bin" >> $GITHUB_PATH
choco install --no-progress -y awscli
echo "$PATH;C:\Program Files\Amazon\AWSCLIV2" >> $GITHUB_PATH
# After other installs, so MSVC get priority in the PATH.
- name: Configure MSVC
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- name: Fetch sources
run: |
git config --global core.longpaths true
python ./TheRock/build_tools/fetch_sources.py --jobs 96 --no-include-math-libs
- name: Checkout closed source AMDGPU/ROCm interop library folder
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: nod-ai/amdgpu-windows-interop
path: amdgpu-windows-interop
lfs: true
- name: Configure Projects
env:
amdgpu_families: ${{ env.AMDGPU_FAMILIES }}
package_version: "ADHOCBUILD"
extra_cmake_options: "-DBUILD_TESTING=OFF -DTHEROCK_USE_EXTERNAL_ROCM_LIBRARIES=ON -DTHEROCK_ROCM_LIBRARIES_SOURCE_DIR=${{ github.workspace }} ${{ inputs.cmake_options }}"
run: |
# clear cache before build and after download
ccache -z
python3 TheRock/build_tools/github_actions/build_configure.py
- name: Build therock-dist
run: cmake --build "${{ env.BUILD_DIR }}" --target therock-dist
- name: Build therock-archives
run: cmake --build "${{ env.BUILD_DIR }}" --target therock-archives
- name: Report
if: ${{ !cancelled() }}
run: |
echo "Build dir:"
echo "------------"
ls -lh "${{ env.BUILD_DIR }}"
echo "Artifact Archives:"
echo "------------------"
ls -lh "${{ env.BUILD_DIR }}"/artifacts/*.tar.xz
echo "Artifacts:"
echo "----------"
du -h -d 1 "${{ env.BUILD_DIR }}"/artifacts
echo "CCache Stats:"
echo "-------------"
ccache -s
- name: "Build size report"
if: always()
shell: powershell
run: |
$fs = Get-PSDrive -PSProvider "FileSystem"
$fsout = $fs | Select-Object -Property Name,Used,Free,Root
$fsout | % {$_.Used/=1GB;$_.Free/=1GB;$_} | Write-Host
get-disk | Select-object @{Name="Size(GB)";Expression={$_.Size/1GB}} | Write-Host
- name: Configure AWS Credentials
if: always()
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::692859939525:role/therock-artifacts-external
- name: Create Logs index Files
if: always()
run: |
python3 TheRock/build_tools/github_actions/create_log_index.py \
--build-dir=${{ env.BUILD_DIR }} \
--amdgpu-family=${{ env.AMDGPU_FAMILIES }}
- name: Upload artifacts
run: |
python TheRock/build_tools/github_actions/upload_build_artifacts.py \
--run-id ${{ github.run_id }} \
--amdgpu-family ${{ env.AMDGPU_FAMILIES }} \
--build-dir ${{ env.BUILD_DIR }}
- name: Upload Logs
if: always()
run: |
python3 TheRock/build_tools/github_actions/upload_build_logs_to_s3.py \
--build-dir=${{ env.BUILD_DIR }} \
--run-id ${{ github.run_id }} \
--amdgpu-family ${{ env.AMDGPU_FAMILIES }}
- name: Add Links to Job Summary
if: always()
run: |
python TheRock/build_tools/github_actions/upload_build_summary.py \
--run-id ${{ github.run_id }} \
--amdgpu-family ${{ env.AMDGPU_FAMILIES }} \
--build-dir ${{ env.BUILD_DIR }}
therock-test-windows:
name: "Test"
needs: [therock-build-windows]
uses: ./.github/workflows/therock-test-packages.yml
with:
project_to_test: ${{ inputs.project_to_test }}
amdgpu_families: ${{ needs.therock-build-windows.outputs.AMDGPU_FAMILIES }}
test_runs_on: ""
platform: "windows"
@@ -0,0 +1,143 @@
name: TheRock CI
on:
push:
branches:
- develop
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch:
inputs:
projects:
type: string
description: "Insert space-separated list of projects to test or 'all' to test all projects. ex: 'projects/rocprim projects/hipcub'"
permissions:
contents: read
concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit). The workflow name is prepended to avoid conflicts between
# different workflows.
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
jobs:
setup:
name: "Setup"
runs-on: ubuntu-24.04
outputs:
projects: ${{ steps.projects.outputs.projects }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: .github
sparse-checkout-cone-mode: true
# # will be needed for `patch_monorepo.py` but necessary now
# - name: Checkout TheRock Repository
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# with:
# repository: "ROCm/TheRock"
# path: "TheRock"
# ref: 0730cccf8b98e012d64750f26032bd760360fa45
- 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
# # For our "rocPRIM" MVP, there are no patches to apply. This will be un-commented and used later!
# - name: Patch monorepo
# run: |
# python TheRock/build_tools/github_actions/patch_monorepo.py \
# --repo rocm-systems
- name: Detect changed subtrees
id: detect
if: github.event_name == 'pull_request'
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: Determine projects to run
id: projects
env:
SUBTREES: ${{ steps.detect.outputs.subtrees }}
PROJECTS: ${{ inputs.projects }}
# TODO(geomin12): #590 Enable TheRock CI for forked PRs
IS_FORKED_PR: ${{ github.event.pull_request.head.repo.fork == true }}
run: |
python .github/scripts/therock_configure_ci.py
therock-ci-linux:
name: TheRock CI Linux
permissions:
contents: read
id-token: write
needs: setup
if: ${{ needs.setup.outputs.projects != '[]' }}
strategy:
fail-fast: false
matrix:
projects: ${{ fromJSON(needs.setup.outputs.projects) }}
uses: ./.github/workflows/therock-ci-linux.yml
secrets: inherit
with:
cmake_options: ${{ matrix.projects.cmake_options }}
project_to_test: ${{ matrix.projects.project_to_test }}
subtree_checkout: ${{ matrix.projects.subtree_checkout }}
therock-ci-windows:
name: TheRock CI Windows
permissions:
contents: read
id-token: write
needs: setup
if: ${{ needs.setup.outputs.projects != '[]' }}
strategy:
fail-fast: false
matrix:
projects: ${{ fromJSON(needs.setup.outputs.projects) }}
uses: ./.github/workflows/therock-ci-windows.yml
secrets: inherit
with:
cmake_options: ${{ matrix.projects.cmake_options }}
project_to_test: ${{ matrix.projects.project_to_test }}
subtree_checkout: ${{ matrix.projects.subtree_checkout }}
therock_ci_summary:
name: TheRock CI Summary
if: always()
needs:
- setup
- therock-ci-linux
- therock-ci-windows
runs-on: ubuntu-24.04
steps:
- name: Output failed jobs
run: |
echo '${{ toJson(needs) }}'
FAILED_JOBS="$(echo '${{ toJson(needs) }}' \
| jq --raw-output \
'map_values(select(.result!="success" and .result!="skipped")) | keys | join(",")' \
)"
if [[ "${FAILED_JOBS}" != "" ]]; then
echo "The following jobs failed: ${FAILED_JOBS}"
exit 1
fi
@@ -0,0 +1,80 @@
name: TheRock Test Packages
on:
workflow_call:
inputs:
project_to_test:
type: string
amdgpu_families:
type: string
test_runs_on:
type: string
platform:
type: string
permissions:
contents: read
jobs:
configure_test_matrix:
name: "Configure test matrix"
runs-on: ubuntu-24.04
if: ${{ inputs.test_runs_on != '' }}
outputs:
components: ${{ steps.configure.outputs.components }}
steps:
- name: "Checking out repository"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "ROCm/TheRock"
- name: "Configuring CI options"
env:
PLATFORM: ${{ inputs.platform }}
project_to_test: ${{ inputs.project_to_test }}
id: configure
run: python ./build_tools/github_actions/fetch_test_configurations.py
test_components:
name: 'Test ${{ matrix.components.job_name }}'
runs-on: ${{ inputs.test_runs_on }}
needs: configure_test_matrix
# skip tests if no test matrix to run
if: ${{ needs.configure_test_matrix.outputs.components != '[]' }}
strategy:
fail-fast: false
matrix:
components: ${{ fromJSON(needs.configure_test_matrix.outputs.components) }}
defaults:
run:
shell: bash
env:
VENV_DIR: ${{ github.workspace }}/.venv
ARTIFACT_RUN_ID: "${{ github.run_id }}"
OUTPUT_ARTIFACTS_DIR: ${{ github.workspace }}/build
THEROCK_BIN_DIR: "./build/bin"
steps:
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "ROCm/TheRock"
- name: Run setup test environment workflow
uses: './.github/actions/setup_test_environment'
with:
ARTIFACT_RUN_ID: ${{ env.ARTIFACT_RUN_ID }}
AMDGPU_FAMILIES: ${{ inputs.amdgpu_families }}
OUTPUT_ARTIFACTS_DIR: ${{ env.OUTPUT_ARTIFACTS_DIR }}
VENV_DIR: ${{ env.VENV_DIR }}
FETCH_ARTIFACT_ARGS: ${{ matrix.components.fetch_artifact_args }}
PLATFORM: ${{ inputs.platform }}
- name: Install additional packages
if: ${{ inputs.platform == 'linux' && (matrix.components.job_name == 'rocblas' || matrix.components.job_name == 'hipblaslt') }}
run: sudo apt install libgfortran5 -y
- name: Test
timeout-minutes: ${{ matrix.components.timeout_minutes }}
run: |
if [ "${{ inputs.PLATFORM }}" == "linux" ]; then source ${VENV_DIR}/bin/activate ; else . ${VENV_DIR}/Scripts/activate ; fi
${{ matrix.components.test_script }}
@@ -0,0 +1,75 @@
name: Synchronize Subtrees
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'
env:
SUPER_REPO_URL: github.com/ROCm/rocm-systems.git
SUPER_REPO_BRANCH: develop
concurrency:
group: pr-update-subtrees-develop
cancel-in-progress: false
jobs:
synchronize-subtrees:
if: github.repository == 'ROCm/rocm-systems'
runs-on: ubuntu-24.04
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 }}
- name: Checkout the Super-repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0 # needed for git subtree pull/push
token: ${{ steps.generate-token.outputs.token }}
- 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: Switch to the Super-repo branch
run: |
git checkout -B "${{ env.SUPER_REPO_BRANCH }}" "origin/${{ env.SUPER_REPO_BRANCH }}"
- name: Update Repositories in the Super-repo
run: |
has_errors=false
for repo in $(cat .github/repos-config.json | jq -r '.repositories[].name'); do
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")
enable_pull=$(cat .github/repos-config.json | jq -r ".repositories[] | select(.name == \"$repo\") | .auto_subtree_pull")
enable_push=$(cat .github/repos-config.json | jq -r ".repositories[] | select(.name == \"$repo\") | .auto_subtree_push")
if [ "$enable_pull" = true ]; then
git subtree pull --prefix "${category}/${repo}" https://github.com/${url}.git $branch || {
has_errors=true
}
fi
# if [ "$enable_push" = true ]; then
# git fetch origin subtrees/${repo}/${branch}
# git branch -f subtrees/${repo}/${branch} origin/subtrees/${repo}/${branch}
# git subtree split --prefix="${category}/${repo}" -b subtrees/${repo}/${branch} --quiet --rejoin || {
# has_errors=true
# }
# git push origin subtrees/${repo}/${branch}
# git push https://github.com/${url}.git subtrees/${repo}/${branch}:${branch}
# fi
done
if [ "$has_errors" = true ]; then
echo "One or more errors occurred during the repository update."
exit 1
else
git push https://${{ env.SUPER_REPO_URL }} ${{ env.SUPER_REPO_BRANCH }}
echo "All repositories updated successfully!"
fi
+78
مشاهده پرونده
@@ -0,0 +1,78 @@
[submodule "projects/rocprofiler/perfetto"]
path = projects/rocprofiler/plugin/perfetto/perfetto
url = https://github.com/google/perfetto.git
branch = releases/v44.x
[submodule "projects/rocprofiler-sdk/external/googletest"]
path = projects/rocprofiler-sdk/external/googletest
url = https://github.com/google/googletest.git
[submodule "projects/rocprofiler-register/external/glog"]
path = projects/rocprofiler-register/external/glog
url = https://github.com/google/glog.git
[submodule "projects/rocprofiler-sdk/external/glog"]
path = projects/rocprofiler-sdk/external/glog
url = https://github.com/google/glog.git
[submodule "projects/rocprofiler-sdk/external/fmt"]
path = projects/rocprofiler-sdk/external/fmt
url = https://github.com/fmtlib/fmt.git
[submodule "projects/rocprofiler-register/external/fmt"]
path = projects/rocprofiler-register/external/fmt
url = https://github.com/fmtlib/fmt.git
[submodule "projects/rocprofiler-sdk/source/docs/doxygen-awesome-css"]
path = projects/rocprofiler-sdk/external/doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git
[submodule "projects/rocprofiler-sdk/external/ptl"]
path = projects/rocprofiler-sdk/external/ptl
url = https://github.com/jrmadsen/PTL
[submodule "projects/rocprofiler-sdk/external/cereal"]
path = projects/rocprofiler-sdk/external/cereal
url = https://github.com/jrmadsen/cereal.git
[submodule "projects/rocprofiler-sdk/external/filesystem"]
path = projects/rocprofiler-sdk/external/filesystem
url = https://github.com/gulrak/filesystem.git
[submodule "projects/rocprofiler-sdk/external/perfetto"]
path = projects/rocprofiler-sdk/external/perfetto
url = https://github.com/google/perfetto
[submodule "projects/rocprofiler-sdk/external/elfio"]
path = projects/rocprofiler-sdk/external/elfio
url = https://github.com/serge1/ELFIO.git
[submodule "projects/rocprofiler-sdk/external/yaml-cpp"]
path = projects/rocprofiler-sdk/external/yaml-cpp
url = https://github.com/jbeder/yaml-cpp.git
[submodule "projects/rocprofiler-sdk/external/json"]
path = projects/rocprofiler-sdk/external/json
url = https://github.com/nlohmann/json.git
[submodule "projects/rocprofiler-sdk/external/sqlite"]
path = projects/rocprofiler-sdk/external/sqlite
url = https://github.com/sqlite/sqlite
[submodule "projects/rocprofiler-sdk/external/pybind11"]
path = projects/rocprofiler-sdk/external/pybind11
url = https://github.com/pybind/pybind11.git
[submodule "projects/rocprofiler-sdk/external/gotcha"]
path = projects/rocprofiler-sdk/external/gotcha
url = https://jrmadsen@github.com/jrmadsen/GOTCHA
[submodule "projects/rocprofiler-systems/external/timemory"]
path = projects/rocprofiler-systems/external/timemory
url = https://github.com/ROCm/timemory.git
branch = rocprofiler-systems
[submodule "projects/rocprofiler-systems/external/perfetto"]
path = projects/rocprofiler-systems/external/perfetto
url = https://github.com/google/perfetto.git
[submodule "projects/rocprofiler-systems/external/elfio"]
path = projects/rocprofiler-systems/external/elfio
url = https://github.com/jrmadsen/ELFIO.git
[submodule "projects/rocprofiler-systems/external/dyninst"]
path = projects/rocprofiler-systems/external/dyninst
url = https://github.com/ROCm/dyninst.git
branch = dyninst_13
[submodule "projects/rocprofiler-systems/external/PTL"]
path = projects/rocprofiler-systems/external/PTL
url = https://github.com/jrmadsen/PTL.git
[submodule "projects/rocprofiler-systems/external/kokkos"]
path = projects/rocprofiler-systems/examples/lulesh/external/kokkos
url = https://github.com/kokkos/kokkos.git
[submodule "projects/rocprofiler-systems/external/papi"]
path = projects/rocprofiler-systems/external/papi
url = https://github.com/icl-utk-edu/papi.git
[submodule "projects/rocprofiler-systems/external/pybind11"]
path = projects/rocprofiler-systems/external/pybind11
url = https://github.com/jrmadsen/pybind11.git
+35
مشاهده پرونده
@@ -0,0 +1,35 @@
exclude: |
third_party/
build/
build-.*/
_build/
projects/hipblaslt/library/src/amd_detail/rocblaslt/src/Tensile
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.4
hooks:
- id: clang-format
name: clang-format (C/C++/ObjC)
entry: clang-format -i -style=file
files: '\.(c|cpp|cc|h|hpp|m|mm)$'
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.10
hooks:
- id: cmake-format
- id: cmake-lint
+163
مشاهده پرونده
@@ -0,0 +1,163 @@
# Contributing to the ROCm Libraries
Thank you for contributing! This guide outlines the development workflow, contribution standards, and best practices when working in the super-repo.
## Getting Started
### Option A: Clone the super-repo
```bash
git clone https://github.com/ROCm/rocm-systems.git
cd rocm-systems
```
### Option B: Clone the super-repo with Sparse-Checkout
To limit your local checkout to only the project(s) you work on and improve performance with a large codebase, you can configure sparse-checkout prior to cloning:
```bash
git clone --no-checkout --filter=blob:none https://github.com/ROCm/rocm-systems.git
cd rocm-systems
git sparse-checkout init --cone
git sparse-checkout set projects/rocblas shared/tensile
git checkout develop # or the branch you are starting from
```
This uses Gits partial clone feature (`--filter=blob:none`) to reduce how much data is downloaded, and sparse-checkout to limit what is checked out to disk. For more background, including guidance on tree-less clones (`--filter=tree:0`) and shallow clones (`--depth=1`), see GitHubs [blog post on partial and shallow clones](https://github.blog/open-source/git/get-up-to-speed-with-partial-clone-and-shallow-clone).
With the source tree as of June 19th, 2025, the clone command lasted 4 seconds in one test run.
The checkout command of the two projects lasted less than 90 seconds.
## Working on Multiple Projects
If your work involves changing projects or introducing new projects, you can update your sparse-checkout environment:
```bash
git sparse-checkout set projects/hipsparse projects/rocsparse
```
This keeps your working directory clean and fast, as you won't need to clone the entire super-repo.
---
## Directory Structure
- `.github/`: CI workflows, scripts, and configuration files for synchronizing repositories during the migration period.
- `docs/`: Documentation, including this guide and other helpful resources.
- `projects/<name>/`: Each folder corresponds to a ROCm library that was previously maintained in its own GitHub repository and released as distinct packages.
- `shared/<name>/`: Shared components that existed in their own repository, used as dependencies by multiple libraries, but do not produce distinct packages in previous ROCm releases.
Further changes to the structure may be made to improve development efficiency and minimize redundancy.
---
## Making Changes
### From a Developer's Perspective
You can continue working inside your project's folder as you did before the super-repo migration.
This process is intended to remain as familiar as possible, though some adjustments may be made to improve efficiency based on feedback.
#### Example: hipblaslt Developer
```bash
cd projects/hipblaslt
# Edit, build, test as usual
```
---
## Keeping Your Branch in Sync
To stay up to date with the latest changes in the super-repo:
```bash
git fetch origin
git rebase origin/develop
```
Avoid using git merge to keep history clean and maintain a linear progression.
---
## New Product Introduction (NPI) and New Technology Introduction (NTI) Development
A mirror of this super-repo will be on GitHub Enterprise Managed User (EMU) and available only on the AMD intranet.
Please reach out within the AMD intranet if you need the link and permissions.
A primary development branch will be created for a new product or new technology.
This branch will remain private until it is cleared to be shared to the public, where it be pushed to the public repo and merged with `develop`.
It will have a subset of CI/CD in place, relative to the public repo.
There will be automation setup to regularly to rebase the branch in the EMU repo with latest `develop` from the public repo.
---
## Branching Model
We are transitioning to trunk-based development, with the tentative plan happening after the next major version release (7.0).
Until the switch is fully implemented, we will continue to sync changes to individual repositories following their existing development model (e.g., `develop` -> `staging` -> `mainline` -> `release`).
However, once trunk-based development is in place, feature branches will be created directly from the default branch, `develop`.
During this period, a high priority will be placed on keeping the `develop` branch healthy.
## Pull Request Guidelines
### 1. Branch Naming and Forks
When creating a branch for your work, use the following convention to make branch names informative and consistent: `users/<github-username>/<branch-name>`.
Try to keep branch names descriptive yet concise to reflect the purpose of the branch. For example, referencing the GitHub Issue number if the pull request is related.
The build and test infrastructure has some tasks where pull requests from forks have fewer privileges than pull requests from branches within this repo. Thus, branches in this repo are encouraged but you are welcome to use forks and their potential gaps. We are actively working towards achieving feature parity between pull requests from branches and pull requests from forks. Please stay tuned.
### 2. Opening the PR
Once you're ready:
```bash
git push origin branch-name-like-above
```
### 3. Auto-Labeling and Review Routing
The super-repo uses automation to assign labels and reviewers based on the changed files. Reviewers are designated via the top-level CODEOWNERS file.
### 4. Tests and CI
Existing testing and CI infrastructure will be updated to directly point to the super-repo.
Specific checks will become mandatory for pull requests before merging. Initially, these will be limited to compilation, but will expand to correctness tests and eventually performance tests.
Hardware and operating system coverage will also expand for these checks over time.
Please refer to [this documentation](/docs/continuous-integration.md) for further details on the current signals that will be provided through CI for pull requests and commits.
---
## Gardener Rotation
In order to achieve the goal of keeping the `develop` branch healthy, a team of ROCm engineers will be dedicated towards monitoring and triaging issues that arise.
This team will collaborate to identify offending commits to isolate what changes need to be reverted.
There may be occassions where bulk reverts may need to occur for more complex issues.
See [docs/gardening.md](docs/gardening.md) for more information.
---
## Developer Communications
As this super-repo continues to evolve, weekly office hour sessions with a wide audience of ROCm engineers and managers will occur.
Focused meetings with smaller project teams will be also be scheduled regularly.
These discussions can go over any topic of the super-repo important to the different teams.
If you want to be looped into these syncs, please reach out to project leadership.
---
## Integration with TheRock
[TheRock](https://github.com/rocm/therock) is our new open-source build system for ROCm. It is designed to significantly enhance our support and scalability for ROCm 7.0 and beyond, and it is actively welcoming community contributions. TheRock currently supports a subset of AMD GPU targets, with ongoing efforts from our team and the community to expand this further, as detailed in TheRock [roadmap](https://github.com/ROCm/TheRock/blob/main/ROADMAP.md).
As part of this mono-repo, TheRock is leveraged to extend our CI to add faster support for more testing and more targets with faster builds speeds. While some of these improvements will be seen with the existing CI, some will be exclusive with the TheRock CI targets given the changes in the high-level CMake system and specific patches that still remain within TheRock. Post ROCm 7.0, our goal is to unify our build system to one to ensure all of our CI has the benefits of the new build system.
---
- 💬 [Start a discussion](https://github.com/ROCm/rocm-systems/discussions)
- 🐞 [Open an issue](https://github.com/ROCm/rocm-systems/issues)
Happy contributing!
+122
مشاهده پرونده
@@ -0,0 +1,122 @@
# ROCm Systems
Welcome to the ROCm Systems super-repo. This repository consolidates multiple ROCm systems projects into a single repository to streamline development, CI, and integration. The first set of projects focuses on requirements for building PyTorch.
# Super-repo Status and CI Health
This table provides the current status of the migration of specific ROCm systems projects as well as a pointer to their current CI health.
**Key:**
- **Completed**: Fully migrated and integrated. This super-repo should be considered the source of truth for this project. The old repo may still be used for release activities.
- **In Progress**: Ongoing migration, tests, or integration. Please refrain from submitting new pull requests on the individual repo of the project, and develop on the super-repo.
- **Pending**: Not yet started or in the early planning stages. The individual repo should be considered the source of truth for this project.
| Component | Source of Truth | Migration Status | Azure CI Status | Component CI Status |
|------------------------|-----------------|------------------|---------------------------------------|---------------------------------------|
| `amdsmi` | EMU | Pending | | |
| `aqlprofile` | EMU | Pending | | |
| `clr` | EMU | Pending | | |
| `hip` | EMU | Pending | | |
| `hipother` | EMU | Pending | | |
| `hip-tests` | EMU | Pending | | |
| `rccl` | Public | Pending | | |
| `rdc` | EMU | Pending | | |
| `rocm-core` | EMU | Pending | | |
| `rocminfo` | EMU | Pending | | |
| `rocm-smi-lib` | EMU | Pending | | |
| `rocprofiler` | Public | Completed | | |
| `rocprofiler-compute` | Public | Pending | | |
| `rocprofiler-register` | Public | Completed | | |
| `rocprofiler-sdk` | EMU | Pending | | |
| `rocprofiler-systems` | Public | Pending | | |
| `rocr-runtime` | EMU | Pending | | |
| `rocshmem` | Public | Pending | | |
| `roctracer` | Public | Completed | | |
## Tentative migration schedule
| Component | Tentative Date |
|------------------------|----------------|
| `rocprofiler-compute` | 8/6 |
| `rocprofiler-systems` | 8/6 |
| `aqlprofile` | 8/7 |
| `rocprofiler-sdk` | 8/7 |
| `rdc` | 8/8 |
| `rocm-smi-lib` | 8/8 |
| `rocminfo` | 8/11 |
| `rocr-runtime` | 8/11 |
| `rocm-core` | 8/12 |
| `clr` | 8/21 |
| `hip` | 8/21 |
| `hipother` | 8/21 |
| `hip-tests` | 8/21 |
*Remaining schedule to be determined.
# TheRock CI Status
Note TheRock CI performs multi-component testing on top of builds leveraging [TheRock](https://github.com/ROCm/TheRock) build system.
[![The Rock CI](https://github.com/ROCm/rocm-systems/actions/workflows/therock-ci.yml/badge.svg?branch%3Adevelop+event%3Apush)](https://github.com/ROCm/rocm-systems/actions/workflows/therock-ci.yml?query=branch%3Adevelop+event%3Apush)
---
## Nomenclature
Project names have been standardized to match the casing and punctuation of released packages. This removes inconsistent camel-casing and underscores used in legacy repositories.
## Structure
The repository is organized as follows:
```
projects/
amdsmi/
aqlprofile/
clr/
hip/
hipother/
hip-tests/
rccl/
rdc/
rocm-core
rocminfo/
rocmsmilib/
rocprofiler/
rocprofiler-compute/
rocprofiler-register/
rocprofiler-sdk/
rocprofiler-systems/
rocrruntime/
rocshmem/
roctracer/
```
- Each folder under `projects/` corresponds to a ROCm systems project that was previously maintained in a standalone GitHub repository and released as distinct packages.
- Each folder under `shared/` contains code that existed in its own repository and is used as a dependency by multiple projects, but does not produce its own distinct packages in previous ROCm releases.
## Goals
- Enable unified build and test workflows across ROCm libraries.
- Facilitate shared tooling, CI, and contributor experience.
- Improve integration, visibility, and collaboration across ROCm library teams.
## Getting Started
To begin contributing or building, see the [CONTRIBUTING.md](./CONTRIBUTING.md) guide. It includes setup instructions, sparse-checkout configuration, development workflow, and pull request guidelines.
## License
This super-repo contains multiple subprojects, each of which retains the license under which it was originally published.
📁 Refer to the `LICENSE`, `LICENSE.md`, or `LICENSE.txt` file within each `projects/` or `shared/` directory for specific license terms.
> **Note**: The root of this repository does not define a unified license across all components.
## Questions or Feedback?
- 💬 [Start a discussion](https://github.com/ROCm/rocm-systems/discussions)
- 🐞 [Open an issue](https://github.com/ROCm/rocm-systems/issues)
We're happy to help!
@@ -0,0 +1,112 @@
# Continuous Integration
> [!IMPORTANT]
> This document is currently in **draft** and may be subject to change.
This document is to detail the various continuous integration (CI) systems that are run on the rocm-systems super-repo.
## Table of Contents
1. [Azure Pipelines](#azure-pipelines)
1. [Overview](#az-overview)
2. [PR Workflow](#az-workflow)
3. [Interpreting Results](#az-results)
4. [Build and Test Coverage](#az-coverage)
5. [Downstream Job Triggers](#az-downstream)
2. [Math CI](#math-ci)
1. [Overview](#math-overview)
3. [Windows CI](#windows-ci)
1. [Overview](#win-overview)
4. [TheRock CI](#therock-ci)
1. [Overview](#rock-overview)
## Azure Pipelines
### Overview <a id="az-overview"></a>
The ROCm Azure Pipelines CI (also known as External CI) is a public-facing CI system that builds and tests against latest public source code. It encompasses almost all of the ROCm stack, typically pulling source code from the `develop` or `amd-staging` branch on a component's GitHub repository. The CI's main source is publically available at [ROCm/ROCm/.azuredevops](https://github.com/ROCm/ROCm/tree/develop/.azuredevops).
See the [Azure super-repo dashboard](https://dev.azure.com/ROCm-CI/ROCm-CI/_build?definitionScope=%5Csuper-repo) for a full list of pipelines running in the super-repo.
For commits, the pipelines will run based on the conditions defined in the trigger files under [/.azuredevops](https://github.com/ROCm/rocm-systems/tree/develop/.azuredevops).
For PRs, the [`Dispatch Azure CI`](https://github.com/ROCm/rocm-systems/blob/develop/.github/workflows/azure-ci-dispatcher.yml) GitHub Action will be run, which will analyze a PR's contents and determine which pipelines to run. This action will report the final results of each Azure run it dispatches.
### PR Workflow <a id="az-workflow"></a>
1. PR is submitted
2. `Dispatch Azure CI` is run on the PR
1. Analyzes the PR's contents, determines which pipelines to run
2. Sends request(s) to Azure API to start runs
3. Azure CI builds and tests the PR against latest public source
4. `Dispatch Azure CI` waits until all runs are finished and reports their overall status
URLs for individual Azure runs can be found in the logs of the `Dispatch Azure CI` action, under the `Wait for and report Azure CI` step.
### Interpreting Results <a id="az-results"></a>
Any errors or warnings during a run will be highlighted on the run's main page on Azure, and clicking on those will bring you directly to the offending logs.
Azure runs can have the following statuses: `Success`, `Failed`, or `Warning`. This corresponds to GitHub status checks as follows:
| Azure Status | GitHub PR Status | Explanation |
|-|-|-|
| ✅ Success | ✅ Succeeded | The job was successful. |
| ⚠️ Warning | ✅ Succeeded with issues | An allowed failure occurred and the job continued on without further issue. |
| ❌ Failed | ❌ Failing | The job failed. |
| Did not run | ⬛ Neutral | The job did not run, likely due to not fulfilling the trigger requirements. |
Warnings can occur if a step fails but was marked as being allowed to fail, so a job will continue running in the event of a warning.
In particular, steps are allowed to fail if they have the property `continueOnError: true` ([reference](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/tasks?view=azure-devops&tabs=yaml#task-control-options)).
### Build and Test Coverage <a id="az-coverage"></a>
Azure CI builds and tests primarily on Ubuntu 22.04 LTS and for `gfx942` and `gfx90a` architectures, and adding build support for more architectures and operating systems is in progress.
Build coverage:
| | Ubuntu 22.04 | Almalinux 8 |
|-|-|-|
| **gfx942** | ✅ Supported | ✅ Supported |
| **gfx90a** | ✅ Supported | ✅ Supported |
| **gfx1201** | 🚧 In progress | 🚧 In progress |
| **gfx1100** | 🚧 In progress | 🚧 In progress |
| **gfx1030** | 🚧 In progress | 🚧 In progress |
Test coverage:
| | Ubuntu 22.04 | Almalinux 8 |
|-|-|-|
| **gfx942** | ✅ Supported | ❌ Unsupported |
| **gfx90a** | ✅ Supported | ❌ Unsupported |
| **gfx1201** | ❌ Unsupported | ❌ Unsupported |
| **gfx1100** | ❌ Unsupported | ❌ Unsupported |
| **gfx1030** | ❌ Unsupported | ❌ Unsupported |
For testing, the majority of components use `ctest` or `gtest`. Component-specific details such as build flags and test configurations can be viewed in a component's main pipeline file in [ROCm/ROCm/.azuredevops/components](https://github.com/ROCm/ROCm/tree/develop/.azuredevops/components).
### Downstream Job Triggers <a id="az-downstream"></a>
Azure CI runs for a component will trigger runs for downstream components (provided that they are fully migrated onto the super-repo). The end goal is to catch upstream breaking changes before they are merged and to ensure the super-repo is always in a valid state.
For example: a rocPRIM PR will trigger a rocPRIM job. If successful, it will then continue to run hipCUB and rocThrust jobs.
Currently, the following downstream trigger paths are enabled:
```mermaid
graph TD;
rocPRIM-->hipCUB;
rocPRIM-->rocThrust;
rocRAND-->hipRAND;
hipBLAS-common-->hipBLASLt
```
## Math CI
### Overview <a id="math-overview"></a>
## Windows CI
### Overview <a id="win-overview"></a>
## TheRock CI
### Overview <a id="rock-overview"></a>
+104
مشاهده پرونده
@@ -0,0 +1,104 @@
# ROCm Libraries Gardeners
This documents the mechanics of
[gardening](https://github.com/ROCm/TheRock/blob/main/docs/rfcs/RFC0002-MonoRepo-Gardener-Rotations.md)
for the ROCm Libraries. If you haven't read the above doc, please start there.
## Becoming a member
Gardeners will need to be members of the [Compute Library Gardeners team](https://github.com/orgs/ROCm/teams/compute-library-gardeners).
Please contact an owner to become a gardener.
## Communications channel
We will be leveraging a shared Teams channel that contains all gardeners as well as core
infrastructure team members. You will be added to this channel once you become a member.
For anyone who wants to reach a gardener please email:
[rocm-systems-gardeners](mailto:rocm-systems-gardeners@amd.com)
## Mechanics of Gardening
Your primary job is to keep the mono-repo shippable. In order to facilitate this we've made
status badges for all relevant CI available here:
https://github.com/ROCm/rocm-systems?tab=readme-ov-file#super-repo-status-and-ci-health.
Effectively your job is to ensure all status badges are green. All of these status
badges are clickable which will allow you to deep-dive on any failures quickly. If any
CI is missing, please file an issue leveraging the "gardener" tag, ping on the teams chat,
or preferably, add it yourself. You'll probably be tagged to review the PR if someone
else gets to it first.
## Notes on Privileges
Developers will not be able to bypass pre-submit checks in this repository unless an admin or
gardener pushes it through. This is being done intentionally to ensure we keep the quality of
the tree green. This also means that you will be asked to push changes through without
additional context. Your duty is to ensure you keep the tree green (or make it greener) so gardeners will need to understand the context before approving
any of these changes. Changes
that are ok:
- Reverts to fix broken things.
- Fast-forward fixes where reverts are unclear
- Fixes unrelated to code health (docs, etc)
On a case by case basis you should consider critical customer fixes, but these should be considered
as a group and likely admins should be approving the majority of those.
As an example to include an admin: *we have a critical feature but develop is broken and it is unrelated to our changes*
## Scope of Gardeners and Developers
In scope:
- Gardeners are responsible for ensuring develop (post-submit) checks remain green.
- If a post-submit check is red, the gardeners should review the failing CI system and triage the issue.
- No matter the issue, gardeners should notify the larger gardening team at least once per day about any post-submit failures.
- If the issue is related to a failure in the CI system (not a code change), the gardener should note the issue,
verify whether existing PRs are facing the same problem, and notify the appropriate CI team, escalating the issue if required.
- If the issue is related to a code change, the gardener should isolate the error message, and notify the
appropriate component owners with a link to the log (reference the [CODEOWNERS](../.github/CODEOWNERS) file).
Not in scope:
- Gardeners are not responsible for fixing code changes that break post-submit checks.
- Gardeners are not responsible for monitoring the health of every open PR.
Developer responsibilities:
- If developers find CI system failures in their PR (pre-submit) checks they should notify the gardener on rotation and the appropriate CI team.
### Beyond the Responsibilities
Gardeners should generally aim to be efficient at operating the CI/CD systems and doing first pass triage and routing.
Especially for people new to the role, this will involve more reaching out for help and coordinating resolution, but as experience increases,
it is natural to take a more active role in helping to route and do first pass triage oneself.
While going the extra mile on this is not a requirement of the role, efficient gardeners should aim to develop a proficiency with the
tools and their colleagues such that their judgment reduces the overall toil to the team. Often people who develop these skills find it
more effective to look a little bit more deeply at failures and route for resolution properly in one step.
This kind of investment is deeply valued for the overall health of the team and is encouraged.
### CI Teams
CI | Main primary contact | Team
---- | ------- | ---------
Profilers CI | TBD | TBD
External (Azure) CI | jayhawk-commits | [ROCm/external-ci](https://github.com/orgs/ROCm/teams/external-ci)
TheRock CI | geomin12 | [ROCm/therockinfra](https://github.com/orgs/ROCm/teams/therockinfra)
## Gardener Rotation
Week | North America | Europe / India / APAC
---- | ------- | ---------
It is the responsibility of the current gardeners to update the table when the gardeners rotate.
### Log
Filling in this section is optional while on rotation. While this level of
organization and tracking is not expected from all members, seeing the incident
history and actions taken in one location can be useful. However, for bugs that you can't immediately address
please file a new GH issue and label it with the "gardener" label.
You can see current list of [gardener known bugs](https://github.com/ROCm/rocm-systems/issues?q=is%3Aissue%20state%3Aopen%20label%3Agardener)
Date | Library | Issue overview | Link to details | Resolved?
---- | ------- | -------------- | --------------- | ---------
6/30 | | | | ✅
@@ -0,0 +1,67 @@
# How to cherry-pick super-repo changes into release-staging branches
> [!IMPORTANT]
> This document is currently in **draft** and may be subject to change.
When a project has been migrated into the ROCm super-repo, day-to-day work happens on the super-repos `develop` branch.
Down-stream teams, however, still consume the original (pre-super-repo) repositories, particularly their `release-staging/rocm-rel-x.y` branches, through a variety of mechanisms.
This document explains how to move a change from the super-repo into those release-staging branches while guaranteeing that every commit on a release-staging branch also exists in the super-repo.
## 1. Land the change in the super-repo's develop branch
1. Create a pull request in `ROCm/rocm-systems` that targets `develop`.
2. When merging, choose **Squash & Merge** (if the change can be represented as a single logical commit).
Why? A single commit is easier to cherry-pick later.
Result: The commit is now on `ROCm/rocm-systems:develop`.
## 2. Cherry-pick into the super-repo's release-staging branch
1. Create a local branch based on the release-staging branch:
```
$ git checkout -b cherry-pick-foo-rel-x.y origin/release-staging/rocm-rel-x.y
```
2. Cherry-pick the commit:
```
$ git cherry-pick abcd1234
```
3. Resolve any merge conflicts (rare if the branch is close to develop).
4. Push the branch and open a PR that targets `ROCm/rocm-systems:release-staging/rocm-rel-x.y`.
5. Request reviews, obtain approvals, and merge.
## 3. Wait for the automatic “fan-out” sync
Every ~15 minutes, a CI job copies new commits from the super-repo back into the corresponding standalone repositories.
After merging your PR:
1. Monitor the CI job or simply wait ~15 minutes.
2. Go to the original (pre-super-repo) repository and verify the commits have been reflected onto the `develop` and `release-staging/rocm-rel-x.y` branches.
## FAQ
Q : Can I cherry-pick multiple commits at once?
A : Yes, but prefer a squash merge in the super-repo so you only need to pick one.
Q : What if the auto-sync hasnt copied the commit?
A : Verify the CI status in `rocm-systems`. If failed, ask the infra team; the commit will re-sync after a successful run.
Q : Can I push directly to the release-staging branch?
A : No. Always go through a PR so CI and reviewers can validate the cherry-pick.
Q : What if commits have been pushed to develop that make a cherry-pick incompatible with release-staging?
A : It's likely that this fix/change will also be landed in develop at some point, else we risk divergent features/support. So, it's recommended to still land the change in develop first, and cherry-pick to release-staging, resolving any merge conflicts that arise. If for some reason the develop branch has diverged so far from the release-staging for your component that a cherry-pick is irreconcilable, land the changes in develop and release-staging using fully separate PRs, and add references to the other for traceability.
## Summary
In short:
1. Merge change to super-repo `develop`.
2. Cherry-pick to super-repo `release-staging/rocm-rel-x.y`.
3. Wait for the fan-out sync and verify the changes are reflected in the original repository.
Following this process keeps release branches in sync with the super-repo while allowing critical fixes to flow to down-stream consumers.
+156
مشاهده پرونده
@@ -0,0 +1,156 @@
# Migration from Single Repo to super-repo
## Introduction
This document outlines the process for migrating from a single library repository to this super-repo. It covers the necessary steps to ensure a smooth transition, including pre-conditions, conflict resolution, and changes to repository management.
## Pre-conditions
To ensure consistency and maintainability during the migration, the following pre-conditions must be satisfied:
1. **Identify Next Repo to Migrate:**
- Please refer to the main [README.md](/README.md) on the order of repositories being migrated.
- This is usually discussed in advance in meetings with the technical leads of that project.
2. **Identify Branches and Pull Requests:**
- Determine branches and active pull requests that will be affected by the migration.
- Typically, this is limited to the pull requests targeting `develop` and `release-staging` branches.
- Any point-fixes for previous releases will not be migrated over.
3. **Pause Merges:**
- There are GitHub Actions that automatically synchronize changes from the individual repos to the super-repo.
- These automated actions need to be paused by disabling the workflow on the GitHub UI.
- develop branch workflow: https://github.com/ROCm/rocm-systems/actions/workflows/update-subtrees.yml
- release-staging branch workflow: https://github.com/ROCm/rocm-systems/actions/workflows/update-release-staging-subtree.yml
- Announce the pause to key stakeholders and ask them to propagate the news.
## Migration Process
### Step 1: Pull Request Management
1. **Automated Import of Pull Requests:**
- Pull requests without merge conflicts will be automatically imported with a GitHub Action, only executable by maintainers and admins.
- This GitHub action will create a feature branch on the super-repo, pulling in the changes from the PR on the original repo using `git subtree`.
- These imported pull requests will have the `imported pr` label applied.
- After running the action successfully, close the PR on the original repo.
- GitHub Action: https://github.com/ROCm/rocm-systems/actions/workflows/pr-import.yml
- Example Imported Pull Request on super-repo: https://github.com/ROCm/rocm-systems/pull/206
- Corresponding Pull Request on Original Repo: https://github.com/ROCm/Tensile/pull/2135
2. **Conflict Resolution:**
- For pull requests with merge conflicts, add a comment explaining the merge conflict and blocking issue preventing import.
- Collaborate with contributors to import these PRs after the migration period, or the contributor can reopen the pull request themselves on the super-repo.
3. **NPI Development:**
- Repeat this import process for the super-repo on GitHub EMU for npi work.
### Step 2: Issue and Comment Import
1. **Issue Import:**
- Import all open issues from both public and EMU repositories with a GitHub Action, only executable by maintainers and admins.
- Comments are copied over in the imported issues.
- GitHub Action: https://github.com/ROCm/rocm-systems/actions/workflows/issue-import.yml
- Ensure issue status and labels are preserved during migration.
- Look for any weird unicode characters that get mangled during the automated import.
- After running the action successfully, close the issue with a comment on the original repo.
- Example Imported Issue on super-repo: https://github.com/ROCm/rocm-systems/issues/100
- Corresponding Issue on Original Repo: https://github.com/ROCm/rocThrust/issues/501
### Step 3: Path-Based Commit History
1. **Use of Git Filter-Repo:**
- Utilize `git filter-repo` at the migration point to add path-based commit history.
- As changing the contents of a commit will change the output the hash function, commit SHA will change.
- The filter-repo tool is used to add a snippet at the end of the old commit to refer to the old commit SHA.
- It is not possible to preserve the same commit SHA if the metadata is changed to point to new paths, as the hash function output changes.
- Example directory view: https://github.com/ROCm/rocm-systems/commits/develop/projects/rocrand/library
- Example commit view: https://github.com/ROCm/rocm-systems/commit/ea8b6884a0f2a0ec80ff7811bc5ec042600790e9
2. **command sequence example**
Some steps are added to ensure you have latest checked out, in case you're copy-pasting and already have the repositories checked out beforehand.
```
python3 -m pip install --user git-filter-repo
git clone git@github.com:ROCm/hipBLAS-common.git
pushd hipBLAS-common
git checkout develop
git pull origin
git checkout -b filtered/hipblas-common
git filter-repo --path-rename '':'projects/hipblas-common/' --commit-callback "original_hash = commit.original_id.decode(); original_message = commit.message.decode(); new_message = f'{original_message}\\n\\n[ROCm/hipBLAS-common commit: {original_hash}]' if original_message.strip() else f'[ROCm/hipBLAS-common commit: {original_hash}]'; commit.message = new_message.encode()" --force
git remote add super-repo git@github.com:ROCm/rocm-systems.git
git push super-repo filtered/hipblas-common
popd
git clone git@github.com:ROCm/rocm-systems.git
git checkout develop
git pull origin
git branch backup/develop-hipblas-common
git checkout filtered/hipblas-common
git checkout -b preserved/hipblas-common
git merge origin/develop --allow-unrelated-histories
# Set merge commit message to "Import path-preserved history of hipblas-common into the super-repo."
git push --set-upstream origin preserved/hipblas-common
git checkout develop
git reset --hard preserved/hipblas-common
git push origin develop
# Double check contents. Make sure no stray developers merged PRs on either repo during this period. Manually pull in those PRs for these exceptional cases.
# Delete the temporary branches created in this sequence.
```
### Step 4: CI/CD Triggers
1. **CI/CD Trigger Points:**
- Modify the existing CI/CD systems to be triggered off changes to this project in the super-repo.
### Step 5: Repository Adjustments
1. **Default Branch Deprecation:**
- Change the default branch of the original repository with a clear deprecation notice.
- Example: https://github.com/ROCm/rocPRIM/tree/develop_deprecated
2. **Disable Dependabot Updates:**
- Cease automatic dependency updates in the old repository to streamline the focus on the super-repo.
- Clear the contents in this file on the original repo: https://github.com/ROCm/rocPRIM/blob/develop_deprecated/.github/dependabot.yml
- In the original repo settings, go to Security -> Advanced Security and disable all the Dependabot settings.
3. **Protection Rules:**
- Use branch protection to make the new default branch with the deprecation notice read-only.
- Create a ruleset for the `develop` branch to also be restrictive, but allow the systems-assistant bot exceptions to push patches to the original repository.
### Step 6: Source of Truth Declaration
1. **Update repos-config.json:**
- Update the true/false values in the [`repos-config.json`](/.github/repos-config.json) file that automated workflows use to determine which way the source gets synchronized..
- `auto_subtree_pull` should now be false, `auto_subtree_push` should now be true for this migrated project.
- Make this change on both the `develop` and `release-staging` branches.
- https://github.com/ROCm/rocm-systems/blob/develop/.github/repos-config.json
- https://github.com/ROCm/rocm-systems/blob/release-staging/rocm-rel-7.0/.github/repos-config.json
2. **Update the super-repo README.md:**
- Update the migration status on the super-repo's main readme to indicate the migration has been completed.
- https://github.com/ROCm/rocm-systems/blob/develop/README.md
## Post-Migration Activities
1. **Re-enable synchronization jobs:**
- Re-enable any automated workflows that were paused.
2. **Communication:**
- Communicate to key stakeholders the successful completion of the migration.
- Continue daily meetings and active written communications to offer support for any issues that arise.
3. **Automated Patching of Original Repos:**
- During the migration period, when a pull request is merged on the super-repo, the contents of the pull request will be split into patches to be pushed onto the original repos.
- This supports potential pull requests that touch multiple projects.
- Example pull request on the super-repo: https://github.com/ROCm/rocm-systems/pull/230
- Corresponding patches on the original repos:
- https://github.com/ROCm/hipCUB/commit/50438ec4971def627729ea3d9dc1485e52b09e48
- https://github.com/ROCm/hipRAND/commit/74afe303def580290a8e5b149ea13ae739bc4c61
- https://github.com/ROCm/rocPRIM/commit/0514a7bfdd44b324654b53f885dec928af61279a
- https://github.com/ROCm/rocRAND/commit/39fe7d9dca493765573c3c8be275328547ea2abe
- https://github.com/ROCm/rocThrust/commit/cdcc666a4c42770fcb7d9fde7c71c243b53c476e
4. **Monitoring:**
- Monitor the super-repo for any issues or discrepancies.
- If the automated patching for a PR failed to make it to the original repo, use this GitHub Action: https://github.com/ROCm/rocm-systems/actions/workflows/pr-merge-sync-patches-manual.yml
## Conclusion
This migration process aims to assist the ROCm development teams transition from many repos to a super-repo by addressing the topics above. By following these outlined steps, we aim to maintain and improve the quality of our development workflow post-migration.
@@ -0,0 +1,205 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
StatementAttributeLikeMacros:
- Q_EMIT
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 3
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: pb
BasedOnStyle: google
ReflowComments: true
ShortNamespaceLines: 1
SortIncludes: false
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Auto
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...
+13
مشاهده پرونده
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "pip" # See documentation for possible values
directory: "/docs/sphinx" # Location of package manifests
open-pull-requests-limit: 10
schedule:
interval: "daily"
versioning-strategy: increase
+5
مشاهده پرونده
@@ -0,0 +1,5 @@
disabled: false
scmId: gh-emu-rocm
branchesToScan:
- amd-staging
- amd-mainline
+102
مشاهده پرونده
@@ -0,0 +1,102 @@
name: "CodeQL Advanced"
on:
push:
branches: [ "amd-staging" ]
pull_request:
branches: [ "amd-staging" ]
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: AMD-ROCm-Internal-dev1
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
- if: matrix.build-mode == 'manual'
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 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: |
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,149 @@
name: Continuous Integration
on:
workflow_dispatch:
push:
branches: [ amd-staging, amd-mainline, amd-npi ]
paths-ignore:
- '*.md'
- 'source/docs/**'
- 'CODEOWNERS'
pull_request:
paths-ignore:
- '*.md'
- 'source/docs/**'
- 'CODEOWNERS'
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
PATH: "/usr/bin:$PATH"
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:
# 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:
runner: ['navi4', 'navi3', 'mi300']
os: ['ubuntu-22.04']
build-type: ['RelWithDebInfo']
runs-on: ${{ matrix.runner }}${{ github.ref == 'refs/heads/amd-npi' && '-npi' || '' }}-emu-runner-set
if: github.event.pull_request.head.repo.full_name == 'AMD-ROCm-Internal/aqlprofile'
permissions:
contents: read
pull-requests: write
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
CORE_EXT_RUNNER: mi300a
steps:
- uses: actions/checkout@v4
- 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 /opt/rocm/.info/version
ls -la
pwd
- name: Configure, Build, and Test
timeout-minutes: 30
shell: bash
run:
LD_LIBRARY_PATH=$(pwd)/build:$LD_LIBRARY_PATH ctest --output-on-failure -V -DCTEST_SOURCE_DIRECTORY="$(pwd)"
-DCTEST_BINARY_DIRECTORY="$(pwd)/build" -DAQLPROFILE_BUILD_NUM_JOBS="16" -DCTEST_SITE="${RUNNER_HOSTNAME}"
-DCTEST_BUILD_NAME=PR_${{ github.ref_name }}_${{ github.repository }}-${{ matrix.os }}-${{ matrix.runner }}-core
-DCMAKE_CTEST_ARGUMENTS=""
-DAQLPROFILE_BUILD_TESTS=ON
-DAQLPROFILE_EXTRA_CONFIGURE_ARGS=""
-S ./dashboard.cmake
core-rpm:
if: github.ref != 'refs/heads/amd-npi' && github.event.pull_request.head.repo.full_name == 'AMD-ROCm-Internal/aqlprofile'
# 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:
runner: ['mi300']
os: ['rhel', 'sles']
build-type: ['RelWithDebInfo']
ci-flags: ['--linter clang-tidy']
runs-on: ${{ matrix.os }}-emu-runner-set
permissions:
contents: read
pull-requests: write
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
CORE_EXT_RUNNER: mi300
steps:
- uses: actions/checkout@v4
- name: Install requirements
timeout-minutes: 10
shell: bash
run: |
git config --global --add safe.directory '*'
- 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 /opt/rocm/.info/version
ls -la
pwd
- name: Configure, Build, and Test
timeout-minutes: 30
shell: bash
run:
LD_LIBRARY_PATH=$(pwd)/build:$LD_LIBRARY_PATH ctest --output-on-failure -V -DCTEST_SOURCE_DIRECTORY="$(pwd)"
-DCTEST_BINARY_DIRECTORY="$(pwd)/build" -DAQLPROFILE_BUILD_NUM_JOBS="16" -DCTEST_SITE="${RUNNER_HOSTNAME}"
-DCTEST_BUILD_NAME=PR_${{ github.ref_name }}_${{ github.repository }}-${{ matrix.os }}-${{ matrix.runner }}-core
-DCMAKE_CTEST_ARGUMENTS=""
-DAQLPROFILE_BUILD_TESTS=ON
-DAQLPROFILE_EXTRA_CONFIGURE_ARGS=""
-S ./dashboard.cmake
@@ -0,0 +1,102 @@
name: Close external PR
on:
pull_request_target:
types: [closed]
branches:
- amd-staging
jobs:
git-mirror:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == 'AMD-ROCm-Internal/aqlprofile' && contains(github.event.pull_request.head.ref, 'external-pr')
steps:
- name: Get Current PR Body
id: current_pr
run: |
# Use the PR body directly from the event payload
# This is the body as it was when the 'opened' or 'edited' event was triggered.
RAW_PR_BODY="${{ github.event.pull_request.body }}"
# Handle cases where the body might be null (e.g., an empty PR description)
# In bash, an unset or null variable in quotes becomes an empty string,
# but it's good practice to be explicit or test.
# If RAW_PR_BODY is null from the JSON payload, it will be treated as an empty string here by bash.
# For more robust null handling if needed elsewhere: PR_BODY_FOR_SCRIPT="${RAW_PR_BODY:-}"
PR_BODY_FOR_SCRIPT="$RAW_PR_BODY"
echo "PR Body from event payload (first 500 chars):"
echo "${PR_BODY_FOR_SCRIPT:0:500}" # Print a snippet for logging
echo "-------------------"
# If you need to pass this body to subsequent steps via GITHUB_OUTPUT,
# the multiline escaping is still crucial.
ESCAPED_PR_BODY="${RAW_PR_BODY//'%'/'%25'}"
ESCAPED_PR_BODY="${ESCAPED_PR_BODY//$'\n'/'%0A'}"
ESCAPED_PR_BODY="${ESCAPED_PR_BODY//$'\r'/'%0D'}"
echo "PR_BODY_CONTENT<<EOF" >> $GITHUB_OUTPUT
echo "$ESCAPED_PR_BODY" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Extract Remote PR URL and Info
id: remote_pr_info
run: |
PR_BODY="${{ steps.current_pr.outputs.PR_BODY_CONTENT }}"
echo "Current PR Body:"
echo "${PR_BODY}"
echo "-------------------"
# Regex to find GitHub PR URLs. This is a common pattern.
# It captures owner, repo, and pr_number.
REMOTE_PR_URL_REGEX="https://github.com/([^/]+)/([^/]+)/pull/([0-9]+)"
if [[ "$PR_BODY" =~ $REMOTE_PR_URL_REGEX ]]; then
REMOTE_PR_URL="${BASH_REMATCH[0]}"
REMOTE_OWNER="${BASH_REMATCH[1]}"
REMOTE_REPO="${BASH_REMATCH[2]}"
REMOTE_PR_NUMBER="${BASH_REMATCH[3]}"
echo "Found Remote PR URL: $REMOTE_PR_URL"
echo "Remote Owner: $REMOTE_OWNER"
echo "Remote Repo: $REMOTE_REPO"
echo "Remote PR Number: $REMOTE_PR_NUMBER"
echo "REMOTE_PR_URL=$REMOTE_PR_URL" >> $GITHUB_OUTPUT
echo "REMOTE_OWNER=$REMOTE_OWNER" >> $GITHUB_OUTPUT
echo "REMOTE_REPO=$REMOTE_REPO" >> $GITHUB_OUTPUT
echo "REMOTE_PR_NUMBER=$REMOTE_PR_NUMBER" >> $GITHUB_OUTPUT
echo "FOUND_URL=true" >> $GITHUB_OUTPUT
else
echo "::warning::No GitHub PR URL found in the current PR body."
echo "FOUND_URL=false" >> $GITHUB_OUTPUT
fi
- name: Output Results
if: steps.remote_pr_info.outputs.FOUND_URL == 'true'
run: |
echo "Successfully retrieved branch info from remote PR."
echo "Remote PR URL: ${{ steps.remote_pr_info.outputs.REMOTE_PR_URL }}"
- name: Handle No URL Found
if: steps.remote_pr_info.outputs.FOUND_URL == 'false'
run: |
echo "No remote PR URL was found in the body of PR #${{ github.event.pull_request.number }}."
- name: Comment on and Close External PR
if: steps.remote_pr_info.outputs.FOUND_URL == 'true'
env:
GH_TOKEN: ${{ secrets.EXT_TOKEN }}
EXTERNAL_PR_NUMBER: ${{ steps.remote_pr_info.outputs.REMOTE_PR_NUMBER }}
EXTERNAL_REPO: "ROCm/aqlprofile"
run: |
COMMENT_BODY="This pull request has been closed in the internal repository. Thank you for your contribution!"
gh pr comment "$EXTERNAL_PR_NUMBER" \
--repo "$EXTERNAL_REPO" \
--body "$COMMENT_BODY"
gh pr close "$EXTERNAL_PR_NUMBER" \
--repo "$EXTERNAL_REPO"
echo "Commented on and Closed external PR #${EXTERNAL_PR_NUMBER}"
@@ -0,0 +1,132 @@
name: Sync external PR branch to public repository
on:
pull_request_target:
branches:
- amd-staging
jobs:
git-mirror:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == 'AMD-ROCm-Internal/aqlprofile' && contains(github.event.pull_request.head.ref, 'external-pr')
steps:
- name: Get Current PR Body
id: current_pr
run: |
# Use the PR body directly from the event payload
# This is the body as it was when the 'opened' or 'edited' event was triggered.
RAW_PR_BODY="${{ github.event.pull_request.body }}"
# Handle cases where the body might be null (e.g., an empty PR description)
# In bash, an unset or null variable in quotes becomes an empty string,
# but it's good practice to be explicit or test.
# If RAW_PR_BODY is null from the JSON payload, it will be treated as an empty string here by bash.
# For more robust null handling if needed elsewhere: PR_BODY_FOR_SCRIPT="${RAW_PR_BODY:-}"
PR_BODY_FOR_SCRIPT="$RAW_PR_BODY"
echo "PR Body from event payload (first 500 chars):"
echo "${PR_BODY_FOR_SCRIPT:0:500}" # Print a snippet for logging
echo "-------------------"
# If you need to pass this body to subsequent steps via GITHUB_OUTPUT,
# the multiline escaping is still crucial.
ESCAPED_PR_BODY="${RAW_PR_BODY//'%'/'%25'}"
ESCAPED_PR_BODY="${ESCAPED_PR_BODY//$'\n'/'%0A'}"
ESCAPED_PR_BODY="${ESCAPED_PR_BODY//$'\r'/'%0D'}"
echo "PR_BODY_CONTENT<<EOF" >> $GITHUB_OUTPUT
echo "$ESCAPED_PR_BODY" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Extract Remote PR URL and Info
id: remote_pr_info
run: |
PR_BODY="${{ steps.current_pr.outputs.PR_BODY_CONTENT }}"
echo "Current PR Body:"
echo "${PR_BODY}"
echo "-------------------"
# Regex to find GitHub PR URLs. This is a common pattern.
# It captures owner, repo, and pr_number.
REMOTE_PR_URL_REGEX="https://github.com/([^/]+)/([^/]+)/pull/([0-9]+)"
if [[ "$PR_BODY" =~ $REMOTE_PR_URL_REGEX ]]; then
REMOTE_PR_URL="${BASH_REMATCH[0]}"
REMOTE_OWNER="${BASH_REMATCH[1]}"
REMOTE_REPO="${BASH_REMATCH[2]}"
REMOTE_PR_NUMBER="${BASH_REMATCH[3]}"
echo "Found Remote PR URL: $REMOTE_PR_URL"
echo "Remote Owner: $REMOTE_OWNER"
echo "Remote Repo: $REMOTE_REPO"
echo "Remote PR Number: $REMOTE_PR_NUMBER"
echo "REMOTE_PR_URL=$REMOTE_PR_URL" >> $GITHUB_OUTPUT
echo "REMOTE_OWNER=$REMOTE_OWNER" >> $GITHUB_OUTPUT
echo "REMOTE_REPO=$REMOTE_REPO" >> $GITHUB_OUTPUT
echo "REMOTE_PR_NUMBER=$REMOTE_PR_NUMBER" >> $GITHUB_OUTPUT
echo "FOUND_URL=true" >> $GITHUB_OUTPUT
else
echo "::warning::No GitHub PR URL found in the current PR body."
echo "FOUND_URL=false" >> $GITHUB_OUTPUT
fi
- name: Fetch Remote PR Branch Name
if: steps.remote_pr_info.outputs.FOUND_URL == 'true'
id: remote_pr_branch
env:
GH_TOKEN: ${{ secrets.EXT_TOKEN }}
REMOTE_OWNER: ${{ steps.remote_pr_info.outputs.REMOTE_OWNER }}
REMOTE_REPO: ${{ steps.remote_pr_info.outputs.REMOTE_REPO }}
REMOTE_PR_NUMBER: ${{ steps.remote_pr_info.outputs.REMOTE_PR_NUMBER }}
run: |
if [ -n "$GH_TOKEN" ]; then
echo "Using provided TOKEN."
ACTUAL_GH_TOKEN="$GH_TOKEN"
else
echo "::error::No token available."
exit 1
fi
echo "Fetching branch name for $REMOTE_OWNER/$REMOTE_REPO/pull/$REMOTE_PR_NUMBER"
REMOTE_BRANCH_NAME=$(GH_TOKEN="$ACTUAL_GH_TOKEN" gh pr view "$REMOTE_PR_NUMBER" \
--repo "$REMOTE_OWNER/$REMOTE_REPO" \
--json headRefName --jq .headRefName)
if [ -n "$REMOTE_BRANCH_NAME" ]; then
echo "Remote PR Branch Name: $REMOTE_BRANCH_NAME"
echo "REMOTE_BRANCH_NAME=$REMOTE_BRANCH_NAME" >> $GITHUB_OUTPUT
else
echo "::error::Could not retrieve branch name for remote PR $REMOTE_OWNER/$REMOTE_REPO/pull/$REMOTE_PR_NUMBER. Check PAT permissions or PR validity."
# Optionally exit 1 if this is critical
# exit 1
fi
- name: Output Results
if: steps.remote_pr_info.outputs.FOUND_URL == 'true' && steps.remote_pr_branch.outputs.REMOTE_BRANCH_NAME
run: |
echo "Successfully retrieved branch name from remote PR."
echo "Remote PR URL: ${{ steps.remote_pr_info.outputs.REMOTE_PR_URL }}"
echo "Remote PR Branch Name: ${{ steps.remote_pr_branch.outputs.REMOTE_BRANCH_NAME }}"
# You can now use ${{ steps.remote_pr_branch.outputs.REMOTE_BRANCH_NAME }} in subsequent steps
# For example, create an artifact, comment on PR A, trigger another workflow, etc.
- name: Handle No URL Found
if: steps.remote_pr_info.outputs.FOUND_URL == 'false'
run: |
echo "No remote PR URL was found in the body of PR #${{ github.event.pull_request.number }}."
- name: Handle Branch Not Found
if: steps.remote_pr_info.outputs.FOUND_URL == 'true' && !steps.remote_pr_branch.outputs.REMOTE_BRANCH_NAME
run: |
echo "A remote PR URL was found, but its branch name could not be retrieved."
echo "URL: ${{ steps.remote_pr_info.outputs.REMOTE_PR_URL }}"
- name: Sync
if: steps.remote_pr_info.outputs.FOUND_URL == 'true' && steps.remote_pr_branch.outputs.REMOTE_BRANCH_NAME
uses: AMD-ROCm-Internal/rocprofiler-github-actions@git-sync-v3
with:
source_repo: "https://${{ secrets.TOKEN }}@github.com/AMD-ROCm-Internal/aqlprofile.git"
source_branch: "${{ github.event.pull_request.head.ref }}"
destination_repo: "https://${{ secrets.EXT_TOKEN }}@github.com/ROCm/aqlprofile.git"
destination_branch: "${{ steps.remote_pr_branch.outputs.REMOTE_BRANCH_NAME }}"
+82
مشاهده پرونده
@@ -0,0 +1,82 @@
name: Mirror External PR to Internal Repo
on:
pull_request_target:
types: [opened, synchronize]
branches:
- amd-staging
jobs:
mirror_pr:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name != 'AMD-ROCm-Internal/aqlprofile'
steps:
- name: Checkout PR base
uses: actions/checkout@v4
- name: Setup Git User
run: |
git config --global user.name 'External PR Mirror Bot'
git config --global user.email 'bot@users.noreply.github.com'
- uses: wei/git-sync@v3
name: Push branch to Internal Repository
with:
source_repo: "https://${{ secrets.EXTERNAL_REPO_TOKEN }}@github.com/ROCm/aqlprofile.git"
source_branch: "${{ github.event.pull_request.head.ref }}"
destination_repo: "https://${{ secrets.INTERNAL_REPO_TOKEN }}@github.com/AMD-ROCm-Internal/aqlprofile.git"
destination_branch: "external-pr/${{ github.event.pull_request.number }}"
- name: Create Pull Request in Internal Repository
if: ${{ github.event.action == 'opened' }}
id: create_internal_pr
env:
GH_TOKEN: ${{ secrets.INTERNAL_REPO_TOKEN }}
INTERNAL_REPO: "AMD-ROCm-Internal/aqlprofile"
INTERNAL_BASE_BRANCH: "amd-staging"
HEAD_BRANCH: "external-pr/${{ github.event.pull_request.number }}"
PR_TITLE: "Mirror: ${{ github.event.pull_request.title }} (Ext PR #${{ github.event.pull_request.number }})"
PR_BODY: |
This PR mirrors changes from external pull request: ${{ github.event.pull_request.html_url }}
Original PR Body:
-------------------
${{ github.event.pull_request.body }}
run: |
# Create PR and capture its URL
INTERNAL_PR_URL=$(gh pr create \
--repo "$INTERNAL_REPO" \
--base "$INTERNAL_BASE_BRANCH" \
--head "$HEAD_BRANCH" \
--title "$PR_TITLE" \
--body "$PR_BODY")
if [ -z "$INTERNAL_PR_URL" ]; then
echo "Failed to create internal PR. URL is empty."
# Check if PR already exists (gh pr create might not fail if branch has open PR)
EXISTING_PR_URL=$(gh pr list --repo "$INTERNAL_REPO" --head "$HEAD_BRANCH" --json url -q '.[0].url')
if [ -n "$EXISTING_PR_URL" ]; then
echo "Internal PR already exists: $EXISTING_PR_URL"
echo "INTERNAL_PR_URL=$EXISTING_PR_URL" >> $GITHUB_OUTPUT
else
echo "::error::Failed to create or find existing internal PR."
exit 1
fi
fi
- name: Comment on and Close External PR
if: steps.create_internal_pr.outputs.INTERNAL_PR_URL != ''
env:
GH_TOKEN: ${{ secrets.EXTERNAL_REPO_TOKEN }}
EXTERNAL_PR_NUMBER: ${{ github.event.pull_request.number }}
EXTERNAL_REPO: ${{ github.repository }}
run: |
COMMENT_BODY="This pull request has been mirrored to our internal repository for review and integration. Thank you for your contribution!"
gh pr comment "$EXTERNAL_PR_NUMBER" \
--repo "$EXTERNAL_REPO" \
--body "$COMMENT_BODY"
echo "Commented on external PR #${EXTERNAL_PR_NUMBER}"
+16
مشاهده پرونده
@@ -0,0 +1,16 @@
name: Rocm Validation Suite KWS
on:
push:
branches: [amd-staging]
pull_request:
types: [opened, synchronize, reopened]
branches: [amd-staging]
workflow_dispatch:
jobs:
kws:
if: ${{ github.event_name == 'pull_request' }}
uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/kws.yml@mainline
secrets: inherit
with:
pr_number: ${{github.event.pull_request.number}}
base_branch: ${{github.base_ref}}
@@ -0,0 +1,25 @@
name: ROCm CI Caller
on:
pull_request:
branches: [amd-staging, amd-npi, release/rocm-rel-*]
types: [opened, reopened, synchronize]
push:
branches: [amd-mainline]
workflow_dispatch:
issue_comment:
types: [created]
jobs:
call-workflow:
if: ${{ github.event_name != 'issue_comment' || github.event.comment.body == '!verify' }}
uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/rocm_ci.yml@mainline
secrets: inherit
with:
input_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
input_pr_num: ${{ github.event_name == 'pull_request' && github.event.pull_request.number || 0 }}
input_pr_url: ${{ github.event_name == 'pull_request' && github.event.pull_request.html_url || '' }}
input_pr_title: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || '' }}
repository_name: ${{ github.repository }}
base_ref: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref }}
trigger_event_type: ${{ github.event_name }}
@@ -0,0 +1,17 @@
name: Sync amd-mainline to public repository
on:
push:
branches: [ amd-mainline ]
jobs:
git-mirror:
runs-on: AMD-ROCm-Internal-dev1
steps:
- name: git-sync
uses: AMD-ROCm-Internal/rocprofiler-github-actions@git-sync-v3
with:
source_repo: "https://${{ secrets.TOKEN }}@github.com/AMD-ROCm-Internal/aqlprofile.git"
source_branch: "amd-mainline"
destination_repo: "https://${{ secrets.EXT_TOKEN }}@github.com/ROCm/aqlprofile.git"
destination_branch: "amd-mainline"
+17
مشاهده پرونده
@@ -0,0 +1,17 @@
name: Sync amd-staging to public repository
on:
push:
branches: [ amd-staging ]
jobs:
git-mirror:
runs-on: AMD-ROCm-Internal-dev1
steps:
- name: git-sync
uses: AMD-ROCm-Internal/rocprofiler-github-actions@git-sync-v3
with:
source_repo: "https://${{ secrets.TOKEN }}@github.com/AMD-ROCm-Internal/aqlprofile.git"
source_branch: "amd-staging"
destination_repo: "https://${{ secrets.EXT_TOKEN }}@github.com/ROCm/aqlprofile.git"
destination_branch: "amd-staging"
@@ -0,0 +1,2 @@
build
.cache

برخی از فایل ها نشان داده نشدند زیرا تعداد زیادی فایل در این تفاوت تغییر کرده اند نمایش بیشتر