This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: set wchar_t and wint_t to be unsigned short on windows
Needs RevisionPublic

Authored by yaxunl on Feb 6 2019, 11:06 AM.

Details

Reviewers
b-sumner
compnerd
Summary

In MSVC wchar_t and wint_t are unsigned short. There is static_assert in MSVC headers checking that.

Since HIP and OpenCL share the same device library on windows, we have to define wchar_t and
wint_t to match MSVC on windows.

This should not affect OpenCL since OpenCL does not use wchar_t or wint_t.

Diff Detail

Event Timeline

yaxunl created this revision.Feb 6 2019, 11:06 AM

Maybe there are already other types like this, but it saddens me that an offline compiled code object could potentially not work properly if the application is using any of these types. Or should the runtime try to detect a problem using argument metadata?

compnerd requested changes to this revision.Feb 6 2019, 11:37 AM
compnerd added a subscriber: compnerd.
compnerd added inline comments.
lib/Basic/Targets/AMDGPU.cpp
263

This seems wrong. This means that if you built on Linux, you get a different wchar_t type. You should be checking the triple and setting this accordingly.

This revision now requires changes to proceed.Feb 6 2019, 11:37 AM