-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[mlir][ptr] Add the ptradd and type_offset ops, and generic_space attr
#136434
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
Conversation
|
@llvm/pr-subscribers-mlir Author: Fabian Mora (fabianmcg) ChangesThis patch adds the Additionally, this patch also adds the Full diff: https://github.com/llvm/llvm-project/pull/136434.diff 8 Files Affected:
|
|
|
gysit
left a comment
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!
This patch adds the `ptr.ptradd` and `ptr.type_offset` operations. Given a `ptr` value these operations can be used to compute new addresses. For example: ```mlir func.func @OPS0(%ptr: !ptr.ptr<#ptr.int_space>) -> !ptr.ptr<#ptr.int_space> { %off = ptr.type_offset f32 : index %res = ptr.ptradd %ptr, %off : !ptr.ptr<#ptr.int_space>, index return %res : !ptr.ptr<#ptr.int_space> } ``` Additionally, this patch also adds the `#ptr.int_space`, a memory space that is identified by a integer. This memory space allows loading and storing values to all types.
Co-authored-by: Mehdi Amini <[email protected]>
gysit
left a comment
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!
LGTM modulo last nits.
Please give others a chance to review before landing.
ptradd and type_offset ops, and int_space attrptradd and type_offset ops, and generic_space attr
Co-authored-by: Tobias Gysi <[email protected]>
Co-authored-by: Tobias Gysi <[email protected]>
…e` attr (llvm#136434) This patch adds the `ptr.ptradd` and `ptr.type_offset` operations. Given a `ptr` value these operations can be used to compute new addresses. For example: ```mlir func.func @OPS0(%ptr: !ptr.ptr<#ptr.int_space>) -> !ptr.ptr<#ptr.int_space> { %off = ptr.type_offset f32 : index %res = ptr.ptradd %ptr, %off : !ptr.ptr<#ptr.int_space>, index return %res : !ptr.ptr<#ptr.int_space> } ``` Additionally, this patch also adds the `#ptr.generic_space`. This memory space allows loading and storing values to all types. --------- Co-authored-by: Mehdi Amini <[email protected]> Co-authored-by: Tobias Gysi <[email protected]>
This patch adds the
ptr.ptraddandptr.type_offsetoperations. Given aptrvalue these operations can be used to compute new addresses. For example:Additionally, this patch also adds the
#ptr.generic_space. This memory space allows loading and storing values to all types.