Skip to content

Commit a8e5b30

Browse files
XLS Modules Implementation CI
Signed-off-by: Michal Czyz <[email protected]>
1 parent 7b1bc6d commit a8e5b30

File tree

6 files changed

+194
-27
lines changed

6 files changed

+194
-27
lines changed

.github/actions/build/action.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: build
2+
description: 'Build XLS'
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Cache
8+
uses: ./.github/actions/cache
9+
10+
- name: Install dependencies via apt
11+
shell: bash
12+
run: sudo apt-get install python3-distutils python3-dev python-is-python3 libtinfo5 build-essential liblapack-dev libblas-dev gfortran
13+
14+
- name: Install bazelisk
15+
shell: bash
16+
run: |
17+
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64"
18+
mkdir -p "${GITHUB_WORKSPACE}/bin/"
19+
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
20+
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
21+
22+
- name: Bazel Build Tools (opt)
23+
shell: bash
24+
run: |
25+
"${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
26+
27+
# - name: Bazel Test All (opt)
28+
# shell: bash
29+
# run: |
30+
# "${GITHUB_WORKSPACE}/bin/bazel" test -c opt --test_output=errors -- //xls/...

.github/actions/cache/action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: cache
2+
description: 'Cache Bazel'
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Mount Bazel Cache
8+
uses: actions/cache@v4
9+
with:
10+
path: "~/.cache/bazel"
11+
# Create/use a cache called bazel-cache-22_04-<commit hash>
12+
# and read the latest cache with prefix bazel-cache-22_04-
13+
# if it doesn't already exist.
14+
key: bazel-cache-22_04-${{ github.sha }}
15+
restore-keys: bazel-cache-22_04-
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: implementation
2+
description: 'DSLX to Openroad P&R'
3+
inputs:
4+
xls_module:
5+
description: 'Module in //xls/modules'
6+
required: true
7+
default: 'xls/modules/dma'
8+
rule_ir:
9+
description: 'Bazel rule to generate optimized IR'
10+
required: true
11+
default: 'csr_opt_ir_benchmark'
12+
rule_verilog:
13+
description: 'Bazel rule to generate verilog'
14+
required: true
15+
default: 'verilog_csr'
16+
rule_synthesis:
17+
description: 'Bazel rule to synthesize verilog'
18+
required: true
19+
default: 'csr_benchmark_synth'
20+
rule_pnr:
21+
description: 'Bazel rule to place and route'
22+
required: true
23+
default: 'csr_place_and_route'
24+
runs:
25+
using: "composite"
26+
steps:
27+
- uses: ./.github/actions/cache
28+
29+
- name: IR
30+
shell: bash
31+
run: |
32+
bazel run --local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9 ${{inputs.xls_module}}/${{inputs.rule_ir}}
33+
34+
- name: Verilog
35+
shell: bash
36+
run: |
37+
bazel build --local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9 ${{inputs.xls_module}}/${{inputs.rule_verilog}}
38+
39+
- name: Synthesis
40+
shell: bash
41+
run: |
42+
bazel run --local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9 ${{inputs.xls_module}}/${{inputs.rule_synthesis}}
43+
44+
- name: P&R
45+
shell: bash
46+
run: |
47+
bazel build --local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9 ${{inputs.xls_module}}/${{inputs.rule_pnr}}
48+
49+
# - name: Artifacts
50+
# if: always()
51+
# uses: actions/upload-artifact@v4
52+
# with:
53+
# name: implementation_logs
54+
# path: xls/*.log

.github/actions/test/action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: test
2+
description: 'DSLX Test'
3+
inputs:
4+
xls_module:
5+
description: 'Module in //xls/modules'
6+
required: true
7+
default: 'xls/modules/dma'
8+
rule_test:
9+
description: 'Bazel rule to test DSLX'
10+
required: true
11+
default: 'test_csr'
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- uses: ./.github/actions/cache
17+
18+
- name: IR
19+
shell: bash
20+
env:
21+
BAZEL_RESOURCES_OPT: "--local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9"
22+
BAZEL_RUN_OPT: ""
23+
run: |
24+
bazel run ${BAZEL_RESOURCES_OPT} ${BAZEL_RUN_OPT} ${{inputs.xls_module}}/${{inputs.rule_test}}

