Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ml for synthesis prototype - Refactoring #260

Merged
merged 31 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
513ecd0
Bump stackage snapshot (for ghc-9.2.8 compatible with latest hls-powe…
ryukzak Dec 28, 2023
7fec9b2
Improve CLI documentation.
ryukzak Dec 28, 2023
6117beb
Web/UI safe upgrades
ryukzak Dec 28, 2023
3f66495
Refactoring haskell code
ryukzak Dec 28, 2023
44f471f
Bump tensorflow and add macos specific dependencies for ml.
ryukzak Dec 29, 2023
71a01cb
Add scores in popover in subforest table.
ryukzak Dec 30, 2023
de72eb9
Rework CI and add Makefile
ryukzak Dec 29, 2023
f0b91ab
Update root README file: add Makefile info, add ML setup comments.
ryukzak Jan 5, 2024
fdd7ae6
Bump node version in docker container for dev deps.
ryukzak Jan 5, 2024
69aef37
Refactoring. Move type helpers to *.Types modules.
ryukzak Jan 5, 2024
174ad21
Fix CI/Makefile conflict
ryukzak Jan 5, 2024
0636193
Add linux specific deps for tensorflow. Bump py deps.
ryukzak Jan 5, 2024
3945599
Fix Makefile: build-prod, ML_MODEL search. Add docker-dev-{build,run}
ryukzak Jan 6, 2024
f85e126
Update README.md
ryukzak Jan 6, 2024
3601755
Update README.md
ryukzak Jan 6, 2024
aeb2c04
Update TENSORFLOW_VER in dev image
ryukzak Jan 6, 2024
f0941f3
Update ml/synthesis/src/components/data_crawling/nitta/nitta_running.py
ryukzak Jan 6, 2024
c2d1de1
Add tensorflow/poetry configuration source
ryukzak Jan 6, 2024
f268fb1
Apply suggestions and small refactoring from Ilya Burakov <speedwatso…
ryukzak Jan 7, 2024
a93a304
Extend Makefile to support all docker-dev-image related targets.
ryukzak Jan 7, 2024
83c68ab
Fix formatting.
ryukzak Jan 7, 2024
ecd35f9
Remove .stack-work cache (weeder find removed files in cache and fail)
ryukzak Jan 7, 2024
b2135a6
Clarify/update comments about TENSORFLOW_VER
iburakov Jan 7, 2024
8e976f5
Fix the tf deps in pyproject.toml for native (cpu-only) Windows
iburakov Jan 7, 2024
6d73b06
Sync the poetry.lock
iburakov Jan 7, 2024
5cd88ac
Merge pull request #261 from ryukzak/ml-for-synthesis-prototype-wip-t…
ryukzak Jan 7, 2024
47c7497
Fix Makefile: shell interaction for docker-build
ryukzak Jan 7, 2024
8a421b5
Improve Makefile:ml-clean
ryukzak Jan 7, 2024
ffa9302
Refactoring: store envvar name in EnvVarNames
ryukzak Jan 7, 2024
64edcc4
Fix Makefile: shell interaction for docker-build (part 2)
iburakov Jan 8, 2024
8306454
Fix formatting
iburakov Jan 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
249 changes: 167 additions & 82 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,29 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Cache haskell-stack
uses: actions/cache@v3.2.5
- uses: actions/cache@v3
name: Cache ~/.stack
id: cache
with:
path: |
~/.stack
.stack-work
/home/runner/.local/bin
key: ${{ runner.os }}-haskell-stack-${{ hashFiles('**/stack.yaml', '**/package.yaml') }}
path: ~/.stack
key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-
lookup-only: true

- name: Install haskell-stack
uses: haskell/actions/setup@v2.4.3
if: steps.cache.outputs.cache-hit != 'true'
uses: haskell-actions/setup@v2
with:
enable-stack: true
stack-no-global: true
stack-version: "latest"
stack-no-global: true

- name: Build nitta backend dependencies and doctest
- name: Install nitta and dev dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
stack build --haddock --test --only-dependencies
stack install doctest
- name: Install weeder
run: stack install weeder-2.4.1
stack install doctest weeder
nitta:
runs-on: ubuntu-latest
Expand All @@ -62,77 +62,76 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Cache haskell-stack
uses: actions/cache@v3.2.5
############################################################
## Caches

- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-
- uses: actions/cache@v3
name: Cache nitta exe
with:
path: |
~/.stack
.stack-work
/home/runner/.local/bin
key: ${{ runner.os }}-haskell-stack-${{ hashFiles('**/stack.yaml', '**/package.yaml') }}
path: ~/.local/bin
key: ${{ runner.os }}-nitta-exe-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }}
restore-keys: |
${{ runner.os }}-nitta-exe-
- uses: actions/cache@v3
name: Cache nitta-api-gen
with:
path: ./web/src/services/gen
key: ${{ runner.os }}-nitta-api-gen-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }}
restore-keys: |
${{ runner.os }}-nitta-api-gen-
############################################################
## Setup dev tools

- name: Install haskell-stack
uses: haskell/actions/setup@v2.3.3
uses: haskell-actions/setup@v2
with:
enable-stack: true
stack-no-global: true
stack-version: "latest"
stack-no-global: true

- name: "Set up HLint"
uses: haskell-actions/hlint-setup@v2.4.8
with:
version: "3.6.1"

- name: Install Icarus Verilog
run: sudo apt-get install iverilog

- name: Build & test nitta backend
run: stack build --haddock --no-haddock-deps --test --keep-going --test-suite-timeout 600 --copy-bins --coverage
############################################################
## nitta checks

- name: Generate test coverage report
run: stack hpc report nitta
- name: Build & test nitta
run: make build test

- name: Check examples by doctest
run: find src -name '*.hs' -exec grep -l '>>>' {} \; | xargs -t -L 1 -P 4 stack exec doctest
- name: Check nitta lint and format
run: make lint

- name: Make production build
run: make build-prod

- name: Generate backend API
run: stack exec nitta-api-gen -- -v

- name: Cache node_modules
uses: actions/cache@v3.2.5
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Build nitta frontend dependencies
working-directory: ./web
run: yarn install

- name: Build frontend
working-directory: ./web
timeout-minutes: 5
run: yarn build

- name: Run weeder
run: weeder

- uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.6.1
- uses: actions/setup-python@v4
with:
python-version: 3.11
cache: poetry
- name: Install Python dependencies
working-directory: ./ml/synthesis
run: poetry install --no-root
- name: Run Python tests
working-directory: ./ml/synthesis
run: |
export PYTHONPATH=$(pwd)/src:$PYTHONPATH
poetry run pytest
############################################################
## nitta publish docs & reports

- name: Copy doc to GH_PAGES_DIR
run: |
mkdir -p "${{ env.GH_PAGES_DIR }}/haddock/"
cp -r $(stack path --dist-dir)/doc/html/nitta "$_"
- name: Copy test coverage to GH_PAGES_DIR
run: cp -r $(stack path --local-hpc-root)/combined/custom ${{ env.GH_PAGES_DIR }}/hpc
run: cp -r $(stack path --local-hpc-root)/combined/all ${{ env.GH_PAGES_DIR }}/hpc

- name: Copy API doc to GH_PAGES_DIR
run: |
Expand All @@ -149,6 +148,108 @@ jobs:
folder: ${{ env.GH_PAGES_DIR }}
branch: gh-pages

nitta-frontend:
runs-on: ubuntu-latest
needs: nitta
timeout-minutes: 15
steps:
- uses: actions/checkout@v3

############################################################
## Caches

- name: Get yarn cache directory path
working-directory: ./web
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v3
name: Cache nitta exe
with:
path: ~/.local/bin
key: ${{ runner.os }}-nitta-exe-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }}
restore-keys: |
${{ runner.os }}-nitta-exe-
- uses: actions/cache@v3
name: Cache nitta-api-gen
with:
path: ./web/src/services/gen
key: ${{ runner.os }}-nitta-api-gen-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }}
restore-keys: |
${{ runner.os }}-nitta-api-gen-
############################################################
## nitta ui checks

- name: Build nitta frontend
timeout-minutes: 15
run: |
yarn --cwd web install
make ui-build
nitta-ml:
runs-on: ubuntu-latest
needs: nitta
timeout-minutes: 15
steps:
- uses: actions/checkout@v3

############################################################
## Caches

- uses: actions/cache@v3
name: Cache nitta exe
with:
path: ~/.local/bin
key: ${{ runner.os }}-nitta-exe-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }}
restore-keys: |
${{ runner.os }}-nitta-exe-
- uses: actions/cache@v3
name: Cache nitta-api-gen
with:
path: ./web/src/services/gen
key: ${{ runner.os }}-nitta-api-gen-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }}
restore-keys: |
${{ runner.os }}-nitta-api-gen-
############################################################
## Setup dev tools

- uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.6.1

- uses: actions/setup-python@v4
with:
python-version: 3.11
cache: poetry

- name: Install Python dependencies
working-directory: ./ml/synthesis
run: poetry install --no-root

############################################################
## nitta ml checks

- name: Run Python tests
working-directory: ./ml/synthesis
env:
NITTA_RUN_COMMAND_OVERRIDE: nitta
run: |
export PYTHONPATH=$(pwd)/src:$PYTHONPATH
poetry run pytest
verilog-formatting:
timeout-minutes: 5
runs-on: ubuntu-latest
Expand All @@ -163,31 +264,15 @@ jobs:
cat make_hdl.log
test "$(grep -ci error make_hdl.log)" -eq 0
haskell-lint:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: "Set up HLint"
uses: haskell/actions/hlint-setup@v2.3.3
with:
version: "3.5"

- name: "Run HLint"
uses: haskell/actions/hlint-run@v2.3.3
with:
path: .
fail-on: suggestion

haskell-formatting:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Check formatting
uses: fourmolu/fourmolu-action@v8 # fourmolu-0.12.0.0
- uses: haskell-actions/run-fourmolu@v9
with:
version: "0.14.1.0"

typescript-formatting:
timeout-minutes: 5
Expand Down
2 changes: 2 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
- ignore: { name: "Eta reduce" }
- ignore: { name: "Use tuple-section" }
- ignore: { name: "Use zipWith" }
- ignore: { name: "Move concatMap out" }
- ignore: { name: "Redundant <&>" }

- ignore: { within: "NITTA.Intermediate.Simulation.Tests", name: "Fuse mapM_/map" }
- ignore: { within: "NITTA.Intermediate.Value.Tests", name: "Evaluate" }
Expand Down
Loading