Skip to content

Commit 64df094

Browse files
Add 'projects/clr/' from commit 'ed903e888949f3631f133847f834b06b817b63b8'
git-subtree-dir: projects/clr git-subtree-mainline: 840ad49 git-subtree-split: ed903e8
2 parents 840ad49 + ed903e8 commit 64df094

File tree

866 files changed

+382948
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

866 files changed

+382948
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
resources:
2+
repositories:
3+
- repository: pipelines_repo
4+
type: github
5+
endpoint: ROCm
6+
name: ROCm/ROCm
7+
- repository: matching_repo
8+
type: github
9+
endpoint: ROCm
10+
name: ROCm/HIP
11+
ref: $(Build.SourceBranch)
12+
- repository: hipother_repo
13+
type: github
14+
endpoint: ROCm
15+
name: ROCm/hipother
16+
ref: $(Build.SourceBranch)
17+
pipelines:
18+
- pipeline: hip_pipeline
19+
source: \HIP
20+
trigger:
21+
branches:
22+
include:
23+
- amd-staging
24+
- amd-mainline
25+
- pipeline: hipother_pipeline
26+
source: \hipother
27+
trigger:
28+
branches:
29+
include:
30+
- amd-staging
31+
- amd-mainline
32+
33+
variables:
34+
- group: common
35+
- template: /.azuredevops/variables-global.yml@pipelines_repo
36+
37+
trigger:
38+
batch: true
39+
branches:
40+
include:
41+
- amd-staging
42+
- amd-mainline
43+
paths:
44+
exclude:
45+
- CODEOWNERS
46+
- LICENCE
47+
- '**/*.md'
48+
49+
pr:
50+
autoCancel: true
51+
branches:
52+
include:
53+
- amd-staging
54+
- amd-mainline
55+
paths:
56+
exclude:
57+
- CODEOWNERS
58+
- LICENCE
59+
- '**/*.md'
60+
drafts: false
61+
62+
jobs:
63+
# if the build reason is a resource trigger, it means trigger is HIP or hipother repo build
64+
# HIP/hipother repo build would have just built runtime, just copy their build products
65+
# this is to ensure clr has latest good package for combined-packaging jobs
66+
# combined-packaging jobs only have to look at clr pipeline for latest runtime
67+
# to remove logic of comparing build products from both clr, hip, hipother triggers
68+
- ${{ if eq(variables['Build.Reason'], 'ResourceTrigger') }}:
69+
- template: ${{ variables.CI_COMPONENT_PATH }}/copyHIP.yml@pipelines_repo
70+
- ${{ if ne(variables['Build.Reason'], 'ResourceTrigger') }}:
71+
- template: ${{ variables.CI_COMPONENT_PATH }}/HIP.yml@pipelines_repo

projects/clr/.clang-format

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Language: Cpp
2+
BasedOnStyle: Google
3+
AlignEscapedNewlinesLeft: false
4+
AlignOperands: false
5+
ColumnLimit: 100
6+
AlwaysBreakTemplateDeclarations: false
7+
DerivePointerAlignment: false
8+
IndentFunctionDeclarationAfterType: false
9+
MaxEmptyLinesToKeep: 2
10+
SortIncludes: false

projects/clr/.gitattributes

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Set the default behavior, in case people don't have core.autolf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to have LF line endings on checkout.
6+
*.c text eol=lf
7+
*.cpp text eol=lf
8+
*.cc text eol=lf
9+
*.h text eol=lf
10+
*.hpp text eol=lf
11+
*.txt text eol=lf
12+
13+
# Define files to support auto-remove trailing white space
14+
# Need to run the command below, before add modified file(s) to the staging area
15+
# git config filter.trimspace.clean 'sed -e "s/[[:space:]]*$//g"'
16+
*.cpp filter=trimspace
17+
*.c filter=trimspace
18+
*.h filter=trimspacecpp
19+
*.hpp filter=trimspace
20+
*.md filter=trimspace
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
RANGE=""
6+
7+
while [[ $# -gt 0 ]]; do
8+
echo $1
9+
echo $2
10+
case "$1" in
11+
--range)
12+
RANGE="$2"
13+
shift 2
14+
;;
15+
*)
16+
echo "Unknown arg $1" >&2
17+
exit 64
18+
;;
19+
esac
20+
done
21+
22+
regex='\.(c|cc|cpp|cxx|h|hh|hpp|hxx)$'
23+
24+
if [[ -n $RANGE ]]; then
25+
files=$(git diff --name-only "$RANGE" | grep -E "$regex" || true)
26+
else
27+
files=$(git diff --cached --name-only --diff-filter=ACMR | grep -E "$regex" || true)
28+
fi
29+
echo "Checking $files"
30+
[[ -z $files ]] && exit 0
31+
32+
clang_bin="${CLANG_FORMAT:-clang-format}"
33+
if ! command -v "$clang_bin" >/dev/null 2>&1; then
34+
if [[ -x "/c/Program Files/LLVM/bin/clang-format.exe" ]]; then
35+
clang_bin="/c/Program Files/LLVM/bin/clang-format.exe"
36+
fi
37+
fi
38+
39+
clang_format_diff="${CLANG_FORMAT_DIFF:-clang-format-diff}"
40+
if ! command -v "$clang_format_diff" >/dev/null 2>&1; then
41+
if [[ -x "/c/Program Files/LLVM/share/clang/clang-format-diff.py" ]]; then
42+
clang_format_diff="/c/Program Files/LLVM/share/clang/clang-format-diff.py"
43+
fi
44+
fi
45+
46+
for file in $files; do
47+
echo "Checking lines of $file"
48+
49+
if [[ -n $RANGE ]]; then
50+
diff_output=$(git diff -U0 "$RANGE" -- "$file")
51+
else
52+
diff_output=$(git diff -U0 --cached -- "$file")
53+
fi
54+
55+
echo "$diff_output" | "$clang_format_diff" -style=file -fallback-style=none -p1
56+
done
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
exec "$(git rev-parse --show-toplevel)/.github/hooks/clang-format-check.sh"

projects/clr/.github/palamida.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
disabled: false
2+
scmId: gh-emu-rocm
3+
branchesToScan:
4+
- amd-staging
5+
- amd-mainline
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Associated JIRA ticket number/Github issue number
2+
<!-- For example: "Closes #1234" or "Fixes SWDEV-123456" -->
3+
4+
## What type of PR is this? (check all applicable)
5+
6+
- [ ] Refactor
7+
- [ ] Feature
8+
- [ ] Bug Fix
9+
- [ ] Optimization
10+
- [ ] Documentation Update
11+
- [ ] Continuous Integration
12+
13+
## What were the changes?
14+
15+
<!-- Please give a short summary of the change. -->
16+
17+
## Why are these changes needed?
18+
19+
<!-- Please explain the motivation behind the change and why this solves the given problem. -->
20+
21+
## Updated CHANGELOG?
22+
23+
<!-- Needed for Release updates for a ROCm release. -->
24+
25+
- [ ] Yes
26+
- [ ] No, Does not apply to this PR.
27+
28+
## Added/Updated documentation?
29+
30+
- [ ] Yes
31+
- [ ] No, Does not apply to this PR.
32+
33+
## Additional Checks
34+
35+
- [ ] I have added tests relevant to the introduced functionality, and the unit tests are passing locally.
36+
- [ ] Any dependent changes have been merged.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import os, re, sys
2+
from typing import List, Optional
3+
4+
5+
def is_checkbox(line: str) -> bool:
6+
return bool(re.match(r"^\s*-\s*\[[ xX]\]\s*.+", line))
7+
8+
9+
def is_checked(line: str) -> bool:
10+
return bool(re.match(r"^\s*-\s*\[\s*[xX]\s*\]\s*.+", line))
11+
12+
13+
def is_comment(line: str) -> bool:
14+
return bool(re.match(r"^\s*<!--.*-->\s*$", line))
15+
16+
17+
def text_clean(lines: List[str]) -> str:
18+
text = [line for line in lines if not is_comment(line)]
19+
return "".join("".join(text).strip().split())
20+
21+
22+
def validate_section(section_name: str, lines: List[str]) -> Optional[str]:
23+
has_checkboxes = any(is_checkbox(line) for line in lines)
24+
if has_checkboxes:
25+
if not any(is_checked(line) for line in lines):
26+
return f"Section {section_name} is a checklist without selections"
27+
return None
28+
if not text_clean(lines):
29+
return f"Section {section_name} is empty text section"
30+
return None
31+
32+
33+
def check_description(description: str) -> List[str]:
34+
if not description:
35+
# pull_request_template is not merged yet, so treat as valid for now
36+
return []
37+
# return ["PR description is empty"]
38+
39+
sections = []
40+
current_section = None
41+
current_lines = []
42+
errors = []
43+
44+
for line in description.splitlines():
45+
header_match = re.match(r"^\s*##\s*(.+?)\s*$", line)
46+
if header_match:
47+
if current_section:
48+
sections.append((current_section, current_lines))
49+
current_section = header_match.group(1)
50+
current_lines = []
51+
elif current_section:
52+
current_lines.append(line)
53+
54+
if current_section:
55+
sections.append((current_section, current_lines))
56+
57+
if not sections:
58+
return ["No sections available, template is empty"]
59+
60+
for section_name, section_lines in sections:
61+
error = validate_section(section_name, section_lines)
62+
if error:
63+
errors.append(error)
64+
65+
return errors
66+
67+
68+
if __name__ == "__main__":
69+
pr_description = os.getenv("PR_DESCRIPTION", "")
70+
71+
errors = check_description(pr_description)
72+
if not errors:
73+
print("All good")
74+
exit(0)
75+
print("\n".join(errors))
76+
exit(1)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: AI CodeQL Fix
2+
3+
on:
4+
schedule:
5+
- cron: '15 12 * * *'
6+
7+
jobs:
8+
call_codeql_reusable_workflow:
9+
uses: AMD-GH-Actions/ai-pr-platform-actions-lib/.github/workflows/reusable_codeql.yml@main
10+
with:
11+
team_name: rocm_clr
12+
alerts: ''
13+
from_date: ''
14+
to_date: ''
15+
filter_by_rules: ''
16+
trigger_event: ${{ github.event_name }}
17+
secrets:
18+
gh_token: ${{ secrets.AI_GH_TOKEN }}
19+
codeql_token: ${{ secrets.AI_CODEQL_API_KEY }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: AI CodeQL Fix - historical
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
alerts:
7+
required: false
8+
type: string
9+
description: 'ℹ️Use either alert IDs or Start/End date!⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Alert IDs (comma-separated values and/or list e.g. 1152, 1122-1124)'
10+
from_date:
11+
required: false
12+
type: string
13+
description: 'Start date (use YYYY-MM-DD format)'
14+
to_date:
15+
required: false
16+
type: string
17+
description: 'End date (use YYYY-MM-DD format) ⠀⠀⠀ ⚠️Must be within 15 days of Start date!'
18+
filter_by_rules:
19+
required: false
20+
type: string
21+
description: 'Filter by Rule IDs ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⚠️Overrides team-configured rules⠀⠀⠀⠀ https://amd.atlassian.net/wiki/x/tSrkNg'
22+
23+
jobs:
24+
call_codeql_reusable_workflow:
25+
uses: AMD-GH-Actions/ai-pr-platform-actions-lib/.github/workflows/reusable_codeql.yml@main
26+
with:
27+
team_name: rocm_clr
28+
alerts: ${{ inputs.alerts }}
29+
from_date: ${{ inputs.from_date }}
30+
to_date: ${{ inputs.to_date }}
31+
filter_by_rules: ${{ inputs.filter_by_rules }}
32+
trigger_event: ${{ github.event_name }}
33+
secrets:
34+
gh_token: ${{ secrets.AI_GH_TOKEN }}
35+
codeql_token: ${{ secrets.AI_CODEQL_API_KEY }}
36+

0 commit comments

Comments
 (0)