Skip to content

Support llvm stable releases #11362

Open

Description

@sbc100

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..

Activity

  1. changed the title [-]Support llvm stable releaeses[/-] [+]Support llvm stable releases[/+] on Jun 5, 2020
  2. tlively commented on Jun 5, 2020

    @tlively
    Member

    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.

  3. kripken commented on Jun 5, 2020

    @kripken
    Member

    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.

  4. sbc100 commented on Jun 5, 2020

    @sbc100
    CollaboratorAuthor

    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.

  5. sbc100 commented on Jun 5, 2020

    @sbc100
    CollaboratorAuthor

    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.

  6. sbc100 commented on Jul 15, 2020

    @sbc100
    CollaboratorAuthor

    Looks like its happening now: #11637

    What do you all think about trying to support 11.0 and 12.0 going forward?

  7. kripken commented on Jul 15, 2020

    @kripken
    Member

    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.

  8. sbc100 commented on Jul 15, 2020

    @sbc100
    CollaboratorAuthor

    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.

  9. kripken commented on Jul 15, 2020

    @kripken
    Member

    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?

  10. sbc100 commented on Jul 15, 2020

    @sbc100
    CollaboratorAuthor

    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?

  11. sbc100 commented on Jul 15, 2020

    @sbc100
    CollaboratorAuthor

    Perhaps we can add this to the FYI bot along with the contrib ports tree?

  12. kripken commented on Jul 15, 2020

    @kripken
    Member

    Last two comments sgtm (not claim full support, use the FYI bot).

  13. kripken commented on Aug 18, 2020

    @kripken
    Member

    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.

  14. sbc100 commented on Aug 18, 2020

    @sbc100
    CollaboratorAuthor

    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.

  15. 27 remaining items

  16. kripken commented on Dec 10, 2024

    @kripken
    Member

    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.
  17. sbc100 commented on Dec 10, 2024

    @sbc100
    CollaboratorAuthor
    • 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.

  18. added 12 commits that reference this issue on Jan 6, 2025
    9653a64
    ff2de2b
    843fbcb
    a6749d6
    9a7867a
    ce30046
    5d918c9
    549270c
    d7f614e
    208a081
    d26814e
    341e31a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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