This is an archive of the discontinued LLVM Phabricator instance.

[HIP] Fix amdgcn builtin for long type
ClosedPublic

Authored by yaxunl on Jun 2 2021, 3:31 PM.

Details

Summary

Currently some amdgcn builtins are defined with long int type,
which causes invalid IR on Windows since long int is 32 bit
on Windows whereas these builtins have 64 bit arguments.

long long int type cannot be used since it is 128 bit in OpenCL.

This patch uses 64 bit int type instead of long int to define 64 bit int
arguments or return for amdgcn builtins.

Diff Detail

Event Timeline

yaxunl created this revision.Jun 2 2021, 3:31 PM
yaxunl requested review of this revision.Jun 2 2021, 3:31 PM
tra accepted this revision.Jun 2 2021, 3:34 PM
This revision is now accepted and ready to land.Jun 2 2021, 3:34 PM
yaxunl updated this revision to Diff 349566.Jun 3 2021, 8:54 AM
yaxunl edited the summary of this revision. (Show Details)

fixed regressions with OpenCL. Use fixed length 64 bit int type instead of long long type

yaxunl added a comment.Jun 3 2021, 8:56 AM

I got regressions in OpenCL tests since long long int is 128 bit in OpenCL. I switched to use W as width modifier in builtin definitions since W is for fixed-length 64 bit int type.

tra accepted this revision.Jun 3 2021, 9:56 AM

Still LGTM.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 3 2021, 4:06 PM

If you want a way to say "some 64-bit type" in the builtins file, we could add that.

yaxunl added a comment.Jun 3 2021, 8:12 PM

If you want a way to say "some 64-bit type" in the builtins file, we could add that.

It is already there. The width modifier W means 64-bit.