NVIDIA / cutlass

CUDA Templates for Linear Algebra Subroutines
Other
5.44k stars 922 forks source link

[QST] In cute, when should we use int<> and when should not? #1441

Closed ziyuhuang123 closed 2 months ago

ziyuhuang123 commented 6 months ago

What is your question?

// ((_3,2),(2,_5,_2)):((4,1),(_2,13,100))
Tensor A = make_tensor(ptr, make_shape (make_shape (Int<3>{},2), make_shape (       2,Int<5>{},Int<2>{})),
                            make_stride(make_stride(       4,1), make_stride(Int<2>{},      13,     100)));

// ((2,_5,_2)):((_2,13,100))
Tensor B = A(2,_);

// ((_3,_2)):((4,1))
Tensor C = A(_,5);

// (_3,2):(4,1)
Tensor D = A(make_coord(_,_),5);

// (2,2,_2):(1,_2,100)
Tensor E = A(make_coord(2,_),make_coord(_,3,_));

It seems that using int<> will be "static and benefitial for compiler's optimization? But when should I use it?

YichengDWu commented 6 months ago

Typically you don't know the size of the input tensors, (M, N, K) are dynamic. Other things static.

XiaoSong9905 commented 5 months ago

@ziyuhuang123 General advice is to use Int<X> or _X constexpr when possible (e.g. gemm tilesize, etc). For dynamic values (gemm problem size as @YichengDWu pointed out), u should use string literal.

github-actions[bot] commented 4 months ago

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.