Skip to content

[libc] Implement more input functions on the GPU #66288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions libc/config/gpu/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.errno.errno

# stdio.h entrypoints
libc.src.stdio.feof
libc.src.stdio.ferror
libc.src.stdio.clearerr
libc.src.stdio.puts
libc.src.stdio.fopen
libc.src.stdio.fclose
Expand All @@ -95,6 +98,10 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.stdio.fputc
libc.src.stdio.putc
libc.src.stdio.putchar
libc.src.stdio.fgets
libc.src.stdio.fgetc
libc.src.stdio.getc
libc.src.stdio.getchar
libc.src.stdio.stdin
libc.src.stdio.stdout
libc.src.stdio.stderr
Expand Down
7 changes: 7 additions & 0 deletions libc/docs/gpu/support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ stdio.h
============= ========= ============
Function Name Available RPC Required
============= ========= ============
feof |check| |check|
ferror |check| |check|
clearerr |check| |check|
fgetc |check| |check|
fgets |check| |check|
getc |check| |check|
getchar |check| |check|
puts |check| |check|
fputs |check| |check|
fputc |check| |check|
Expand Down
3 changes: 3 additions & 0 deletions libc/include/llvm-libc-types/rpc_opcodes_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ typedef enum : unsigned short {
RPC_FREE = 10,
RPC_HOST_CALL = 11,
RPC_ABORT = 12,
RPC_FEOF = 13,
RPC_FERROR = 14,
RPC_CLEARERR = 15,
} rpc_opcode_t;

#endif // __LLVM_LIBC_TYPES_RPC_OPCODE_H__
173 changes: 10 additions & 163 deletions libc/src/stdio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,169 +29,6 @@ endif()
add_subdirectory(printf_core)
add_subdirectory(scanf_core)

add_entrypoint_object(
clearerr
SRCS
clearerr.cpp
HDRS
clearerr.h
DEPENDS
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
clearerr_unlocked
SRCS
clearerr_unlocked.cpp
HDRS
clearerr_unlocked.h
DEPENDS
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
feof
SRCS
feof.cpp
HDRS
feof.h
DEPENDS
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
feof_unlocked
SRCS
feof_unlocked.cpp
HDRS
feof_unlocked.h
DEPENDS
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
ferror
SRCS
ferror.cpp
HDRS
ferror.h
DEPENDS
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
ferror_unlocked
SRCS
ferror_unlocked.cpp
HDRS
ferror_unlocked.h
DEPENDS
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
fgetc
SRCS
fgetc.cpp
HDRS
fgetc.h
DEPENDS
libc.src.errno.errno
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
fgetc_unlocked
SRCS
fgetc_unlocked.cpp
HDRS
fgetc_unlocked.h
DEPENDS
libc.src.errno.errno
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
getc
SRCS
getc.cpp
HDRS
getc.h
DEPENDS
libc.src.errno.errno
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
getc_unlocked
SRCS
getc_unlocked.cpp
HDRS
getc_unlocked.h
DEPENDS
libc.src.errno.errno
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
getchar
SRCS
getchar.cpp
HDRS
getchar.h
DEPENDS
libc.src.errno.errno
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
getchar_unlocked
SRCS
getc_unlocked.cpp
HDRS
getc_unlocked.h
DEPENDS
libc.src.errno.errno
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
fgets
SRCS
fgets.cpp
HDRS
fgets.h
DEPENDS
libc.src.errno.errno
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)

add_entrypoint_object(
fflush
SRCS
Expand Down Expand Up @@ -470,6 +307,9 @@ add_entrypoint_object(
)

# These entrypoints have multiple potential implementations.
add_stdio_entrypoint_object(feof)
add_stdio_entrypoint_object(ferror)
add_stdio_entrypoint_object(clearerr)
add_stdio_entrypoint_object(fopen)
add_stdio_entrypoint_object(fclose)
add_stdio_entrypoint_object(fread_unlocked)
Expand All @@ -481,6 +321,13 @@ add_stdio_entrypoint_object(fwrite)
add_stdio_entrypoint_object(fputc)
add_stdio_entrypoint_object(putc)
add_stdio_entrypoint_object(putchar)
add_stdio_entrypoint_object(fgetc)
add_stdio_entrypoint_object(fgetc_unlocked)
add_stdio_entrypoint_object(getc)
add_stdio_entrypoint_object(getc_unlocked)
add_stdio_entrypoint_object(getchar)
add_stdio_entrypoint_object(getchar_unlocked)
add_stdio_entrypoint_object(fgets)
add_stdio_entrypoint_object(stdin)
add_stdio_entrypoint_object(stdout)
add_stdio_entrypoint_object(stderr)
Loading