Skip to content

Support Zinc pipelining #19743

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

Closed
bishabosha opened this issue Feb 20, 2024 · 3 comments · Fixed by #18880
Closed

Support Zinc pipelining #19743

bishabosha opened this issue Feb 20, 2024 · 3 comments · Fixed by #18880

Comments

@bishabosha
Copy link
Member

bishabosha commented Feb 20, 2024

support ThisBuild/usePipelining := true in sbt for Scala 3 projects.

Requirements

  • add -Ypickle-java and -Ypickle-write flags, expected by Zinc when pipelining is enabled in sbt.
  • presence of -Ypickle-write <destination> arguments requires that TASTy files are written early to that destination (ASAP after pickler)
  • apiPhaseCompleted and dependencyPhaseCompleted Zinc callbacks must be called as soon as TASTy is fully written, which will activate early downstream compilation.
  • call generatedNonLocalClass callback before TASTy writing, which is necessary for Zinc to run the incremental algorithm early.
  • -Ypickle-java flag is a directive to include TASTy for Java sources in the -Ypickle-write destination (not in the final compiler outputs)

Compatibility

All functionality is observable only under -Y flags, so this isn't a breaking change

@Gedochao Gedochao assigned bishabosha and unassigned Gedochao Feb 20, 2024
bishabosha added a commit that referenced this issue Apr 4, 2024
This includes support for a single pass pipelined build, compatible with
sbt's `ThisBuild/usePipelining`,
- adds `-Ypickle-java` and `-Ypickle-write` flags, expected by Zinc when
pipelining is enabled in sbt.
- when `-Ypickle-write <directory|jar>` is set, then write tasty from
pickler to that output, (building upon
#19074 support for Java signatures
in TASTy files).
- call `apiPhaseCompleted` and `dependencyPhaseCompleted` callbacks,
which will activate early downstream compilation
- calls `generatedNonLocalClass` callbacks early, which enables Zinc to
run the incremental algorithm before starting downstream compilation
(including checking for macro definitions).

generally this can be reviewed commit-by-commit, as they each do an
isolated feature.

As well as many tests in the `sbt-test/pipelining` directory, this has
also been tested locally on `akka/akka-http`, `apache/incubator-pekko`,
`lichess-org/lila`, `scalacenter/scaladex`, `typelevel/fs2`,
`typelevel/http4s`, `typelevel/cats`, `slick/slick`.

This PR sets the ground work for an optional 2-pass compile (reusing the
`OUTLINEattr`), which should use a faster frontend (skipping rhs when
possible) before producing tasty signatures

fixes #19743
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
@goshacodes
Copy link

Hi! Can we expect this to be backported to LTS some day?

@WojciechMazur
Copy link
Contributor

WojciechMazur commented Nov 25, 2024

Hi! Can we expect this to be backported to LTS some day?

We were considering it, however, the effort to enable pipelining spans over multiple PRs, some of these might be problematic to backport. Right now it seems unlikely it would be backported. We're considering having a new LTS series somewhere in Q4 2025 thus it might be even more likely to be backported.

@bishabosha
Copy link
Member Author

bishabosha commented Nov 25, 2024

It would need a redesign because it specifically uses a new TASTy feature to implement (Attributes section), meaning its problematic to consume from an older compiler in the same LTS. perhaps like with .betasty it could be achieved with a new file extension, but then older compilers would still be unaware - sbt plugin could enforce a minimum LTS version maybe?.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants