Skip to content

Commit d76041b

Browse files
Add 'projects/hip/' from commit 'e74b05a7bd9454b97dc04d7cc4b66d1fe6c534a7'
git-subtree-dir: projects/hip git-subtree-mainline: 64df094 git-subtree-split: e74b05a
2 parents 64df094 + e74b05a commit d76041b

File tree

231 files changed

+63214
-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.

231 files changed

+63214
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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/clr
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: rocr-runtime_pipeline
19+
source: \ROCR-Runtime
20+
trigger:
21+
branches:
22+
include:
23+
- amd-staging
24+
- amd-mainline
25+
- pipeline: rocprofiler-register_pipeline
26+
source: \rocprofiler-register
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+
- docs
46+
- '.github'
47+
- '.jenkins'
48+
- '.*.yaml'
49+
- CODEOWNERS
50+
- Jenkinsfile
51+
- LICENSE.txt
52+
- '**/*.md'
53+
- VERSION
54+
55+
pr:
56+
autoCancel: true
57+
branches:
58+
include:
59+
- amd-staging
60+
- amd-mainline
61+
paths:
62+
exclude:
63+
- docs
64+
- '.github'
65+
- '.jenkins'
66+
- '.*.yaml'
67+
- CODEOWNERS
68+
- Jenkinsfile
69+
- LICENSE.txt
70+
- '**/.md'
71+
- VERSION
72+
drafts: false
73+
74+
jobs:
75+
- template: ${{ variables.CI_COMPONENT_PATH }}/HIP.yml@pipelines_repo

projects/hip/.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/hip/.gitattributes

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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
21+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip" # See documentation for possible values
9+
directory: "/docs/sphinx" # Location of package manifests
10+
open-pull-requests-limit: 10
11+
schedule:
12+
interval: "daily"
13+
labels:
14+
- "documentation"
15+
- "dependencies"
16+
- "ci:docs-only"
17+
target-branch: "docs/develop"
18+
reviewers:
19+
- "samjwu"
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/hip/.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*\[[xX]\]\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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Clang format check
2+
on:
3+
pull_request:
4+
types: [synchronize, opened]
5+
6+
jobs:
7+
format:
8+
runs-on: AMD-ROCm-Internal-dev1
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
14+
- name: Install clang-format
15+
run: |
16+
sudo apt update && sudo apt install -y clang-format
17+
18+
- name: Run clang-format-check
19+
id: clang-format
20+
run: |
21+
chmod +x .github/hooks/clang-format-check.sh
22+
./.github/hooks/clang-format-check.sh --range "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"

0 commit comments

Comments
 (0)