Skip to content
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

WASI Developer Experience Goals #96419

Open
richlander opened this issue Jan 2, 2024 · 11 comments
Open

WASI Developer Experience Goals #96419

richlander opened this issue Jan 2, 2024 · 11 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-Meta os-wasi Related to WASI variant of arch-wasm tracking This issue is tracking the completion of other related issues.
Milestone

Comments

@richlander
Copy link
Member

richlander commented Jan 2, 2024

WASI Developer Experience Goals

WebAssembly System Interface is an exciting technology. Lots of work has already gone into enabling C# with WASI.
dotnet/runtime #65895 defines a set of low-level requirements for providing a working implementation. We can up-level that into a set of developer experience goals.

The following are proposed changes in various categories. Please propose your own.

Related (interview about WASI and C#): https://www.youtube.com/watch?v=fnAjxzMPPqk

Building

  • Remove requirement for runtimeconfig.template file.
  • Enable building single file wasm files by default (which may require installing the WASI SDK with the workload).
  • Enable publishing AOT with a gesture similar to PublishAot.

Running

  • Enable using Wasm runtime args with dotnet run (otherwise dotnet run isn't generally useful).
  • Remove the existing dotnet run "helpful" output.

Programmability

  • Enable importing popular WASI functionality (possibly worlds) as NuGet packages.
  • Import other WASI functionality with a reference to a WIT file.
  • Import Preview 2 components.
  • Enable async with WASI interfaces.
  • Enable HttpClient as-is (particularly for https endpoints).
  • Enable minimal APIs (for handling Web requests).
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 2, 2024
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jan 2, 2024
@jkotas
Copy link
Member

jkotas commented Jan 2, 2024

cc @yowl @silesmo

@jkotas jkotas added the arch-wasm WebAssembly architecture label Jan 2, 2024
@ghost
Copy link

ghost commented Jan 2, 2024

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

WASI Developer Experience Goals

WebAssembly System Interface is an exciting technology. Lots of work has already gone into enabling C# with WASI.
dotnet/runtime #65895 defines a set of low-level requirements for providing a working implementation. We can up-level that into a set of developer experience goals.

The following are proposed changes in various categories. Please propose your own.

Related (interview about WASI and C#): https://www.youtube.com/watch?v=fnAjxzMPPqk

Building

  • Remove requirement for runtimeconfig.template file.
  • Enable building single file wasm files by default (which may require installing the WASI SDK with the workload).
  • Enable publishing AOT with a gesture similar to PublishAot.

Running

  • Enable using Wasm runtime args with dotnet run (otherwise dotnet run isn't generally useful).
  • Remove the existing dotnet run "helpful" output.

Programmability

  • Enable importing popular WASI functionality (possibly worlds) as NuGet packages.
  • Import other WASI functionality with a reference to a WIT file.
  • Import Preview 2 components.
  • Enable async with WASI interfaces.
  • Enable HttpClient as-is (particularly for https endpoints).
  • Enable minimal APIs (for handling Web requests).
Author: richlander
Assignees: -
Labels:

arch-wasm, untriaged, needs-area-label

Milestone: -

@jkotas jkotas added area-Meta and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jan 2, 2024
@ReneeGA2020
Copy link

ReneeGA2020 commented Jan 3, 2024

Enable building single file wasm files by default

Hopefully, it still allow me to do false to opt out. As my workload requires standalone files to be compiled separately.

Also, a question about WIT importing. the WIT file spec does not seem to leave any room for object's 'instance' reference. The 'interface' in WIT were mapped into statics funtions in C#. My understanding is that not all wasm supported language are OOP. Still, it's not so great if I'm a lib wrote by an oop language but I cannot expose an oop method to a consumer lib that was also wrote by n oop language. Not sure if the .NET team will try to do some extra things around that.

@radical radical added the os-wasi Related to WASI variant of arch-wasm label Jan 3, 2024
@yowl
Copy link
Contributor

yowl commented Jan 4, 2024

Not sure if the .NET team will try to do some extra things around that.

This scenario is probably handled in the component model MVP with WIT resources . e.g.

resource blob {
    constructor(init: list<u8>);
    write: func(bytes: list<u8>);
    read: func(n: u32) -> list<u8>;
    merge: static func(lhs: borrow<blob>, rhs: borrow<blob>) -> blob;
}

wit-bindgen for c# does not currently support resources, hopefully this month we will have something.

@jpflueger
Copy link

This is super exciting! I'm not a contributor here but I work at Fermyon and we have a serverless webassembly project called Spin. We've built an SDK around Steve Sanderson's Wasi SDK previously and I have tried to update it for dotnet 8 with some success but I have a couple of suggestions/questions.

It would be nice to be able to use a library project that doesn't require a main function and have the output wasm be a wasi preview 2 component. I think this would be implied by Enable building single file wasm files by default but I just wanted to make sure.

Will Enable minimal APIs (for handling Web requests). be targeting the wasi-http spec (specifically wasi:http/incoming-handler)?

@yowl
Copy link
Contributor

yowl commented Jan 4, 2024

It would be nice to be able to use a library project that doesn't require a main function

This is should be supported now by the NAOT compiler option, I'm not sure where the mono interpreter is with that. However the SDK from Steve needs updating I believe.

Regards HTTP, there is dotnet/runtimelab#2468 where some conversation has taken place, but nothing more as far as I know. Could be there is work internal to Microsoft as I'm just an outside contributor.

@richlander
Copy link
Member Author

Hi @jpflueger! We're well aware of your work on Spin. It would be good to talk about moving the two projects forward in some coordinated way. This includes how spiderlightning fits into the picture.

library project that doesn't require a main function

Yes. That's a good goal / scenario.

minimal APIs

I haven't talked to the Web team, but implementing that on top of wasi-http makes sense to me.

@silesmo
Copy link

silesmo commented Jan 5, 2024

We have the same need at nor2 for wasi-http for our runtime n2. So that's definitely a goal to be able to support @jpflueger.

@ReneeGA2020
Copy link

Speaking of dotnet run, will dotnet test also available for wasi? Or what is Microsoft's plan for best practice of unit testing on wasi?

@flibbertigibbet-uk
Copy link

flibbertigibbet-uk commented Feb 27, 2024

Async between WASI components authored in different language runtimes looks particularly gnarly to implement, at least that was the impression given at the Bytecode Alliance plumbers summit a few weeks ago.

I would gladly accept an interim release minus async support if it enables experimental WASI preview-2 development on .Net 9 a few months earlier.

@tschneidereit
Copy link

@flibbertigibbet-uk the complications around async composition between components shouldn't really impact the toolchain here, which should be able to target the entirety of WASI preview2 without issues.

@lewing lewing added this to the 9.0.0 milestone Apr 1, 2024
@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Apr 1, 2024
@pavelsavara pavelsavara modified the milestones: 9.0.0, 10.0.0 Aug 15, 2024
@pavelsavara pavelsavara added the tracking This issue is tracking the completion of other related issues. label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-Meta os-wasi Related to WASI variant of arch-wasm tracking This issue is tracking the completion of other related issues.
Projects
None yet
Development

No branches or pull requests