Skip to content

Discussion: Which way to go for enabling a wasip3 sysroot? #691

@cpetig

Description

@cpetig

Update :
MR #700 by Alex answered most of these questions and contains a link to my initial implementation for stdout, file read, tcp, and poll.

Dear all,

to enable the use of cooperative threads from C++ we need a wasip3 implementation of files and sockets. I have some initial bits and pieces working together and would like to discuss a way to upstream these.

My thoughts and questions are roughly:

  • A wasip3 compiler target isn't necessary for this as all WASI calls happen from within libc. The available wasm32-wasip2 target can already handle this with a custom sysroot. Do we need a wasip3 compiler target? And does a non-cooperative-threaded libc target for p3 make any sense?
  • Using the classical Makefile doesn't make much sense with CMake ready in Migrate the Makefile to CMake #685 , but CMake uses the target triple to deduct the WASI variable (perhaps CMakefile.txt should be changed to not override WASI from the target triple?) My working example specifies WASI=p3 on the make command line. How should this work with cmake?
  • I fully separated the names for p3 (wall_clock3_datetime_t) from the names for p2 (wall_clock_datetime_t) by binding renames to detect remaining uses of the wrong symbols. I see both upsides and downsides to having a disjunct set of symbols between wasip2.h and wasip3.h. Any thoughts?
  • Converting the blocking C API to using asynchronous p3 calls together with waitable-set.wait calls works just fine for my purpose. But perhaps the p3 (stream) handles could enable uses outside of libc, e.g. via __get_osfhandle.
  • I understood that @TartanLlama is currently working on the threading infrastructure for p3, so there should be little overlap between our work, but having a common compilation target in place simplifies cooperation. This is what this aims for, I will prepare a PR but would like to avoid unnecessary re-work by discussing here first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions