Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ziyuhuang123 opened this issue Mar 29, 2024 · 3 comments
Open

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

ziyuhuang123 opened this issue Mar 29, 2024 · 3 comments

Comments

@ziyuhuang123
Copy link

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
Copy link

YichengDWu commented Apr 1, 2024

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

@XiaoSong9905
Copy link

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

Copy link

github-actions bot commented May 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants