Skip to content
This repository has been archived by the owner on Apr 28, 2023. It is now read-only.

max=! fails with inff not known to nvrtc #63

Closed
prigoyal opened this issue Feb 23, 2018 · 5 comments
Closed

max=! fails with inff not known to nvrtc #63

prigoyal opened this issue Feb 23, 2018 · 5 comments
Assignees
Labels
bug Something isn't working high-pri

Comments

@prigoyal
Copy link
Contributor

FAILS
def softmax(float(N, D) I) -> (O, expsum, maxVal) {
        maxVal(n) max=! I(n, d)
        expsum(n) +=! exp(I(n, d) - maxVal(n))
        O(n, d) = exp(I(n, d) - maxVal(n)) / expsum(n)
}
Error: https://gist.github.com/prigoyal/0318a964368f86b3a6a09228c7bfbf71

PASSES (bang removed from max=)
def softmax(float(N, D) I) -> (O, expsum, maxVal) {
        maxVal(n) max= I(n, d)
        expsum(n) +=! exp(I(n, d) - maxVal(n))
        O(n, d) = exp(I(n, d) - maxVal(n)) / expsum(n)
}
@prigoyal prigoyal added bug Something isn't working high-pri labels Feb 23, 2018
@prigoyal
Copy link
Contributor Author

https://gist.github.com/prigoyal/0318a964368f86b3a6a09228c7bfbf71 - it doesn't strictly feel like frontend issue to me. the TC passes semantic analysis etc and then fails at NVRTC compilation but maybe the frontend didn't do the parsing correctly.

@zdevito do you know what's going on here? repro in #61

@abadams
Copy link
Contributor

abadams commented Feb 23, 2018

Oh, it's due to how we codegen inf. The identity of max=! is -inf, which we don't print in a way cuda source would understand.

@abadams
Copy link
Contributor

abadams commented Feb 23, 2018

Anyone know the correct way to write inf in cuda?

@prigoyal
Copy link
Contributor Author

haha, yeah, inff looked very suspicious in first place. https://devtalk.nvidia.com/default/topic/486689/representing-infinity/?offset=3 this seems to denote we could use

const unsigned long long ieee754inf =  0x7ff0000000000000;

so we might need to set this custom type

@prigoyal prigoyal removed the high-pri label Mar 1, 2018
@prigoyal prigoyal changed the title max=! fails to compile max=! fails with inff not known to nvrtc Mar 1, 2018
@prigoyal prigoyal added this to general TC backend in Issue category Mar 6, 2018
@prigoyal
Copy link
Contributor Author

prigoyal commented Mar 7, 2018

cc @boncheol.gu

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working high-pri
Projects
Issue category
general TC backend
Development

No branches or pull requests

4 participants