Commit 154959b1 by abergeron Committed by Tianqi Chen

Fix long for windows in cuda (#700)

* Use long long for platforms where long is 32 bits (like windows).

* Make sure scalar chars are signed.

* Re-add NOLINT marker.
parent 3dfb8459
......@@ -77,13 +77,28 @@ void CodeGenCUDA::PrintType(Type t, std::ostream& os) { // NOLINT(*)
os << "int"; return;
}
switch (t.bits()) {
case 8: os << "char"; break;
case 8: {
if (!t.is_uint() && t.lanes() == 1) {
os << "signed char"; break;
} else {
os << "char"; break;
}
}
case 16: os << "short"; break;
case 32: os << "int"; break;
case 64: {
CHECK(sizeof(long) == 8) // NOLINT(*)
<< "CUDA not support int64 int in 32 bit system";
os << "long"; break;
if (sizeof(long) != 8) { // NOLINT(*)
if (t.lanes() == 1) {
os << "long long"; break;
} else if (t.lanes() == 2) {
os << "longlong"; break;
} else {
// No longlong3, longlong4
LOG(FATAL) << "Cannot convert type " << t << " to CUDA type on a L32 platform";
}
} else {
os << "long"; break;
}
}
case 1: os << "int"; break;
default: fail = true; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment