Skip to content

Commit

Permalink
XLS Modules Implementation CI
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Czyz <[email protected]>
  • Loading branch information
mczyz-antmicro committed Mar 7, 2024
1 parent 7b1bc6d commit a8e5b30
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 27 deletions.
30 changes: 30 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: build
description: 'Build XLS'

runs:
using: "composite"
steps:
- name: Cache
uses: ./.github/actions/cache

- name: Install dependencies via apt
shell: bash
run: sudo apt-get install python3-distutils python3-dev python-is-python3 libtinfo5 build-essential liblapack-dev libblas-dev gfortran

- name: Install bazelisk
shell: bash
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
- name: Bazel Build Tools (opt)
shell: bash
run: |
"${GITHUB_WORKSPACE}/bin/bazel" build --local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9 -c opt --test_output=errors -- //xls/dslx:interpreter_main //xls/dslx/ir_convert:ir_converter_main //xls/tools:opt_main //xls/tools:codegen_main
# - name: Bazel Test All (opt)
# shell: bash
# run: |
# "${GITHUB_WORKSPACE}/bin/bazel" test -c opt --test_output=errors -- //xls/...
15 changes: 15 additions & 0 deletions .github/actions/cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: cache
description: 'Cache Bazel'

runs:
using: "composite"
steps:
- name: Mount Bazel Cache
uses: actions/cache@v4
with:
path: "~/.cache/bazel"
# Create/use a cache called bazel-cache-22_04-<commit hash>
# and read the latest cache with prefix bazel-cache-22_04-
# if it doesn't already exist.
key: bazel-cache-22_04-${{ github.sha }}
restore-keys: bazel-cache-22_04-
54 changes: 54 additions & 0 deletions .github/actions/implementation/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: implementation
description: 'DSLX to Openroad P&R'
inputs:
xls_module:
description: 'Module in //xls/modules'
required: true
default: 'xls/modules/dma'
rule_ir:
description: 'Bazel rule to generate optimized IR'
required: true
default: 'csr_opt_ir_benchmark'
rule_verilog:
description: 'Bazel rule to generate verilog'
required: true
default: 'verilog_csr'
rule_synthesis:
description: 'Bazel rule to synthesize verilog'
required: true
default: 'csr_benchmark_synth'
rule_pnr:
description: 'Bazel rule to place and route'
required: true
default: 'csr_place_and_route'
runs:
using: "composite"
steps:
- uses: ./.github/actions/cache

- name: IR
shell: bash
run: |
bazel run --local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9 ${{inputs.xls_module}}/${{inputs.rule_ir}}
- name: Verilog
shell: bash
run: |
bazel build --local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9 ${{inputs.xls_module}}/${{inputs.rule_verilog}}
- name: Synthesis
shell: bash
run: |
bazel run --local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9 ${{inputs.xls_module}}/${{inputs.rule_synthesis}}
- name: P&R
shell: bash
run: |
bazel build --local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9 ${{inputs.xls_module}}/${{inputs.rule_pnr}}
# - name: Artifacts
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: implementation_logs
# path: xls/*.log
24 changes: 24 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: test
description: 'DSLX Test'
inputs:
xls_module:
description: 'Module in //xls/modules'
required: true
default: 'xls/modules/dma'
rule_test:
description: 'Bazel rule to test DSLX'
required: true
default: 'test_csr'

runs:
using: "composite"
steps:
- uses: ./.github/actions/cache

- name: IR
shell: bash
env:
BAZEL_RESOURCES_OPT: "--local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9"
BAZEL_RUN_OPT: ""
run: |
bazel run ${BAZEL_RESOURCES_OPT} ${BAZEL_RUN_OPT} ${{inputs.xls_module}}/${{inputs.rule_test}}
11 changes: 11 additions & 0 deletions .github/workflows/xls-modules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"module": [
{
"xls_module": "//xls/modules/dma",
"rule_ir": "csr_opt_ir_benchmark",
"rule_verilog": "verilog_csr",
"rule_synthesis": "csr_benchmark_synth",
"rule_pnr": "csr_place_and_route"
}
]
}
87 changes: 60 additions & 27 deletions .github/workflows/xls-modules.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
# See also: https://github.com/marketplace/actions/bazel-action

name: Continuous Integration
name: XLS Modules
on:
# Avoid triggering on pushes to /all/ open PR branches.
push:
Expand All @@ -16,39 +16,72 @@ on:
# This lets us trigger manually from the UI.
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build:
name: Bazel Build (opt)
runs-on:
labels: ubuntu-22.04-64core
name: BUILD
# runs-on: ubuntu-22.04
runs-on: ubuntu-22.04
timeout-minutes: 600
steps:
- uses: actions/checkout@v2

- name: Mount Bazel Cache
uses: actions/cache@v3
- uses: actions/checkout@v4
with:
path: "~/.cache/bazel"
# Create/use a cache called bazel-cache-22_04-<commit hash>
# and read the latest cache with prefix bazel-cache-22_04-
# if it doesn't already exist.
key: bazel-cache-22_04-${{ github.sha }}
restore-keys: bazel-cache-22_04-
ref: 'ci/dslx-dma-rebase-axi'

- name: Install dependencies via apt
run: sudo apt-get install python3-distutils python3-dev python-is-python3 libtinfo5 build-essential liblapack-dev libblas-dev gfortran
- name: Debug action
uses: hmarr/[email protected]

- name: Install bazelisk
- name: Debug print
id: debug_print
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
sudo apt install tree
tree -d -L 3 /home/runner/work/xls/
- name: Bazel Build Tools (opt)
run: |
"${GITHUB_WORKSPACE}/bin/bazel" build -c opt --test_output=errors -- //xls/dslx:interpreter_main //xls/dslx/ir_convert:ir_converter_main //xls/tools:opt_main //xls/tools:codegen_main
- name: Build XLS
id: build
uses: ./.github/actions/build

- name: Bazel Test All (opt)
run: |
"${GITHUB_WORKSPACE}/bin/bazel" test -c opt --test_output=errors -- //xls/...
implement:
needs: build
name: Implementation
runs-on: ubuntu-22.04
timeout-minutes: 600
# strategy:
# matrix: ${{ fromJson( ) }}
steps:
- uses: actions/checkout@v4
with:
ref: 'ci/dslx-dma-rebase-axi'

- name: Implement CSR
id: implementation
uses: ./.github/actions/implementation
with:
xls_module: "xls/modules/dma"
rule_ir: "csr_opt_ir_benchmark"
rule_verilog: "verilog_csr"
rule_synthesis: "csr_benchmark_synth"
rule_pnr: "csr_place_and_route"


test:
needs: build
name: Test
runs-on: ubuntu-22.04
timeout-minutes: 600
# strategy:
# matrix: ${{ fromJson( ) }}
steps:
- uses: actions/checkout@v4
with:
ref: 'ci/dslx-dma-rebase-axi'

- name: Test CSR
id: test
uses: ./.github/actions/test
with:
xls_module: "xls/modules/dma"
rule_test: "test_csr"

0 comments on commit a8e5b30

Please sign in to comment.