Use MemRef to represent pointer #53
jackalcooper
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Inspired by triton-shared, to represent a pointer with a
memrefof dynamic offset, it makes it possible to implement the pointer offset addition. For instance,memref<1xf32, strided<[1], offset: ?>>.How to work with
enifCalling
eniffunctions, likeenif_get_intwhich has a signatureint enif_get_int(ErlNifEnv* env, ERL_NIF_TERM term, int* ip)requires raw pointer. So we need a mechanism to make thealign_ptraccessible at runtime.Here are some options:
memref_to_ptrC function and op. But it is ugly that memref descriptor struct has different layout at different rank.llvm.allocateandptr_to_memref, to cast the memref to one with dynamic offset. The downside is that this can't reuse MLIR's buffer infrastructure.unrealized_conversion_castbuiltin.unrealized_conversion_castandex.aligned_ptrwill be replaced withTensor of pointers
One highlight of Triton which makes it super easy to use is tensor of pointers. With that it is possible to write succinct code with operations like
arrangeto do "batch" indexing, instead of using a loop form. It is import for Charms to also support tensor of pointers and makes it really first-class.Add Pointer
Adding an integer to an index should be syntax sugar for
Pointer.element_ptr.Beta Was this translation helpful? Give feedback.
All reactions