Skip to content

Commit 8f60d2c

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

16 files changed

+5324
-0
lines changed
+37
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

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

0 commit comments

Comments
 (0)