-
Notifications
You must be signed in to change notification settings - Fork 28
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
Codegen cleanup #240
Codegen cleanup #240
Conversation
43a8e09
to
e82e079
Compare
e82e079
to
1866905
Compare
@@ -396,7 +392,7 @@ gemmini_extended_compute_preloaded((uint32_t)(&*(int8_t*)((uint64_t)( ((uint32_t | |||
} | |||
} | |||
if (orow_ii + 7 * orow_io == 0 || false) { | |||
gemmini_extended4_config_ld(((struct exo_win_2i8){ (int8_t*)&inp[(b) * (58 * 58 * 64) + (1 + orow_ii + 7 * orow_io + 28 * orow_o) * (58 * 64) + (2 + 16 * ocol_o) * (64) + (0) * (1)], { 64, 1 } }).strides[0]*1, 1.0f, 0, (16), 2); | |||
gemmini_extended4_config_ld(((struct exo_win_2i8c){ &inp[(b) * (58 * 58 * 64) + (1 + orow_ii + 7 * orow_io + 28 * orow_o) * (58 * 64) + (2 + 16 * ocol_o) * (64) + (0) * (1)], { 64, 1 } }).strides[0]*1, 1.0f, 0, (16), 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does c
stands for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Const
Great changes!! |
Not yet. That will be my next PR or two |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Add
const
to function signaturesWhen a function does not write or accumulate to a parameter it's passed, it should tell the C compiler about this by declaring it
const
. In some cases that can promote inlining or better codegen and definitely improves the ergonomics of using exo functions by allowing callers to declare their local variables const in the first place. It also plays nicer with C's type system generally.Use
void
instead of an empty structThis prevents an actual ABI issue whereby a C compiler is allowed to give such a struct a size of 0, but C++ must give it a size of 1.
Fixes #95
Only generate
_floor_div
and_clamp_32to8
when needed.Self-explanatory. Also uses
exo_
prefixes since leading underscores are generally sketchy in C.