Skip to content

Commit

Permalink
Update ILP_solution.py
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Dec 2, 2023
1 parent 4fb5b07 commit b0f195e
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 118 deletions.
254 changes: 140 additions & 114 deletions .github/workflows/buildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ on:
types: [assigned, opened, synchronize, reopened]
workflow_dispatch:

defaults:
run:
# This is already the default, except when running inside another Docker
# image, which is the case here. So set it up globally to avoid
# repeating elsewhere.
shell: bash

env:
# Run apt package manager in the CI in non-interactive mode.
# Otherwise, on Ubuntu 20.04 the installation of tzdata asking question
Expand Down Expand Up @@ -53,11 +46,8 @@ jobs:
run: |
pip install cmake numpy psutil pybind11 rich pkginfo lit PyYAML
- name: Install Ninja
run: sudo apt-get install -y ninja-build

- name: Install lld and clang (for aiecc)
run: sudo apt-get install -y clang lld
- name: Install packages
run: sudo apt-get install -y ninja-build clang lld

- name: Get MLIR
id: mlir-wheels
Expand All @@ -68,7 +58,6 @@ jobs:
echo "MLIR_DIR=$PWD/mlir" | tee -a $GITHUB_OUTPUT
- name: Ccache for C++ compilation
# https://github.com/hendrikmuhs/ccache-action/releases/tag/v1.2.9
uses: hendrikmuhs/ccache-action@ca3acd2731eef11f1572ccb126356c2f9298d35e
with:
# Since there are now several compilation jobs running in parallel,
Expand Down Expand Up @@ -139,7 +128,9 @@ jobs:
ninja check-tutorials
ninja check-reference-designs
clang-tidy:
clang-tidy-pylint:

name: Python and C/C++ Lint

runs-on: ubuntu-22.04

Expand Down Expand Up @@ -205,7 +196,6 @@ jobs:
run: |
git fetch origin main
git diff -U0 origin/main | clang-tidy-diff -p1 -path build -export-fixes fixes.yml
cat fixes.yml
- name: Post clang-tidy requests
env:
Expand All @@ -214,17 +204,149 @@ jobs:
PULL_REQUEST_ID="$(jq "if (.issue.number != null) then .issue.number else .number end" < "$GITHUB_EVENT_PATH")"
echo $PULL_REQUEST_ID
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python utils/git/clang-tidy-pr.py \
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python utils/git/clang_tidy_pr.py \
--clang-tidy-fixes fixes.yml \
--pull-request-id "$PULL_REQUEST_ID" \
--repository "$GITHUB_REPOSITORY" \
--repository-root "$PWD" \
--request-changes "false" \
--suggestions-per-comment 10
# You can feed the pylintrc path to ciborow/action-pylint
# but it doesn't seem to work.
- name: Copy pylintrcs
run: |
cp .pylintrc python/.pylintrc
cp .pylintrc test/python/.pylintrc
cp .pylintrc tutorials/.pylintrc
cp .pylintrc reference_designs/.pylintrc
cp .pylintrc utils/.pylintrc
# You can just do this wholesale at the root (not use workdir)
# but it'll take too long because it picks up
# the stuff in the build directory.
- uses: dciborow/[email protected]
env:
PYTHONPATH: build/python
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
# GitHub Status Check won't become failure with warning.
level: warning
filter_mode: diff_context
workdir: python
glob_pattern: "**/*.py"

- uses: dciborow/[email protected]
env:
PYTHONPATH: build/python
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
level: warning
filter_mode: diff_context
workdir: test/python
glob_pattern: "**/*.py"

- uses: dciborow/[email protected]
env:
PYTHONPATH: build/python
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
level: warning
filter_mode: diff_context
workdir: tutorials
glob_pattern: "**/*.py"

- uses: dciborow/[email protected]
env:
PYTHONPATH: build/python
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
level: warning
filter_mode: diff_context
workdir: reference_designs
glob_pattern: "**/*.py"

- uses: dciborow/[email protected]
env:
PYTHONPATH: build/python
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
level: warning
filter_mode: diff_context
workdir: utils
glob_pattern: "**/*.py"

formatting:

name: Python and C/C++ Formatting

runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- name: Get the project repository
uses: actions/checkout@v3
with:
fetch-depth: 2
submodules: "true"

- name: Install clang-format
uses: aminya/setup-cpp@v1
with:
clangformat: 17.0.1

- name: Setup Python env
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install black
run: pip install black[jupyter]

- name: Run git-clang-format
id: git-clang-format
run: |
git fetch origin main
# git clang-format returns an error if changes made?
git clang-format origin/main || true
- name: Check C/C++ format
uses: reviewdog/action-suggester@v1
with:
tool_name: clang-format
level: error
fail_on_error: true
cleanup: true

