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
-
Inspired by triton-shared, to represent a pointer with a
memref
of dynamic offset, it makes it possible to implement the pointer offset addition. For instance,memref<1xf32, strided<[1], offset: ?>>
.How to work with
enif
Calling
enif
functions, likeenif_get_int
which 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_ptr
accessible at runtime.Here are some options:
memref_to_ptr
C function and op. But it is ugly that memref descriptor struct has different layout at different rank.llvm.allocate
andptr_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_cast
builtin.unrealized_conversion_cast
andex.aligned_ptr
will 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
arrange
to 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