Skip to content

Commit

Permalink
Merge branch 'main' into ajakovljevic/constant_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ajakovljevicTT committed Dec 3, 2024
2 parents 57364dc + 0640c7c commit 1736871
Show file tree
Hide file tree
Showing 159 changed files with 6,959 additions and 1,397 deletions.
6 changes: 5 additions & 1 deletion .github/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ RUN apt-get update && apt-get install -y \
graphviz \
patchelf \
libyaml-cpp-dev \
libboost-all-dev
libboost-all-dev \
curl \
jq \
sudo \
gh

# Install clang 17
RUN wget https://apt.llvm.org/llvm.sh && \
Expand Down
105 changes: 73 additions & 32 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ jobs:
fail-fast: false
matrix:
build: [
{runs-on: ubuntu-latest, enable_perf: OFF, name: "run", ttrt_flags: ""},
{runs-on: ubuntu-latest, enable_perf: ON, name: "perf", ttrt_flags: ""},
{runs-on: ubuntu-latest, enable_perf: OFF, enable_op_model: OFF, name: "run", ttrt_flags: ""},
{runs-on: ubuntu-latest, enable_perf: ON, enable_op_model: OFF, name: "perf", ttrt_flags: ""},
{runs-on: ubuntu-latest, enable_perf: OFF, enable_op_model: ON, name: "op_model" , ttrt_flags: ""}
]

name: Build tt-mlir
Expand All @@ -66,19 +67,30 @@ jobs:
- name: Set reusable strings
id: strings
shell: bash
env:
job-name: "Build tt-mlir (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_op_model }}, ${{ matrix.build.name }})"
run: |
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
echo "install-output-dir=$(pwd)/install" >> "$GITHUB_OUTPUT"
# Github job context unfortunately doesn't contain job_id, this is the workaround how to fetch it using GH API
echo "Expected job name: ${{ env.job-name }}"
JOB_ID=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs" | \
jq -r '.jobs[] | select(.name | contains("${{ env.job-name }}")) | .id ')
echo "Current job id: $JOB_ID"
echo "job-id=$JOB_ID" >> "$GITHUB_OUTPUT"
echo "test_report_path=report_$JOB_ID.xml" >> "$GITHUB_OUTPUT"
- name: Git safe dir
run: git config --global --add safe.directory ${{ steps.strings.outputs.work-dir }}

- name: ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: true
key: ${{ matrix.build.runs-on }}-run-ON-perf-${{ matrix.build.enable_perf }}-${{ env.SDK_VERSION }}
key: ${{ matrix.build.runs-on }}-run-ON-perf-${{ matrix.build.enable_perf }}-op_model-${{ matrix.build.enable_op_model }}-${{ env.SDK_VERSION }}

# Build project

Expand All @@ -97,6 +109,7 @@ jobs:
-DTTMLIR_ENABLE_RUNTIME_TESTS=ON \
-DTT_RUNTIME_ENABLE_PERF_TRACE=${{ matrix.build.enable_perf }} \
-DTTMLIR_ENABLE_STABLEHLO=ON \
-DTTMLIR_ENABLE_OP_MODEL=${{ matrix.build.enable_op_model }} \
-S ${{ steps.strings.outputs.work-dir }}
- name: Build
Expand Down Expand Up @@ -143,18 +156,19 @@ jobs:
run: |
source env/activate
cmake --build ${{ steps.strings.outputs.build-output-dir }} -- check-ttmlir
cp build/test/report.xml ${{ steps.strings.outputs.test_report_path }}
- name: Upload Test Report
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.build.runs-on }}-perf-${{ matrix.build.enable_perf }}
path: build/test/report.xml
name: test-reports-${{ matrix.build.runs-on }}-perf-${{ matrix.build.enable_perf }}-op_model-${{ matrix.build.enable_op_model }}
path: ${{ steps.strings.outputs.test_report_path }}

- name: Show Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
report_paths: build/test/report.xml
report_paths: ${{ steps.strings.outputs.test_report_path }}
check_name: MLIR Tests

# Build and upload ttrt
Expand Down Expand Up @@ -214,6 +228,7 @@ jobs:
{runs-on: n300, enable_perf: OFF, name: "run", ttrt_flags: "--non-zero"},
{runs-on: n300, enable_perf: ON, name: "perf"},
]
name: "run-tests (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.name }})"

runs-on:
- in-service
Expand All @@ -237,11 +252,23 @@ jobs:
- name: Set reusable strings
id: strings
shell: bash
env:
job-name: "run-tests (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.name }})"
run: |
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
echo "install-output-dir=$(pwd)/install" >> "$GITHUB_OUTPUT"
# Github job context unfortunately doesn't contain job_id, this is the workaround how to fetch it using GH API
echo "Expected job name: ${{ env.job-name }}"
JOB_ID=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs" | \
jq -r '.jobs[] | select(.name | contains("${{ env.job-name }}")) | .id ')
echo "Current job id: $JOB_ID"
echo "job-id=$JOB_ID" >> "$GITHUB_OUTPUT"
echo "test_report_path=report_$JOB_ID.xml" >> "$GITHUB_OUTPUT"
- name: Git safe dir
run: git config --global --add safe.directory ${{ steps.strings.outputs.work-dir }}

Expand Down Expand Up @@ -303,19 +330,27 @@ jobs:
run: |
source env/activate
ttrt ${{ matrix.build.name }} ${{ matrix.build.ttrt_flags }} ${{ steps.strings.outputs.build-output-dir }}/test/ttmlir/Silicon/TTNN/perf_unit
cp ttrt_report.xml ${{ steps.strings.outputs.test_report_path }}
- name: Upload ttrt test report
- name: Upload ttrt test report json
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.build.runs-on }}_${{ matrix.build.name }}_results.json
path: ${{ matrix.build.name }}_results.json

- name: Upload Test Report xml
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-reports-${{ matrix.build.runs-on }}-${{ matrix.test_group_id }}
path: ${{ steps.strings.outputs.test_report_path }}

- name: Show Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
report_paths: ttrt_report.xml
report_paths: ${{ steps.strings.outputs.test_report_path }}
check_name: TTRT ${{ matrix.build.runs-on }} ${{ matrix.build.name }} Tests

run-ttrt-tests:
Expand Down Expand Up @@ -346,18 +381,30 @@ jobs:
- /opt/tt_metal_infra/provisioning/provisioning_env:/opt/tt_metal_infra/provisioning/provisioning_env

steps:

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set reusable strings
id: strings
shell: bash
env:
job-name: "${{ github.job }} (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.name }})"
run: |
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
echo "install-output-dir=$(pwd)/install" >> "$GITHUB_OUTPUT"
# Github job context unfortunately doesn't contain job_id, this is the workaround how to fetch it using GH API
echo "Expected job name: ${{ env.job-name }}"
JOB_ID=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs" | \
jq -r '.jobs[] | select(.name | contains("${{ env.job-name }}")) | .id ')
echo "Current job id: $JOB_ID"
echo "job-id=$JOB_ID" >> "$GITHUB_OUTPUT"
echo "test_report_path=report_$JOB_ID.xml" >> "$GITHUB_OUTPUT"
- name: Git safe dir
run: git config --global --add safe.directory ${{ steps.strings.outputs.work-dir }}

Expand Down Expand Up @@ -411,31 +458,22 @@ jobs:
shell: bash
run: |
source env/activate
pytest -ssv runtime/tools/python/test/test_read.py
- name: ttrt query tests
shell: bash
run: |
source env/activate
pytest -ssv runtime/tools/python/test/test_query.py
- name: ttrt check tests
shell: bash
run: |
source env/activate
pytest -ssv runtime/tools/python/test/test_check.py
pytest -ssv runtime/tools/python/test \
--junit-xml=${{ steps.strings.outputs.test_report_path }}
- name: ttrt run tests
shell: bash
run: |
source env/activate
pytest -ssv runtime/tools/python/test/test_run.py
- name: Upload Test Report
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-reports-${{ matrix.build.runs-on }}-${{ matrix.build.name }}
path: ${{ steps.strings.outputs.test_report_path }}

- name: ttrt perf tests
shell: bash
run: |
source env/activate
pytest -ssv runtime/tools/python/test/test_perf.py
- name: Show Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
report_paths: ${{ steps.strings.outputs.test_report_path }}
check_name: Run ttrt tests

build-and-test-explorer:
needs: build-image
Expand Down Expand Up @@ -472,6 +510,7 @@ jobs:
run: |
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
echo "install-output-dir=$(pwd)/install" >> "$GITHUB_OUTPUT"
- name: Git safe dir
run: git config --global --add safe.directory ${{ steps.strings.outputs.work-dir }}
Expand All @@ -480,7 +519,7 @@ jobs:
uses: hendrikmuhs/[email protected]
with:
create-symlink: true
key: ${{ matrix.build.runs-on }}-run-ON-perf-${{ matrix.build.enable_perf }}-${{ env.SDK_VERSION }}
key: ${{ matrix.build.runs-on }}-run-ON-perf-${{ matrix.build.enable_perf }}-op_model-${{ matrix.build.enable_op_model }}-${{ env.SDK_VERSION }}

- name: Configure CMake
shell: bash
Expand All @@ -496,6 +535,7 @@ jobs:
-DTTMLIR_ENABLE_RUNTIME_TESTS=OFF \
-DTT_RUNTIME_ENABLE_PERF_TRACE=${{ matrix.build.enable_perf }} \
-DTTMLIR_ENABLE_STABLEHLO=OFF \
-DTTMLIR_ENABLE_OP_MODEL=${{ matrix.build.enable_op_model }} \
-S ${{ steps.strings.outputs.work-dir }}
- name: Build tt-explorer
Expand All @@ -509,3 +549,4 @@ jobs:
run: |
source env/activate
pytest tools/explorer/test/run_tests.py
# collect results
99 changes: 88 additions & 11 deletions .github/workflows/issue-last-updated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
echo "project_id=PVT_kwDOA9MHEM4AjeTl" >> $GITHUB_ENV
echo "field_id=PVTF_lADOA9MHEM4AjeTlzgiiU18" >> $GITHUB_ENV
- name: Get Issue ID
id: get_issue_id
run: |
Expand All @@ -31,18 +32,94 @@ jobs:
- name: Get Item ID for Issue
id: get_item_by_issue_id
id: get_item_id_by_issue_id
run: |
ITEM_ID=$(curl -X POST -H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "query($projectId: ID!) { node(id: $projectId) { ... on ProjectV2 { items(first: 100) { nodes { id content { ... on Issue { id } } } } } } }",
"variables": {
"projectId": "'"${{ env.project_id }}"'"
}
}' \
https://api.github.com/graphql | jq -r '.data.node.items.nodes[] | select(.content.id=="'"${{ env.issue_id }}"'") | .id')
echo "ITEM_ID=$ITEM_ID" >> $GITHUB_ENV
# Initialize variables
CURSOR=null
ITEM_ID=""
# Define the GraphQL query as a string
QUERY='query($projectId: ID!, $cursor: String) {
node(id: $projectId) {
... on ProjectV2 {
items(first: 100, after: $cursor) {
nodes {
id
content {
... on Issue {
id
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
}'
while : ; do
# Construct JSON payload using jq for proper formatting
JSON_PAYLOAD=$(jq -n \
--arg query "$QUERY" \
--arg projectId "${{ env.project_id }}" \
--arg cursor "$CURSOR" \
'{ query: $query, variables: { projectId: $projectId, cursor: $cursor }}')
# Make the GraphQL request
RESPONSE=$(curl -s -X POST -H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD" \
https://api.github.com/graphql)
# Debug: print entire response
echo "RESPONSE: $RESPONSE"
# Check if the response contains `items` data
ITEMS_DATA=$(echo "$RESPONSE" | jq -r '.data.node.items.nodes' 2>/dev/null)
if [[ "$ITEMS_DATA" == "null" ]]; then
echo "Error: Items data not found. Please check your PROJECT_ID and GITHUB_TOKEN permissions."
break
fi
# Parse the item ID if it matches the issue_id
ITEM_ID=$(echo "$RESPONSE" | jq -r --arg issue_id "$issue_id" \
'.data.node.items.nodes[] | select(.content.id==$issue_id) | .id')
# If ITEM_ID is found, output it and stop the loop
if [[ -n "$ITEM_ID" && "$ITEM_ID" != "null" ]]; then
echo "Found ITEM_ID: $ITEM_ID"
echo "ITEM_ID=$ITEM_ID" >> $GITHUB_ENV # Save ITEM_ID to environment for future steps
break
fi
# Extract pagination information
HAS_NEXT_PAGE=$(echo "$RESPONSE" | jq -r '.data.node.items.pageInfo.hasNextPage')
CURSOR=$(echo "$RESPONSE" | jq -r '.data.node.items.pageInfo.endCursor')
# If no more pages, exit loop
if [[ "$HAS_NEXT_PAGE" != "true" ]]; then
echo "Issue not found in project items."
break
fi
done
- name: Use Found ITEM_ID
if: env.ITEM_ID # Only runs if ITEM_ID was set
run: echo "The ITEM_ID is ${{ env.ITEM_ID }}"


- name: Update Project Field
run: |
Expand Down
Loading

0 comments on commit 1736871

Please sign in to comment.