cutlass icon indicating copy to clipboard operation
cutlass copied to clipboard

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

Open ziyuhuang123 opened this issue 11 months ago • 3 comments

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?

ziyuhuang123 avatar Mar 29 '24 09:03 ziyuhuang123

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

YichengDWu avatar Apr 01 '24 04:04 YichengDWu

@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.

XiaoSong9905 avatar Apr 08 '24 14:04 XiaoSong9905

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.

github-actions[bot] avatar May 08 '24 15:05 github-actions[bot]