Skip to content

Commit a32ee39

Browse files
DSLX DMA: Implementation
Signed-off-by: Michal Czyz <[email protected]>
1 parent af3a0e3 commit a32ee39

16 files changed

+5323
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"dma": {
3+
"name": "//xls/modules/dma",
4+
"rules": [
5+
{
6+
"ir": "csr_opt_ir_benchmark",
7+
"verilog": "verilog_csr",
8+
"synthesis": "csr_benchmark_synth",
9+
"pnr": "csr_place_and_route"
10+
},
11+
{
12+
"ir": "axi_csr_opt_ir_benchmark",
13+
"verilog": "verilog_axi_csr",
14+
"synthesis": "axi_csr_benchmark_synth",
15+
"pnr": "axi_csr_place_and_route"
16+
},
17+
{
18+
"ir": "address_generator_opt_ir_benchmark",
19+
"verilog": "verilog_address_generator",
20+
"synthesis": "address_generator_benchmark_synth",
21+
"pnr": "address_generator_place_and_route"
22+
},
23+
{
24+
"ir": "frontend_reader_opt_ir_benchmark",
25+
"verilog": "verilog_frontend_reader",
26+
"synthesis": "frontend_reader_benchmark_synth",
27+
"pnr": "frontend_reader_place_and_route"
28+
},
29+
{
30+
"ir": "frontend_writer_opt_ir_benchmark",
31+
"verilog": "verilog_frontend_writer",
32+
"synthesis": "frontend_writer_benchmark_synth",
33+
"pnr": "frontend_writer_place_and_route"
34+
}
35+
]
36+
}
37+
}

.github/workflows/xls-modules-dma.yml

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
2+
# See also: https://github.com/marketplace/actions/bazel-action
3+
4+
name: XLS Modules DMA
5+
on:
6+
# Avoid triggering on pushes to /all/ open PR branches.
7+
push:
8+
branches:
9+
- main
10+
paths-ignore:
11+
# Do not trigger action when docs are updated.
12+
- 'docs/**'
13+
pull_request:
14+
branches:
15+
- main
16+
# This lets us trigger manually from the UI.
17+
workflow_dispatch:
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
22+
23+
env:
24+
XLS_MODULE: //xls/modules/dma
25+
XLS_MODULE_NAME: dma
26+
# Intensive runs can cause the runner to starve and crash
27+
BAZEL_RESOURCES_OPT: "--local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9"
28+
CACHE_KEY: bazel-cache-dma-${{ github.sha }}
29+
CACHE_RESTORE_KEY: bazel-cache-dma
30+
# OpenROAD cache is large, so let's split usage
31+
CACHE_KEY_IMPL: bazel-cache-dma-impl-${{ github.sha }}
32+
CACHE_RESTORE_KEY_IMPL: bazel-cache-dma-impl
33+
34+
jobs:
35+
build:
36+
name: BUILD
37+
runs-on: ubuntu-22.04
38+
timeout-minutes: 600
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: Bazel Cache
43+
uses: actions/cache@v4
44+
with:
45+
path: "~/.cache/bazel"
46+
key: ${{ env.CACHE_KEY }}
47+
restore-keys: ${{ env.CACHE_RESTORE_KEY }}
48+
49+
- name: Increase build space
50+
run: |
51+
echo "Before cleanup"
52+
df -H
53+
sudo rm -rf /usr/share/dotnet/*
54+
sudo rm -rf /usr/local/lib/android/*
55+
sudo rm -rf /usr/share/dotnet
56+
sudo rm -rf /opt/ghc
57+
sudo rm -rf "/usr/local/share/boost"
58+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
59+
echo "After cleanup"
60+
df -H
61+
62+
- name: Install dependencies via apt
63+
run: |
64+
sudo apt-get update
65+
sudo apt-get -qy --no-install-recommends install \
66+
build-essential \
67+
gfortran \
68+
libblas-dev \
69+
liblapack-dev \
70+
libtinfo5 \
71+
python-is-python3 \
72+
python3-dev \
73+
python3-distutils
74+
75+
- name: Bazel Build Tools (opt)
76+
run: |
77+
bazel build -c opt --test_output=errors -- \
78+
//xls/dslx:interpreter_main \
79+
//xls/dslx/ir_convert:ir_converter_main \
80+
//xls/tools:opt_main \
81+
//xls/tools:codegen_main \
82+
//xls/dslx:dslx_fmt
83+
84+
test:
85+
needs: build
86+
name: Test
87+
runs-on: ubuntu-22.04
88+
timeout-minutes: 600
89+
strategy:
90+
fail-fast: false
91+
matrix:
92+
dslx_test: ["test_common",
93+
"test_csr",
94+
"test_axi_csr",
95+
"test_address_generator",
96+
"test_frontend_writer",
97+
"test_frontend_reader",
98+
"test_main_controller"
99+
]
100+
steps:
101+
- uses: actions/checkout@v4
102+
103+
- name: Bazel Cache
104+
uses: actions/cache@v4
105+
with:
106+
path: "~/.cache/bazel"
107+
key: ${{env.CACHE_KEY}}
108+
restore-keys: ${{env.CACHE_RESTORE_KEY}}
109+
110+
- name: Test
111+
run: |
112+
bazel run -c opt --test_output=errors -- ${{env.XLS_MODULE}}:${{ matrix.dslx_test }}
113+
114+
format:
115+
name: Format
116+
runs-on: ubuntu-22.04
117+
timeout-minutes: 600
118+
steps:
119+
- uses: actions/checkout@v4
120+
121+
- name: Bazel Cache
122+
uses: actions/cache@v4
123+
with:
124+
path: "~/.cache/bazel"
125+
key: ${{env.CACHE_KEY}}
126+
restore-keys: ${{env.CACHE_RESTORE_KEY}}
127+
128+
# Once https://github.com/google/xls/issues/1285 is implemented,
129+
# we could replace these with a single rule
130+
- name: Test formatting
131+
run: |
132+
bazel run -c opt --test_output=errors -- \
133+
//xls/modules/dma:fmt_address_generator \
134+
//xls/modules/dma:fmt_axi_csr \
135+
//xls/modules/dma:fmt_common \
136+
//xls/modules/dma:fmt_config \
137+
//xls/modules/dma:fmt_csr \
138+
//xls/modules/dma:fmt_fifo \
139+
//xls/modules/dma:fmt_frontend_reader \
140+
//xls/modules/dma:fmt_frontend_writer \
141+
//xls/modules/dma:fmt_gpf \
142+
//xls/modules/dma:fmt_main_controller \
143+
//xls/modules/dma:fmt_bus_axi_pkg \
144+
//xls/modules/dma:fmt_bus_axi_st_pkg
145+
146+
147+
config-matrix:
148+
name: Matrix configuration
149+
runs-on: ubuntu-22.04
150+
timeout-minutes: 60
151+
outputs:
152+
json_rules: ${{ env.json_rules }}
153+
steps:
154+
- uses: actions/checkout@v4
155+
156+
- name: Read json file
157+
id: read-json
158+
run: |
159+
sudo apt-get update
160+
sudo apt-get -qqy --no-install-recommends install jq
161+
echo "json_rules=$(jq -rc 'del(.dma.name)|.dma' .github/workflows/xls-modules-${{ env.XLS_MODULE_NAME }}.json)" | tee -a "$GITHUB_ENV"
162+
163+
implement:
164+
needs: config-matrix
165+
name: Implementation
166+
runs-on: ubuntu-22.04
167+
timeout-minutes: 600
168+
strategy:
169+
fail-fast: false
170+
matrix: ${{ fromJson( needs.config-matrix.outputs.json_rules ) }}
171+
steps:
172+
- uses: actions/checkout@v4
173+
174+
- name: Increase build space
175+
run: |
176+
echo "Before cleanup"
177+
df -H
178+
sudo rm -rf /usr/share/dotnet/*
179+
sudo rm -rf /usr/local/lib/android/*
180+
sudo rm -rf /usr/share/dotnet
181+
sudo rm -rf /opt/ghc
182+
sudo rm -rf "/usr/local/share/boost"
183+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
184+
echo "After cleanup"
185+
df -H
186+
187+
- name: Bazel Cache
188+
uses: actions/cache@v4
189+
with:
190+
path: "~/.cache/bazel"
191+
key: ${{env.CACHE_KEY_IMPL}}
192+
restore-keys: ${{env.CACHE_RESTORE_KEY_IMPL}}
193+
194+
- name: IR
195+
run: |
196+
bazel run -c opt ${{ env.BAZEL_RESOURCES_OPT }} -- ${{ env.XLS_MODULE }}:${{ matrix.rules.ir }}
197+
198+
- name: Verilog
199+
run: |
200+
bazel build -c opt ${{ env.BAZEL_RESOURCES_OPT }} -- ${{ env.XLS_MODULE }}:${{ matrix.rules.verilog }}
201+
202+
- name: Synthesis
203+
run: |
204+
bazel run -c opt ${{ env.BAZEL_RESOURCES_OPT }} -- ${{ env.XLS_MODULE }}:${{ matrix.rules.synthesis }}
205+
206+
- name: P&R
207+
run: |
208+
bazel build -c opt ${{ env.BAZEL_RESOURCES_OPT }} -- ${{ env.XLS_MODULE }}:${{ matrix.rules.pnr }}
209+
210+
# ${variable/character_to_replace/new_character}
211+
# ${variable/ slash / underscore }
212+
- name: Prepare artifact name
213+
if: always()
214+
shell: bash
215+
run: |
216+
name_input=${{env.XLS_MODULE}}/${{ matrix.rules.ir }}
217+
name_output="${name_input//\//_}"
218+
echo "artifact_name=${name_output}" >> "$GITHUB_ENV"
219+
220+
- name: Artifacts
221+
if: always()
222+
uses: actions/upload-artifact@v4
223+
with:
224+
name: artifacts-impl-${{ env.artifact_name }}
225+
path: |
226+
./bazel-bin/${{env.XLS_MODULE}}/*.log
227+
./bazel-bin/${{env.XLS_MODULE}}/*.textproto
228+
./bazel-bin/${{env.XLS_MODULE}}/*.ir
229+
./bazel-bin/${{env.XLS_MODULE}}/*.v
230+
./bazel-bin/${{env.XLS_MODULE}}/*.sv

0 commit comments

Comments
 (0)