[libc-commits] [PATCH] D151282: [libc] Add initial support for 'puts' and 'fputs' to the GPU

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue May 30 10:36:23 PDT 2023


jhuber6 added inline comments.


================
Comment at: libc/src/__support/File/file.h:24
+// out the buffering portions of the code in the general implementation.
+constexpr bool buffer_disabled() {
+#if defined(LIBC_TARGET_ARCH_IS_GPU)
----------------
lntue wrote:
> Since most of the usage of this constexpr function is kind of double-negative form `if ( !buffer_disabled() )`, I think it is better to define this as a `static constexpr` member of class `File`, and change the name to positive form like `File::USE_BUFFER`, `File::ENABLE_BUFFER` or something like that.
Yeah that might make it more readable. Is @sivachandra okay with this somewhat hacky workaround? We cannot compile otherwise due to the GPU backend's not allowing circular references, i.e. initializers that use offsets from itself. Also this gets the resource usage within acceptable levels.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151282/new/

https://reviews.llvm.org/D151282



More information about the libc-commits mailing list