Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional advice when setting up HWLoops. #932

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/source/corev_hw_loop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ Below an assembly code example of a nested HWLoop that computes a matrix additio
asm volatile (
"add %[i],x0, x0;"
"add %[j],x0, x0;"
"cv.count 1, %[N];"
".balign 4;"
"cv.endi 1, endO;"
"cv.starti 1, startO;"
"cv.count 1, %[N];"
"any instructions here"
".balign 4;"
"cv.endi 0, endZ;"
Expand All @@ -128,6 +128,7 @@ Below an assembly code example of a nested HWLoop that computes a matrix additio
: [N] "r" (10)
);

As HWLoop feature is enabled as soon as lpcountX > 0, it is a good practice to set lpstartX and lpendX **before** lpcountX to avoid unexpected behavior. For HWLoop where body contains up to 30 instructions, it is always better to use cv.setup* instructions which are updating all 3 HWLoop CSRs in the same cycle.

At the beginning of the HWLoop, the registers %[i] and %[j] are 0.
The innermost loop, from startZ to (endZ - 4), adds to %[i] three times 1 and
Expand Down
Loading