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

cmd/compile: thread support for webassembly #28631

Open
sleagon opened this issue Nov 7, 2018 · 22 comments
Open

cmd/compile: thread support for webassembly #28631

sleagon opened this issue Nov 7, 2018 · 22 comments
Labels
arch-wasm WebAssembly issues compiler/runtime Issues related to the Go compiler and/or runtime. FeatureRequest NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@sleagon
Copy link

sleagon commented Nov 7, 2018

What version of Go are you using (go version)?

$ go version
go version go1.11.1 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/sion/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/sion/go1.X"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/6z/bfzgs4bs75bdjmr9c7dggct40000gn/T/go-build090156779=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

It is very nice to use goroutine browsers, WebAssembly Threads ready to try in Chrome 70. I found no related issues here, so i just add this issue.

What did you expect to see?

Thread feature supported in xx.wasm.

What did you see instead?

Not supported in chromium 72.

@agnivade agnivade changed the title Thread support for webassembly in chrome 70+? cmd/compile: thread support for webassembly Nov 7, 2018
@agnivade agnivade added FeatureRequest arch-wasm WebAssembly issues labels Nov 7, 2018
@agnivade agnivade added this to the Unplanned milestone Nov 7, 2018
@agnivade
Copy link
Contributor

agnivade commented Nov 7, 2018

I guess it would have been done anyways at some point. But thanks for filing an issue.

@neelance
Copy link
Member

Related: #28360 on the policy of adopting new WebAssembly features.

@neelance
Copy link
Member

I will wait at least until the proposal gets to phase 3 before I start working on it: https://github.com/WebAssembly/proposals

@BenLubar
Copy link

Although the proposal is not yet officially in phase 3, most major browsers (with the exception of Safari) have been shipping with WASM threads enabled for the past few versions.

https://www.chromestatus.com/feature/5724132452859904
https://bugzilla.mozilla.org/show_bug.cgi?id=1389458

Note that using WASM threads does require setting some HTTP headers due to Spectre:

https://caniuse.com/sharedarraybuffer

I suggest that support for threads be added to Go with a GOWASM=threads (or similar) compiler option, like how satconv and signext are currently implemented.

@dr2chase dr2chase added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jun 4, 2021
@cocotyty
Copy link

Any news?

@ibudisteanu
Copy link

ibudisteanu commented Sep 28, 2021

@BenLubar is multi threading supported by modern browsers when compiling go into wasm ? Or when is this proposal to be added ?

@intel352
Copy link

intel352 commented Dec 3, 2021

I will wait at least until the proposal gets to phase 3 before I start working on it: https://github.com/WebAssembly/proposals

Out of curiosity, how much effort do you anticipate this will require to implement, assuming the current proposal makes it to phase 3?

@ibudisteanu
Copy link

Has there been any updates regarding support for multi-threading in webassembly. I think this is the only feature missing right now and definitely it is really important. Wasm is useful mostly for heavy computations, because otherwise in most cases wasm is slower as the js dom operations are quite slow. But for heavy computations, multi threading is a must to have.

@skimhugo
Copy link

Due to this WebAssembly/threads#163, this proposal may never be stage 3. But according to the issue above, browsers already did their job.

@skimhugo
Copy link

Though rust is now first class citizen in wasm world, but I still think when go can support thread natively, go will be No.1 wasm player in more high level business code area.

@ibudisteanu
Copy link

ibudisteanu commented Apr 14, 2022

Such a pity for not having multi threading support in go wasm. It renders most wasm application useless, as javascript I think will be faster (if not comparable) to go wasm.

@ntindle
Copy link

ntindle commented Jun 28, 2022

It seems the thing blocking it from moving to phase 3 is tests. Is there someone with skills who would like to help?

Also see: https://github.com/WebAssembly/threads

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
@garet90
Copy link
Contributor

garet90 commented Oct 17, 2022

It looks like they are planning to vote on whether to move the threads proposal into stage 3 later this month

@ibudisteanu
Copy link

Amazing news!

@aykevl
Copy link

aykevl commented Oct 18, 2022

From my understanding, that proposal isn't really about threads. It's about atomics. Threads are supposed to be provided by the environment (WebWorkers for example).

@conrad-watt
Copy link

Dropping in to say that Wasm Threads are now phase 3!

@gopherbot
Copy link

Change https://go.dev/cl/463743 mentions this issue: runtime: add wasm atomic operations

@Sanscripter
Copy link

Any news on this?

@gedw99
Copy link

gedw99 commented Apr 27, 2023

Is it officially part of wasm spec now ?

@Peder2911
Copy link

Curious about this as well. What is needed?

@luiscastro193
Copy link

Is something blocking this?

@alexristinmaa
Copy link

Threads are now Phase 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly issues compiler/runtime Issues related to the Go compiler and/or runtime. FeatureRequest NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests