Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 904530 - dev-lang/ruby-3.2*: missing jit on all platforms but amd64/arm64
Summary: dev-lang/ruby-3.2*: missing jit on all platforms but amd64/arm64
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-18 21:47 UTC by Georgy Yakovlev
Modified: 2023-07-22 04:53 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georgy Yakovlev archtester gentoo-dev 2023-04-18 21:47:15 UTC
Ruby3.1 works fine with mjit if I enable USE=jit on ppc64

ruby31 -v --jit
ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) +MJIT [powerpc64le-linux]


apparently $(use_enable jit jit-support ) activates mjit only and skips yjit on such platforms.

ruby-3.2, however, switched to using single useflag to control both jit-support and yjit.

ruby32 -v --jit
ruby32: warning: Ruby was built without JIT support
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [powerpc64le-linux]

yjit only work on amd64 and probably arm64.


I propose separating jit and yjit.


proposal 1:
gate yjit support behind appropriate platform use.
something like
  $(use_enable jit jit-support )
  # yjit depends on rust and is only supported on those arches
  if use amd64 || use arm64; then
    $(use_enable jit yjit )
  fi

the only downside I see is jit- conditional rust dependency on 2 arches and a bit of surprise factor.


proposal 2: introduce yjit useflag, I know this is controversial and flag pollution, but as rust maintainer I know how much hate rust dependency can generate among some users, this will allow getting mjit, and avoiding rust dependency.

proposal 3: same as above, but different - introduce rust useflag so it's more clear, required_use it with jit on supported platforms.
this way users get:
USE="-jit -rust" - no jit, no rust dep.
USE="jit -rust" - mjit, no rust dep.
USE="jit rust" - yjit, rust dep.


all proposals kinda suck in each own way though.

but at least let's start a discussion here.
Comment 1 Hans de Graaff gentoo-dev Security 2023-07-22 04:53:19 UTC
(In reply to Georgy Yakovlev from comment #0)

> ruby-3.2, however, switched to using single useflag to control both
> jit-support and yjit.

Good point, I never considered that when adding ruby 3.2 and also didn't realise initially the number of arches without Rust or that YJIT doesn't work on all of them.

> yjit only work on amd64 and probably arm64.

Yes, amd64 and arm64 are supported for now.

> I propose separating jit and yjit.
> 
> 
> proposal 1:
> gate yjit support behind appropriate platform use.
> something like
>   $(use_enable jit jit-support )
>   # yjit depends on rust and is only supported on those arches
>   if use amd64 || use arm64; then
>     $(use_enable jit yjit )
>   fi

We already use package.use.masks to handle this, so currently the jit USE flag should be masked everywhere except on amd64/arm64. I'm not sure we need to further gate that in the ebuild.

> proposal 2: introduce yjit useflag, I know this is controversial and flag
> pollution, but as rust maintainer I know how much hate rust dependency can
> generate among some users, this will allow getting mjit, and avoiding rust
> dependency.
> 
> proposal 3: same as above, but different - introduce rust useflag so it's
> more clear, required_use it with jit on supported platforms.
> this way users get:
> USE="-jit -rust" - no jit, no rust dep.
> USE="jit -rust" - mjit, no rust dep.
> USE="jit rust" - yjit, rust dep.
> 
> 
> all proposals kinda suck in each own way though.
> 
> but at least let's start a discussion here.

It is pretty clear from Ruby upstream communication about the different JITs that YJIT is going to be the main and recommended JIT compiler. So I would like to keep the "jit" USE flag for enabling YJIT as it is now.

In addition we can introduce an "mjit" USE flag to enable only the MJIT parts.

Alternatively we could overload the "jit" use flag and have it select the "right" jit for the arch, e.g.

  # yjit depends on rust and is only supported on those arches
  if use amd64 || use arm64; then
    $(use_enable jit yjit )
  else
    $(use_enable jit jit-support )
  fi

Probably with some elog output to note this? I'm not sure if that will lead to confusing situations given that the USE flag will do different things depending on the arch. The USE flag description could be something like "Get the best JIT supported for your architecture."