-
Notifications
You must be signed in to change notification settings - Fork 173
Allow passing locks to C code. #288
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,13 +10,15 @@ | |
|
|
||
| #include "kernel.h" | ||
|
|
||
| void func(int32_t *a, int32_t *b) | ||
| void func(int32_t *a, int32_t *b, int64_t lock) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bad for the carbon footprint to have 64 bits here?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes.. this is the main reason why this hasn't been checked in. Today, it's relatively easy to lower from locks to a constant 'index' type in MLIR, but the size of the index type is something 'implementation defined' (by default 64 bits). This really should be cleaner in the lowering to result in something more convenient. |
||
| { | ||
| acquire(lock, 1); | ||
| int val=a[3]; | ||
| int val2=val+val; | ||
| val2 += val; | ||
| val2 += val; | ||
| val2 += val; | ||
| b[5] = val2; | ||
| release(lock, 0); | ||
| } | ||
|
|
||
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.
Perhaps
indexcould be a more precise type depending on the architecture?Or at least lowered to a more precise concrete type before calling the real AIE kernel?