Added vpu optimized mean int8#221
Conversation
| stw r4, sp[NSTACKWORDS-1] | ||
| stw r5, sp[NSTACKWORDS-2] | ||
| stw r6, sp[NSTACKWORDS-3] | ||
| stw r7, sp[NSTACKWORDS-4] | ||
| stw r8, sp[NSTACKWORDS-5] | ||
| stw r9, sp[NSTACKWORDS-6] | ||
| stw r10, sp[NSTACKWORDS-7] |
There was a problem hiding this comment.
Could use some stds to save a bit of time.
| #define vpu_buffer r4 | ||
| #define mean_cnt r5 | ||
|
|
||
| ldw vpu_buffer, sp[NSTACKWORDS+1] |
There was a problem hiding this comment.
Looks like this is mean to find a base address within the current stack frame - should it be an ldaw?
There was a problem hiding this comment.
This load the vpu_buffer pointer address passes as the fourth argument of the function.
The vpu buffer is created outside the function, not live within the stack of this function.
There was a problem hiding this comment.
Ah, yes, I see. (Sorry, I forget it's not RISC-V sometimes - where we have 8 argument registers).
| { bau r11 ; nop } | ||
|
|
||
| .cc_bottom FUNCTION_NAME.function | ||
| .set FUNCTION_NAME.nstackwords, NSTACKWORDS+s32_to_f32.nstackwords+round8.nstackwords |
There was a problem hiding this comment.
Should be NSTACKWORDS + (s32_to_f32.nstackwords $M round8.nstackwords) I think (round8 and s32_to_f32 aren't called concurrently.
| .globl FUNCTION_NAME | ||
| .align 16 | ||
| FUNCTION_NAME: | ||
| { dualentsp NSTACKWORDS ; nop } |
There was a problem hiding this comment.
DUALENTSP_lu6 is usually better unless there's a useful instruction you can packetise - that way it takes a single cycle whichever issue mode the function is entered it.
Accelerate mean_int8 when running in xs3 instruction with VPU
mean_int8 will use mean_in8_mean when
Inside mean_int8 it will use s32_to_f32 from xcore_math to quickly convert int32_t data to float.
This PR also provided a 2x faster asm for rounding float to int8_t