- name: Run black format
if: success() || failure()
id: black-format
run: |
# FORMATTED=0
black --exclude python/compiler/aiecc/main.py . || true
black -l 10000 python/compiler/aiecc/main.py || true
# FORMATTED=$(git status -s -uno | wc -l | xargs)
# echo "FORMATTED=$FORMATTED" | tee -a $GITHUB_OUTPUT
- name: Check Python format
if: success() || failure()
uses: reviewdog/action-suggester@v1
with:
tool_name: black
level: error
fail_on_error: true

code-coverage:

name: Code Coverage
name: C/C++ test code coverage

runs-on: ubuntu-latest

Expand All @@ -248,10 +370,7 @@ jobs:
pip install cmake numpy psutil pybind11 rich lit
- name: Install Ninja
run: sudo apt-get install -y ninja-build

- name: Install llvm-cov
run: sudo apt-get install -y clang lld llvm
run: sudo apt-get install -y ninja-build clang lld llvm

- name: Get changed files
id: changed-files
Expand All @@ -269,7 +388,6 @@ jobs:
- name: Ccache for C++ compilation
if: steps.changed-files.outputs.changed-files != ''
# https://github.com/hendrikmuhs/ccache-action/releases/tag/v1.2.9
uses: hendrikmuhs/ccache-action@ca3acd2731eef11f1572ccb126356c2f9298d35e
with:
key: ${{ runner.os }}-${{ matrix.ubuntu_version }}-${{ steps.get-llvm-commit-hash.outputs.hash }}-code-cov
Expand Down Expand Up @@ -335,95 +453,3 @@ jobs:
body-path: /home/runner/work/mlir-aie/mlir-aie/build_release/report/index.html
edit-mode: replace

CppFormatting:

runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- name: Get the project repository
uses: actions/checkout@v3
with:
fetch-depth: 2
submodules: "true"

- name: Install clang-format
uses: aminya/setup-cpp@v1
with:
clangformat: 17.0.1

- name: Setup Python env
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Run git-clang-format
id: git-clang-format
run: |
git fetch origin main
FORMATTED=0
git clang-format origin/main || FORMATTED=$?
echo "FORMATTED=$FORMATTED" | tee -a $GITHUB_OUTPUT
- name: Annotate diff changes using reviewdog
if: steps.git-clang-format.outputs.FORMATTED != '0'
uses: reviewdog/action-suggester@v1
with:
tool_name: clang-format

- name: Fail
if: steps.git-clang-format.outputs.FORMATTED != '0'
run: |
exit 1
PythonFormatting:

runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- name: Get the project repository
uses: actions/checkout@v3
with:
fetch-depth: 2
submodules: "true"

- name: Install clang-format
uses: aminya/setup-cpp@v1
with:
clangformat: 17.0.1

- name: Setup Python env
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install black
run: pip install black

- name: Run black format
id: black-format
run: |
FORMATTED=0
black . || FORMATTED=$?
FORMATTED=$($FORMATTED || git status -s -uno | wc -l | xargs)
echo "FORMATTED=$FORMATTED" | tee -a $GITHUB_OUTPUT
git diff
- name: Annotate diff changes using reviewdog
if: steps.black-format.outputs.FORMATTED != '0'
uses: reviewdog/action-suggester@v1
with:
tool_name: black

- name: Fail
if: steps.black-format.outputs.FORMATTED != '0'
run: |
exit 1
58 changes: 58 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[MAIN]

py-version=3.9

[BASIC]

argument-naming-style=snake_case
attr-naming-style=snake_case
bad-names=foo,
bar,
baz,
toto,
tutu,
tata

class-attribute-naming-style=snake_case
class-const-naming-style=UPPER_CASE
class-naming-style=PascalCase
const-naming-style=UPPER_CASE
docstring-min-length=-1
function-naming-style=snake_case
include-naming-hint=yes
inlinevar-naming-style=snake_case
method-naming-style=snake_case
module-naming-style=snake_case
variable-naming-style=snake_case

[CLASSES]

valid-classmethod-first-arg=cls
valid-metaclass-classmethod-first-arg=mcs

[IMPORTS]

allow-wildcard-with-all=no

[SIMILARITIES]

# Minimum lines number of a similarity.
min-similarity-lines=4

[STRING]

# This flag controls whether inconsistent-quotes generates a warning when the
# character used as a quote delimiter is used inconsistently within a module.
check-quote-consistency=yes

# This flag controls whether the implicit-str-concat should generate a warning
# on implicit string concatenation in sequences defined over several lines.
check-str-concat-over-line-jumps=yes

[MESSAGES CONTROL]

# C0116: Missing function or method docstring (missing-function-docstring)
# C0114: Missing module docstring (missing-module-docstring)
# E0402: Attempted relative import beyond top-level package (relative-beyond-top-level)
# C0115: Missing class docstring (missing-class-docstring)
disable=C0116,C0114,E0402,C0115
Loading

0 comments on commit b0f195e

Please sign in to comment.