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

ldiv! invokes undefined behavior when calling m_thread_block_size with nthreads == static(0). #26

Closed
KristofferC opened this issue Dec 22, 2022 · 1 comment

Comments

@KristofferC
Copy link

KristofferC commented Dec 22, 2022

div_dispatch!(transpose(C), transpose(A), transpose(parent(U)), static(0), Val(true))
and many more places ends up calling m_thread_block_size with nthreads == static(0).

The compiler can then prove that

min(M, VectorizationBase.vcld(M, nb*W)*W)

is called as VectorizationBase.vcld(M, 0) (which ends up calling Base.sdiv_int(x, 0) which is undefined behavior https://llvm.org/docs/LangRef.html#sdiv-instruction) and returns llvm's poison value.

Maybe this should just have been static(1)?

@chriselrod
Copy link
Member

Yeah, definitely looks like it should have been 1.

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

No branches or pull requests

2 participants