-
Notifications
You must be signed in to change notification settings - Fork 79
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
dialects: (csl) Added operations to manage symbols #2616
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2616 +/- ##
==========================================
- Coverage 89.62% 89.56% -0.06%
==========================================
Files 358 358
Lines 45676 45782 +106
Branches 6888 6920 +32
==========================================
+ Hits 40935 41004 +69
- Misses 3687 3712 +25
- Partials 1054 1066 +12 ☔ View full report in Codecov by Sentry. |
xdsl/dialects/csl.py
Outdated
def _verify_memref_addr(self, val_ty: MemRefType[Attribute], res_ty: PtrType): | ||
res_elem_ty = res_ty.get_element_type() | ||
if res_elem_ty == val_ty.get_element_type(): | ||
if res_ty.kind.data != PtrKind.MANY: | ||
raise VerifyException( | ||
f"The kind of scalar pointer to array has to be {PtrKind.MANY.value}" | ||
) | ||
elif res_elem_ty == val_ty: | ||
if res_ty.kind.data != PtrKind.SINGLE: | ||
raise VerifyException( | ||
f"The kind of array pointer to array has to be {PtrKind.SINGLE.value}" | ||
) | ||
else: | ||
raise VerifyException( | ||
"Contained type of the result pointer must match the contained type of the operand memref or the memref itself" | ||
) |
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.
Can you add a docstring to this method? It seems to be quite complex
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.
This is already pretty neat, I just have a few questions here where I'm not 100% sure if we are modelling it the right way.
%other_global_ptr = "test.op"() : () -> !csl.ptr<i16, #csl<ptr_kind single>, #csl<ptr_const var>> | ||
|
||
"csl.export"() <{var_name = @initialize, type = () -> ()}> : () -> () | ||
"csl.export"() <{var_name = @global_ptr, type = !csl.ptr<f32, #csl<ptr_kind many>, #csl<ptr_const const>>}> : () -> () |
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.
Where is @global_ptr
? I think we should only allow function exporting using symbols, or do we have an op to "bind" a value to a symbol?
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.
I assumed it's possible to declare a global pointer like that in MLIR, but it would make more sense to limit symbols to just function types.
When passing name as string with SSA operand, only pointer types can be used. When passing a symbol ref, only function types.
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.
Nice! Thank you!
This PR adds:
csl.addressof
csl.export
)csl.export
csl.rpc
@rpc
in the language@rpc
was going away in SDK 1.1, but now I can't find a reference to it in the documentation.csl.param