You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Historically emscripten has been built around always using the very latest upstream version of LLVM. Essentially it depends on the top-of-tree version.
However, for the purposes of packaging, reducing install and download size, and making emscripten more portable, it would be nice to start being compatible with the stable version of LLVM.
We have have had many requests for this feature of the years (e.g. #11313)
This would mean more testing since each emscripten release would need to be tested fully against both LLVM stable and LLVM tot. For this reason it probably makes sense to make this move once we fully remove fastcomp (#11319).
The downside is that we will need to add version checks in the emscripten codebase when it depends on new/tot features.
I suggest that we perhaps give this a try starting with LLVM 11. E.g. we support LLVM 11 and tot until LLVM 12 is releases and which point we support LLVM 12 + tot..
Reacted by yowl, b1ue, Alexey Sokolov, Jia Yuan Lo, Poopooracoocoo, munrocket, Avindra Goolcharan, Hash, lin72h, Agriya Khetarpal and 1 more
What will we do when a feature changes to be incompatible with the stable version of LLVM? Should we error out? Have a branch to handle both the old and new behaviors? I guess for unstable features that are changing frequently in upstream LLVM we can just error out eagerly if the LLVM version is not the one we test with.
Alternatively, we could refer people that want to use llvm 11 release to a specific emscripten version that is known to work with that? I.e. if they want to use an LLVM from the past, they can do so with the emscripten from the same time in the past.
If we take that alternative approach I still think it would be nice to test against the actual release versions, rather than just the nearest emscripten release to the release revision.
What will we do when a feature changes to be incompatible with the stable version of LLVM? Should we error out? Have a branch to handle both the old and new behaviors? I guess for unstable features that are changing frequently in upstream LLVM we can just error out eagerly if the LLVM version is not the one we test with.
I'm imagining there will be some places in emscripten where we need to do:
if LLVM_STABLE:
error_out
else:
use_new_feature
Nut hopefully they should be fairly few and far between. The frequency of these divergences should tell is fairly quickly if the approach is a sensible one.
Initially I think the testing burden will be the biggest obstacle we face.
I think if have the CI resources to also test 11 stable, it makes sense to experiment with this. But I think it should be an experiment we are ok with stopping, since it may become too hard to be worthwhile, like if we start to need lots of ifs for what LLVM version is used, as mentioned earlier.
One advantage to testing against 11, once it is stable, is that we don't need to build our own versions of LLVM to test it.. we can just use the official binaries.
I suggest we try to find a sensible subset of tests to run against llvm 11.. perhaps monitoring the areas where we requires 12 and ensuring the subset includes those areas.
I'm worried about picking a subset, if we want to claim we support those binaries officially (do we?). Maybe we can check them less frequently or something, though?
I would imagine that as long its only run a subset of tests we would not claim full support.
Once we ditch fastcomp and can do more testing I think it might be worth increasing the level of testing and officially supporting stable llvm. But I'm not suggesting that now.. .so maybe we should still have some kind of warning message about the lack of full support?
To expand a little on something mentioned earlier without detail: As an approximation to this, I think we can find the LLVM commit closest to a particular release, and then find the emscripten release in which that appeared. That emscripten release should be able to work with the official LLVM release. There are some minor worries like LLVM can change things after branching for release, and the emscripten release may contain more LLVM commits after the release, but it would probably work in most cases.
If we want to try this, then setting up way to test the official release binaries is basically all we need. We can then open a PR here, using the emsdk for the proper emscripten release normally (including binaryen from back then) but replacing LLVM with the release binaries. If that passes I think we can say it's good.
You mean do a one off test that verion X.Y of emscripten works with upstream official binaries from A.B of llvm?
I guess there is some value in that. Setting up testing to bring in the official binaries is main bit of work needed to do that.
I still think there is value is having support on ToT emscripten for at least one stable version of llvm rather than constantly being on ToT LLVM, but I admit that is a lot more work.
knowing what emscripten version we should use if we want to build against llvm x.y (e.g. the emscripten version that used the closest revision to that llvm version) would be useful information as well.
@epozuelo For finding an emscripten version closest to an LLVM release, that should be possible like this:
Find the LLVM git commit on the main branch from which a release branched. I actually don't know LLVM well enough to know how best to do that (e.g. I see a branch llvmorg-19.1.0 but no 19.0.0..?)
Find where that git commit landed in Emscripten. The releases repo contains all the rolls, including from LLVM. grep over git log could find that LLVM git commit, giving us a git commit in the releases repo.
You can then use Emscripten from that commit in the releases repo: ./emsdk install [THAT RELEASES HASH] will work, and given how it was picked, the LLVM there should be the one you want. And you can see in the DEPS file the hashes in the other relevant repos, Emscripten and Binaryen. Using those projects from those commits should match that LLVM.
Find the LLVM git commit on the main branch from which a release branched. I actually don't know LLVM well enough to know how best to do that (e.g. I see a branch llvmorg-19.1.0 but no 19.0.0..?)
For this you would do git merge-base upstream/release/19.x upstream/main in the llvm tree. The result is f2ccf80136a01ca69f766becafb329db6c54c0c8 BTW.
Activity
[-]Support llvm stable releaeses[/-][+]Support llvm stable releases[/+]tlively commentedon Jun 5, 2020
What will we do when a feature changes to be incompatible with the stable version of LLVM? Should we error out? Have a branch to handle both the old and new behaviors? I guess for unstable features that are changing frequently in upstream LLVM we can just error out eagerly if the LLVM version is not the one we test with.
kripken commentedon Jun 5, 2020
Alternatively, we could refer people that want to use llvm 11 release to a specific emscripten version that is known to work with that? I.e. if they want to use an LLVM from the past, they can do so with the emscripten from the same time in the past.
sbc100 commentedon Jun 5, 2020
If we take that alternative approach I still think it would be nice to test against the actual release versions, rather than just the nearest emscripten release to the release revision.
sbc100 commentedon Jun 5, 2020
I'm imagining there will be some places in emscripten where we need to do:
Nut hopefully they should be fairly few and far between. The frequency of these divergences should tell is fairly quickly if the approach is a sensible one.
Initially I think the testing burden will be the biggest obstacle we face.
sbc100 commentedon Jul 15, 2020
Looks like its happening now: #11637
What do you all think about trying to support 11.0 and 12.0 going forward?
Initial support for multiple LLVM versions
kripken commentedon Jul 15, 2020
I think if have the CI resources to also test 11 stable, it makes sense to experiment with this. But I think it should be an experiment we are ok with stopping, since it may become too hard to be worthwhile, like if we start to need lots of ifs for what LLVM version is used, as mentioned earlier.
sbc100 commentedon Jul 15, 2020
One advantage to testing against 11, once it is stable, is that we don't need to build our own versions of LLVM to test it.. we can just use the official binaries.
I suggest we try to find a sensible subset of tests to run against llvm 11.. perhaps monitoring the areas where we requires 12 and ensuring the subset includes those areas.
kripken commentedon Jul 15, 2020
I'm worried about picking a subset, if we want to claim we support those binaries officially (do we?). Maybe we can check them less frequently or something, though?
sbc100 commentedon Jul 15, 2020
I would imagine that as long its only run a subset of tests we would not claim full support.
Once we ditch fastcomp and can do more testing I think it might be worth increasing the level of testing and officially supporting stable llvm. But I'm not suggesting that now.. .so maybe we should still have some kind of warning message about the lack of full support?
sbc100 commentedon Jul 15, 2020
Perhaps we can add this to the FYI bot along with the contrib ports tree?
kripken commentedon Jul 15, 2020
Last two comments sgtm (not claim full support, use the FYI bot).
kripken commentedon Aug 18, 2020
To expand a little on something mentioned earlier without detail: As an approximation to this, I think we can find the LLVM commit closest to a particular release, and then find the emscripten release in which that appeared. That emscripten release should be able to work with the official LLVM release. There are some minor worries like LLVM can change things after branching for release, and the emscripten release may contain more LLVM commits after the release, but it would probably work in most cases.
If we want to try this, then setting up way to test the official release binaries is basically all we need. We can then open a PR here, using the emsdk for the proper emscripten release normally (including binaryen from back then) but replacing LLVM with the release binaries. If that passes I think we can say it's good.
sbc100 commentedon Aug 18, 2020
You mean do a one off test that verion X.Y of emscripten works with upstream official binaries from A.B of llvm?
I guess there is some value in that. Setting up testing to bring in the official binaries is main bit of work needed to do that.
I still think there is value is having support on ToT emscripten for at least one stable version of llvm rather than constantly being on ToT LLVM, but I admit that is a lot more work.
27 remaining items
kripken commentedon Dec 10, 2024
@epozuelo For finding an emscripten version closest to an LLVM release, that should be possible like this:
llvmorg-19.1.0but no 19.0.0..?)./emsdk install [THAT RELEASES HASH]will work, and given how it was picked, the LLVM there should be the one you want. And you can see in the DEPS file the hashes in the other relevant repos, Emscripten and Binaryen. Using those projects from those commits should match that LLVM.sbc100 commentedon Dec 10, 2024
For this you would do
git merge-base upstream/release/19.x upstream/mainin the llvm tree. The result is f2ccf80136a01ca69f766becafb329db6c54c0c8 BTW.Add some minimal testing with LLVM stable (v19)
Add some minimal testing with LLVM stable (v19)
Add some minimal testing with LLVM stable (v19)
Add some minimal testing with LLVM stable (v19)
Add some minimal testing with LLVM stable (v19)
Add some minimal testing with LLVM stable (v19)
Add some minimal testing with LLVM stable (v19)
Add some minimal testing with LLVM stable (v19)
Add some minimal testing with LLVM stable (v19)
Add some minimal testing with LLVM stable (v19)
Add some minimal testing with LLVM stable (v19)
Add initial support LLVM stable (v19)
WASM_WORKERS#24136 as a duplicate of this issue