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

[browser][JSImport] Support for marshaling float memory views #97380

Open
pavelsavara opened this issue Jan 23, 2024 · 4 comments
Open

[browser][JSImport] Support for marshaling float memory views #97380

pavelsavara opened this issue Jan 23, 2024 · 4 comments
Labels
arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript feature-request help wanted [up-for-grabs] Good issue for external contributors os-browser Browser variant of arch-wasm
Milestone

Comments

@pavelsavara
Copy link
Member

pavelsavara commented Jan 23, 2024

Support for float[], Span<Single> and ArraySegment<Single> in [JSImport]/[JSExport]

As requested in #97268

@pavelsavara pavelsavara added this to the 9.0.0 milestone Jan 23, 2024
@pavelsavara pavelsavara self-assigned this Jan 23, 2024
@ghost
Copy link

ghost commented Jan 23, 2024

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

Issue Details

Support for Span<Single> and ArraySegment<Single> in [JSImport]/[JSExport]

As requested in #97268

Author: pavelsavara
Assignees: pavelsavara
Labels:

arch-wasm, feature-request, area-System.Runtime.InteropServices.JavaScript, os-browser

Milestone: 9.0.0

@pavelsavara
Copy link
Member Author

cc @eeegs

@eeegs
Copy link

eeegs commented Jan 24, 2024

Please include arrays too - float[].

Thankyou for looking at this. Taking a quick look at the various WASM doco and the WebGPU API, the ability to move data across the .Net/WASM/JavaScript divide with as little ceremony and no transformation is important for performant apps. If we want C# to be a top contender we have to deal with this.

What is stopping the full range of javascript TypedArrays being supported? (sans clamped ones)?

Can we discuss the mechanisms involved?

@pavelsavara
Copy link
Member Author

pavelsavara commented Jan 24, 2024

Please include arrays too - float[].

Added above.

Can we discuss the mechanisms involved?

Mostly, this could be nice copy & paste PR from contributor (hint hint ..).
You just follow example of double.

There is

  • C# public API of the runtime in System.Runtime.InteropServices.JavaScript , this needs to pass API review process.

    • That's separate github issue, once you have working draft in a PR.
    • (some of this is for the code generator to use)
  • Update the code generator.

  • C# methods for the generated code marshaler

  • Update the JS side of the marshaler for array, segment

  • update unit tests, more

  • update docs,

This is not exhaustive list, but I guess if you understand the pattern you will be able to follow it and find all places.

What is stopping the full range of javascript TypedArrays being supported? (sans clamped ones)?

Other priorities, and also so far nobody asked for it. If you plan to work on it, please start with float and see if you can deliver that before you broaden your scope.

Just to make it clear, what you get for double already is TypedArray, it's view or simple wrapper around it.

@pavelsavara pavelsavara added the help wanted [up-for-grabs] Good issue for external contributors label May 14, 2024
@pavelsavara pavelsavara modified the milestones: 9.0.0, Future May 14, 2024
@pavelsavara pavelsavara removed their assignment May 14, 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-System.Runtime.InteropServices.JavaScript feature-request help wanted [up-for-grabs] Good issue for external contributors os-browser Browser variant of arch-wasm
Projects
None yet
Development

No branches or pull requests

2 participants