Skip to content

How to correctly use cute::copy to transfer 4bit data ? #1867

Closed Answered by ccecka
luliyucoordinate asked this question in Q&A
Discussion options

You must be logged in to vote

This is a C/C++ thing, not really a CuTe thing. In C/C++, int4b_t* is a pointer to int4b_ts with underlying storage of int8_t. CuTe cannot assume that this pointer means "packed" (2x int4b_t within each int8_t) safely. This is the reason why array_subbyte.data() has been removed from CuTe's array_subbyte container (But apparently not CUTLASS's) -- it is dangerous and error-prone to use these naked pointers that don't mean what you think they mean.

You can create a packed CuTe tensor by specifying the logical data type you're working with:

Tensor mA = make_tensor(make_gmem_ptr<uint4b_t>(my_ptr), my_layout_of_4b);

which creates a "packed" pointer from my_ptr. Similarly with rmem or smem:

Te…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@luliyucoordinate
Comment options

Answer selected by luliyucoordinate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants