This is an archive of the discontinued LLVM Phabricator instance.

[libc] Configure the 'printf' implementation for the GPU
Needs ReviewPublic

Authored by jhuber6 on Aug 21 2023, 9:21 AM.

Details

Summary

The GPU build is attempt to build with printf support. Currently with
D158246 we can compile snprintf and run it. However, this introduces
problems with the long double table and backtracking. This patch adds
the necessary configs to disable the long double table and support for
%n.

The size of the generated binaries is much smaller with this applied so
it's a good first step. We also will want %n disabled for out handling
of printf as it required backtracking.

Diff Detail

Event Timeline

jhuber6 created this revision.Aug 21 2023, 9:21 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 21 2023, 9:21 AM
jhuber6 requested review of this revision.Aug 21 2023, 9:21 AM

Can we do the long double part in the source?

I'm thinking that lots of targets have double and long double as the same type, so we should be able to branch at compile time to cast long double to double and go through the double code path instead

Can we do the long double part in the source?

I'm thinking that lots of targets have double and long double as the same type, so we should be able to branch at compile time to cast long double to double and go through the double code path instead

I brought that up with @michaelrj previously. The GPU build already sets a macro in libc called LONG_DOUBLE_IS_DOUBLE which should also disable the massive long double table. He said he'd work on it, but in general we should probably configure the other stuff anyway.

Yeah that would probably be good for sprintf stuff. Thinking disabling float would be viable as well.