This is an archive of the discontinued LLVM Phabricator instance.

[libc] Support the string conversion methods on the GPU
ClosedPublic

Authored by jhuber6 on Apr 26 2023, 4:39 PM.

Details

Summary

This patch enables us to use the existing libc support for string
conversion functions on the GPU. This required setting the fenv_t and
long double configuration. As far as I am aware, long doubles are
converted to doubles on the GPU and the floating point environment is
just an uint32_t.

This code is still untested as we are still working out how to run the
unit tests on the GPU.

Diff Detail

Event Timeline

jhuber6 created this revision.Apr 26 2023, 4:39 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 26 2023, 4:39 PM
jhuber6 requested review of this revision.Apr 26 2023, 4:39 PM

LGTM with a nit.

libc/src/__support/FPUtil/PlatformDefs.h
20

Nit: given the precedent of putting a comment with a link to the relevant documentation above, it would be nice to have a link to the AMD or Nvidia documentation saying they use long double as double.

jhuber6 updated this revision to Diff 517398.Apr 26 2023, 5:15 PM

I found documentation for AMD, for CUDA it will simply emit a warning if you use long double with cudafe.

jhuber6 updated this revision to Diff 517406.Apr 26 2023, 5:38 PM

Change to struct.

michaelrj accepted this revision.Apr 27 2023, 4:42 PM
This revision is now accepted and ready to land.Apr 27 2023, 4:42 PM
This revision was landed with ongoing or failed builds.Apr 27 2023, 6:32 PM
This revision was automatically updated to reflect the committed changes.