Skip to content

Commit ac33d68

Browse files
Add AIEBU_USER_MANUAL.rst
1 parent 5e3f43c commit ac33d68

1 file changed

Lines changed: 387 additions & 0 deletions

File tree

AIEBU_USER_MANUAL.rst

Lines changed: 387 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,387 @@
1+
AIEBU Usage Manual (In progress)
2+
================================
3+
4+
- `AIE Binary Utilities
5+
(AIEBU) <#AIEBUUsageManual(Inprogress)-AIEBinaryU>`__
6+
7+
- `AIEBU-ASM command line
8+
utility <#AIEBUUsageManual(Inprogress)-AIEBU-ASMc>`__
9+
10+
- `TARGET: aie2txn <#AIEBUUsageManual(Inprogress)-TARGET:aie>`__
11+
12+
- `Example <#AIEBUUsageManual(Inprogress)-Example>`__
13+
14+
- `Output ELF Section Layout for AIE2 and
15+
AIE2P <#AIEBUUsageManual(Inprogress)-OutputELFS>`__
16+
17+
- `Description <#AIEBUUsageManual(Inprogress)-Descriptio>`__
18+
19+
- `AIEBU-DUMP Command line
20+
utility <#AIEBUUsageManual(Inprogress)-AIEBU-DUMP>`__
21+
22+
- `Examples <#AIEBUUsageManual(Inprogress)-Examples>`__
23+
24+
- `1. Display all ELF Headers and Opcode
25+
frequency <#AIEBUUsageManual(Inprogress)-1.Displaya>`__
26+
27+
- `AIEBU-DUMP
28+
Command <#AIEBUUsageManual(Inprogress)-AIEBU-DUMP>`__
29+
30+
- `2. Display Assembly format of .ctrltext
31+
section <#AIEBUUsageManual(Inprogress)-2.DisplayA>`__
32+
33+
- `AIEBU-DUMP
34+
Command <#AIEBUUsageManual(Inprogress)-AIEBU-DUMP>`__
35+
36+
- `3. Display Assembly code of all ELF
37+
sections <#AIEBUUsageManual(Inprogress)-3.DisplayA>`__
38+
39+
- `AIEBU-DUMP
40+
Command <#AIEBUUsageManual(Inprogress)-AIEBU-DUMP>`__
41+
42+
AIE Binary Utilities (AIEBU)
43+
============================
44+
45+
This repository contains library and utilities to work with AIE
46+
*ctrlcode.*
47+
48+
AIEBU-ASM command line utility
49+
==============================
50+
51+
**NAME**
52+
53+
- aiebu-asm - Assembles AIE control code binary files and associated
54+
control packet and pm control packet binaries into ELF files.
55+
56+
**LOCATION**
57+
58+
- cd <workspace>/aiebu/build/Debug/opt/xilinx/aiebu/bin
59+
60+
**SYNOPSIS**
61+
62+
- aiebu-asm [OPTIONS]
63+
64+
- aiebu-asm [-t \| --target]
65+
66+
- [-h \| --help]
67+
68+
**DESCRIPTION**
69+
70+
- aiebu-asm is a command-line utility used to assemble AI Engine TXN
71+
control code binaries or assembly files into Executable Loadable
72+
Format (ELF) files. It parses control code, control packet and
73+
patching JSON file and assembles them into various loadable ELF
74+
segments and dynamic sections of the resultant ELF file generated.
75+
The control code, control packet, pm control packet, save/restore
76+
control code are added to the loadable ELF segments and the patching
77+
information is added to the dynamic ELF sections. For control code
78+
supporting preemption, AIEBU also generates the control code binaries
79+
needed for save and restore operations. The ELF files are then loaded
80+
by XRT (Xilinx Runtime) and executed by the NPU firmware. The ELF
81+
loadable sections are patched in run time by XRT and loaded onto the
82+
NPU to run.
83+
84+
**OPTIONS**
85+
86+
- -t, --target TARGET
87+
88+
- Specify the target for the assembler. Supported targets are
89+
90+
- aie2ps/aie2asm/aie2txn
91+
92+
Once we select on of the 3 targets we can proceed with the other options
93+
in the utility.
94+
95+
**TARGET:** **aie2txn**
96+
-----------------------
97+
98+
For AIE2 and AIE2P architectures below command options of aiebu-asm are
99+
provided.
100+
101+
**SYNOPSIS**
102+
103+
- aiebu-asm -t aie2txn [OPTIONS]
104+
105+
-
106+
107+
- aiebu-asm -t aie2txn [-c \|-- control code ]
108+
109+
- [-p \| -- control packet ]
110+
111+
- [-j \| -- json ]
112+
113+
- [-m \| -- pm control packet ]
114+
115+
- [-o \| -- output ]
116+
117+
- [-r \| -- report]
118+
119+
- [-h \| --help]
120+
121+
**OPTIONS**
122+
123+
- -t, --target TARGET
124+
125+
- Specify the target for the assembler. Supported targets are
126+
127+
- aie2ps/aie2asm/aie2txn
128+
129+
-
130+
131+
- -c, --controlcode FILE
132+
133+
- Provide TXN control code binary file with its path.
134+
135+
-
136+
137+
- -p, --controlpkt FILE
138+
139+
- Provide the control packet binary file with its path. Use this option
140+
if the control packet is provided.
141+
142+
-
143+
144+
- -j, --json FILE
145+
146+
- Provide the patching JSON file with its path. This file has has
147+
patching information for the control packet.
148+
149+
- This option is always accompanies with -p option above
150+
151+
-
152+
153+
- -m, --pmctrlpkt ID:FILE
154+
155+
- Specify a program memory control packet in the format
156+
157+
- \`<id>:<file>`. Where <id> is the pm control packet ID and <file> is
158+
the pm control packet binary with its path.
159+
160+
-
161+
162+
- -o, --outputelf FILE
163+
164+
- Provide name of the ELF output file with its path that will be
165+
generated as a result of running the aiebu-asm utility.
166+
167+
-
168+
169+
- -r, --report
170+
171+
- Standalone option, no value to be provided with this option.
172+
173+
- This option generate the control code assembly file (.asm) at the
174+
same location where the output elf is generated using the -o option.
175+
176+
- This option needs to be used with -c and -o options to provide the
177+
control_code.bin and output.elf path respectively.
178+
179+
- Also generates a report for the assembled output on the console.
180+
181+
-
182+
183+
- -h, --help
184+
185+
- Show this help message and exit.
186+
187+
Example
188+
-------
189+
190+
- TXN Control Code only
191+
192+
- ./aiebu-asm -t aie2txn -c
193+
<path_to_control_code.bin>/control_code.bin -o
194+
<path_to_output.elf>/output.elf
195+
196+
- TXN Control Code + Control Packet
197+
198+
- ./aiebu-asm -t aie2txn -c
199+
<path_to_control_code.bin>/control_code.bin -p
200+
<path_to_control_packet.bin>/control_packet.bin -j
201+
<path_to_external_buffer_id.json>/external_buffer_id.json -o
202+
<path_to_output.elf>/output.elf
203+
204+
Output ELF Section Layout for AIE2 and AIE2P
205+
--------------------------------------------
206+
207+
Description
208+
~~~~~~~~~~~
209+
210+
ELF is an executable loadable format file used to package the
211+
transaction control code binaries, control packet binaries, pm control
212+
packet binaries and provide necessary patching information.
213+
214+
`readelf(1) - Linux manual
215+
page <https://www.man7.org/linux/man-pages/man1/readelf.1.html>`__ is a
216+
utility which dumps the elf file in readable format.
217+
218+
+------------------+--------------------------------------------------+
219+
| **Sections** | **Description** |
220+
+==================+==================================================+
221+
| .ctrltext | This corresponds to the transaction control code |
222+
| | binary, used for running run time DMA like |
223+
| | operations on the |
224+
+------------------+--------------------------------------------------+
225+
| .ctrldata | This corresponds to control control-packet |
226+
| | binary used when running inferences, used by |
227+
| | shim DMA program and also to configure AIE |
228+
| | registers. |
229+
+------------------+--------------------------------------------------+
230+
| .preempt_save | control code to do save operation during |
231+
| | preemption |
232+
+------------------+--------------------------------------------------+
233+
| .preempt_restore | control code to do restore operation during |
234+
| | preemption |
235+
+------------------+--------------------------------------------------+
236+
| .ctrlpkt.pm.n | AIE pm in control packet format with ID n |
237+
+------------------+--------------------------------------------------+
238+
| .dynsym | a set of external symbols of fixed length. |
239+
+------------------+--------------------------------------------------+
240+
| .dynstr | strings of symbols required  |
241+
+------------------+--------------------------------------------------+
242+
| .dynamic | pointer to the relocation section and size |
243+
+------------------+--------------------------------------------------+
244+
| .reldyn | dynamic relocation contains the address of the |
245+
| | symbols need to be patched at run time |
246+
+------------------+--------------------------------------------------+
247+
248+
AIEBU-DUMP Command line utility
249+
===============================
250+
251+
**NAME**
252+
253+
- aiebu-dump
254+
255+
**LOCATION**
256+
257+
- cd <workspace>/aiebu/build/Debug/aiebu/bin
258+
259+
**SYNOPSIS**
260+
261+
- aiebu-dump [OPTION...] positional parameters
262+
263+
-
264+
265+
- aiebu-dump [-a \| --archive-headers ] <filename>
266+
267+
- [-f \| --file-headers ]
268+
269+
- [-x \| --all-headers ]
270+
271+
- [-d \| --disassemble ]
272+
273+
- [-H \| --help ]
274+
275+
- [-m \| --architecture arg ]
276+
277+
- [-D \| --disassemble-all ]
278+
279+
- [-t \| --syms ]
280+
281+
- [-r \| --reloc ]
282+
283+
**DESCRIPTION**
284+
285+
- aiebu-dump is an aiebu dumping utility for AIE binaries and ELF
286+
files. This is used in displaying various sections of the binary
287+
files and ELF files like dumping their headers, displaying specific
288+
sections of the ELF files like symbol tables, relocation entries,
289+
etc.
290+
291+
**OPTIONS**
292+
293+
- -a, --archive-headers Display archive header information
294+
295+
-
296+
297+
- -f, --file-headers Display the contents of the overall file header
298+
299+
-
300+
301+
- -x, --all-headers Display contents of all elf headers plus frequency
302+
of each opcode
303+
304+
- in .ctrltext, .prempt_save and .preempt_restore sections of the elf.
305+
306+
-
307+
308+
- -d, --disassemble Display assembler contents of ctrltext section if
309+
ELF is given as input
310+
311+
- Displays the control packet assembly format if control packet binary
312+
is given as input
313+
314+
-
315+
316+
- -H, --help show help message and exit
317+
318+
-
319+
320+
- -m, --architecture arg Specify the target architecture as MACHINE
321+
322+
- (aie2ps/aie2asm/aie2txn/aie2dpu) (default: unspecified)
323+
324+
- -D, --disassemble-all Display assembler contents of all sections
325+
326+
-
327+
328+
- -t, --syms Display contents of the symbols table(s)
329+
330+
-
331+
332+
- -r, --reloc Display relocation entries in the file
333+
334+
Examples
335+
~~~~~~~~
336+
337+
1. Display all ELF Headers and Opcode frequency
338+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
339+
340+
If the user wants to display ELF Header, Program Header and Section
341+
Headers of an ELF file along with the frequency of each opcode present
342+
in the .ctrltext, .preempt_save and .preempt_restore sections then use
343+
-x options as given below.
344+
345+
The ELF file is given as input and the output is displayed on the
346+
console.
347+
348+
AIEBU-DUMP Command
349+
''''''''''''''''''
350+
351+
- ./aiebu-dump <path_to_filename.elf>/<filename.elf> -x
352+
353+
2. Display Assembly format of .ctrltext section
354+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
355+
356+
If the user wants to display the contents of the control code assembly
357+
in text format then use option -d. This essentially displays the
358+
assembler contents of only the .ctrltext section.
359+
360+
The ELF file is given as input and the output is displayed on the
361+
console.
362+
363+
.. _aiebu-dump-command-1:
364+
365+
AIEBU-DUMP Command
366+
''''''''''''''''''
367+
368+
./aiebu-dump <path_to_filename.elf>/<filename.elf> -d
369+
370+
3. Display Assembly code of all ELF sections
371+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
372+
373+
If the user wants to display the contents of the control code assembly,
374+
premption_save control code assembly and preemption_restore control code
375+
assembly, the control packet unpacking etc in text format then use
376+
option -D. This essentially displays the assembler contents of all
377+
sections of the ELF. This is not implemented yet.
378+
379+
The ELF file is given as input and the output is displayed on the
380+
console.
381+
382+
.. _aiebu-dump-command-2:
383+
384+
AIEBU-DUMP Command
385+
''''''''''''''''''
386+
387+
./aiebu-dump <path_to_filename.elf>/<filename.elf> -D

0 commit comments

Comments
 (0)