[all-commits] [llvm/llvm-project] 598e88: [libc] Template the writing mode for the writer cl...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Mar 12 11:52:06 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 598e882ee88a1e3349fb6d8dcd68f6d3b1c6334f
      https://github.com/llvm/llvm-project/commit/598e882ee88a1e3349fb6d8dcd68f6d3b1c6334f
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2025-03-12 (Wed, 12 Mar 2025)

  Changed paths:
    M libc/config/config.json
    M libc/config/gpu/amdgpu/config.json
    M libc/config/gpu/nvptx/config.json
    M libc/docs/configure.rst
    M libc/src/stdio/printf_core/CMakeLists.txt
    M libc/src/stdio/printf_core/char_converter.h
    R libc/src/stdio/printf_core/converter.cpp
    M libc/src/stdio/printf_core/converter.h
    M libc/src/stdio/printf_core/fixed_converter.h
    M libc/src/stdio/printf_core/float_dec_converter.h
    M libc/src/stdio/printf_core/float_hex_converter.h
    M libc/src/stdio/printf_core/float_inf_nan_converter.h
    M libc/src/stdio/printf_core/int_converter.h
    R libc/src/stdio/printf_core/printf_main.cpp
    M libc/src/stdio/printf_core/printf_main.h
    M libc/src/stdio/printf_core/ptr_converter.h
    M libc/src/stdio/printf_core/strerror_converter.h
    M libc/src/stdio/printf_core/string_converter.h
    M libc/src/stdio/printf_core/vasprintf_internal.h
    M libc/src/stdio/printf_core/vfprintf_internal.h
    M libc/src/stdio/printf_core/write_int_converter.h
    R libc/src/stdio/printf_core/writer.cpp
    M libc/src/stdio/printf_core/writer.h
    M libc/src/stdio/snprintf.cpp
    M libc/src/stdio/sprintf.cpp
    M libc/src/stdio/vsnprintf.cpp
    M libc/src/stdio/vsprintf.cpp
    M libc/src/stdlib/str_from_util.h
    M libc/src/stdlib/strfromd.cpp
    M libc/src/stdlib/strfromf.cpp
    M libc/src/stdlib/strfroml.cpp
    M libc/src/time/strftime.cpp
    M libc/src/time/strftime_core/CMakeLists.txt
    M libc/src/time/strftime_core/composite_converter.h
    R libc/src/time/strftime_core/converter.cpp
    M libc/src/time/strftime_core/converter.h
    M libc/src/time/strftime_core/num_converter.h
    M libc/src/time/strftime_core/str_converter.h
    R libc/src/time/strftime_core/strftime_main.cpp
    M libc/src/time/strftime_core/strftime_main.h
    M libc/src/time/strftime_l.cpp
    M libc/test/src/stdio/printf_core/converter_test.cpp
    M libc/test/src/stdio/printf_core/writer_test.cpp
    M libc/utils/gpu/server/CMakeLists.txt
    M libc/utils/gpu/server/rpc_server.cpp

  Log Message:
  -----------
  [libc] Template the writing mode for the writer class (#111559)

Summary:
Currently we dispatch the writing mode off of a runtime enum passed in
by the constructor. This causes very unfortunate codegen for the GPU
targets where we get worst-case codegen because of the unused function
pointer for `sprintf`. Instead, this patch moves all of this to a
template so it can be masked out. This results in no dynamic stack and
uses 60 VGPRs instead of 117. It also compiles about 5x as fast.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list