llvm / llvm/llvm-project

Figure out wide char (s)printf on GPUs

Open
#214,433 2 comments 0 reactions 0 assignees View on GitHub
libc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

#213860 enabled the sprintf_test on the GPUs (which only run hermetic tests), exposing the fact that the wide-char part of the test does not work on these targets:

```
[ RUN ] LlvmLibcSprintfTest.WideCharConversion
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/src/__support/printf_core/generic/error_mapper.h:41: Assertion failed: 'false && "Invalid internal printf error code passed to internal_error_to_errno"' in function: 'int __llvm_libc_24_0_0_git::printf_core::internal_error_to_errno(int)'
```

I'm going to re-disable this part of the test, but this is a short term solution.

For long term, it's unclear to me whether wide chars are *supposed to* work on GPUs or not. If not, then these targets should probably define LIBC_COPT_PRINTF_DISABLE_WIDE. If not, then I guess someone needs to figure out why is this failing.

(@michaelrj-google @jhuber6)

Contributor guide

Open the contributing guide

Research direction

Start with the named LlvmLibcSprintfTest.WideCharConversion test and the failure in libc/src/__support/printf_core/generic/error_mapper.h. Determine whether wide-character printf support is intended for GPU targets, then either verify the relevant LIBC_COPT_PRINTF_DISABLE_WIDE configuration or identify why the test reaches the invalid internal error path.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.