.github/workflows/xls-modules.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"module": [
3+
{
4+
"xls_module": "//xls/modules/dma",
5+
"rule_ir": "csr_opt_ir_benchmark",
6+
"rule_verilog": "verilog_csr",
7+
"rule_synthesis": "csr_benchmark_synth",
8+
"rule_pnr": "csr_place_and_route"
9+
}
10+
]
11+
}

.github/workflows/xls-modules.yml

Lines changed: 60 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
22
# See also: https://github.com/marketplace/actions/bazel-action
33

4-
name: Continuous Integration
4+
name: XLS Modules
55
on:
66
# Avoid triggering on pushes to /all/ open PR branches.
77
push:
@@ -16,39 +16,72 @@ on:
1616
# This lets us trigger manually from the UI.
1717
workflow_dispatch:
1818

19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
22+
1923
jobs:
2024
build:
21-
name: Bazel Build (opt)
22-
runs-on:
23-
labels: ubuntu-22.04-64core
25+
name: BUILD
26+
# runs-on: ubuntu-22.04
27+
runs-on: ubuntu-22.04
2428
timeout-minutes: 600
2529
steps:
26-
- uses: actions/checkout@v2
27-
28-
- name: Mount Bazel Cache
29-
uses: actions/cache@v3
30+
- uses: actions/checkout@v4
3031
with:
31-
path: "~/.cache/bazel"
32-
# Create/use a cache called bazel-cache-22_04-<commit hash>
33-
# and read the latest cache with prefix bazel-cache-22_04-
34-
# if it doesn't already exist.
35-
key: bazel-cache-22_04-${{ github.sha }}
36-
restore-keys: bazel-cache-22_04-
32+
ref: 'ci/dslx-dma-rebase-axi'
3733

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

41-
- name: Install bazelisk
37+
- name: Debug print
38+
id: debug_print
4239
run: |
43-
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64"
44-
mkdir -p "${GITHUB_WORKSPACE}/bin/"
45-
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
46-
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
40+
sudo apt install tree
41+
tree -d -L 3 /home/runner/work/xls/
4742
48-
- name: Bazel Build Tools (opt)
49-
run: |
50-
"${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
43+
- name: Build XLS
44+
id: build
45+
uses: ./.github/actions/build
5146

52-
- name: Bazel Test All (opt)
53-
run: |
54-
"${GITHUB_WORKSPACE}/bin/bazel" test -c opt --test_output=errors -- //xls/...
47+
implement:
48+
needs: build
49+
name: Implementation
50+
runs-on: ubuntu-22.04
51+
timeout-minutes: 600
52+
# strategy:
53+
# matrix: ${{ fromJson( ) }}
54+
steps:
55+
- uses: actions/checkout@v4
56+
with:
57+
ref: 'ci/dslx-dma-rebase-axi'
58+
59+
- name: Implement CSR
60+
id: implementation
61+
uses: ./.github/actions/implementation
62+
with:
63+
xls_module: "xls/modules/dma"
64+
rule_ir: "csr_opt_ir_benchmark"
65+
rule_verilog: "verilog_csr"
66+
rule_synthesis: "csr_benchmark_synth"
67+
rule_pnr: "csr_place_and_route"
68+
69+
70+
test:
71+
needs: build
72+
name: Test
73+
runs-on: ubuntu-22.04
74+
timeout-minutes: 600
75+
# strategy:
76+
# matrix: ${{ fromJson( ) }}
77+
steps:
78+
- uses: actions/checkout@v4
79+
with:
80+
ref: 'ci/dslx-dma-rebase-axi'
81+
82+
- name: Test CSR
83+
id: test
84+
uses: ./.github/actions/test
85+
with:
86+
xls_module: "xls/modules/dma"
87+
rule_test: "test_csr"

0 commit comments

Comments
 (0)