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

fix equal checks for cells and output #8721

Merged
merged 2 commits into from
Jul 15, 2024
Merged

fix equal checks for cells and output #8721

merged 2 commits into from
Jul 15, 2024

Conversation

sokra
Copy link
Member

@sokra sokra commented Jul 11, 2024

Description

  • Check for equal Vc on returning a value
  • Avoid PartialEq checks for values that are never equal

Testing Instructions

@sokra sokra requested a review from a team as a code owner July 11, 2024 06:23
Copy link

vercel bot commented Jul 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2024 6:24am
rust-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2024 6:24am
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Jul 11, 2024 6:24am
examples-designsystem-docs ⬜️ Ignored (Inspect) Jul 11, 2024 6:24am
examples-gatsby-web ⬜️ Ignored (Inspect) Jul 11, 2024 6:24am
examples-kitchensink-blog ⬜️ Ignored (Inspect) Jul 11, 2024 6:24am
examples-native-web ⬜️ Ignored (Inspect) Jul 11, 2024 6:24am
examples-svelte-web ⬜️ Ignored (Inspect) Jul 11, 2024 6:24am
examples-tailwind-web ⬜️ Ignored (Inspect) Jul 11, 2024 6:24am
examples-vite-web ⬜️ Ignored (Inspect) Jul 11, 2024 6:24am

@@ -43,7 +43,7 @@ pub trait GenerateSourceMap {
/// The distinction between the source map spec's [sourcemap::Index] and our
/// [SourceMap::Sectioned] is whether the sections are represented with Vcs
/// pointers.
#[turbo_tasks::value(shared)]
#[turbo_tasks::value(shared, cell = "new")]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cell = "new" changes the behavior of .cell() to no longer perform an == check and just always override the cell.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we determine which cells should always be overridden?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you don't want cells to ever match using equality? Which I imagine should be never unless you've got another bug (e.g. inconsistent cell creation order?).

I agree this seems weird and like we're masking bigger problems.

Copy link
Member Author

@sokra sokra Jul 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you don't want cells to ever match using equality?

  • some types have very expensive equal checks and are very unlikely to be equal (e. g. the parsed AST or the SourceMap)
  • some types don't have a equality defined
  • some types define equality in a way that it never matches

But in general you want to check equality for early stop bubbling invaliations...

Copy link
Contributor

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Comment on lines +59 to +62
if let OutputContent::Link(old_target) = &self.content {
if *old_target == target {
// unchanged
return;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can early return when returning the same value again.

Previously this notified all dependent tasks, which is unnecessary.

Copy link
Contributor

✅ This change can build next-swc

Copy link
Contributor

github-actions bot commented Jul 11, 2024

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

@@ -43,7 +43,7 @@ pub trait GenerateSourceMap {
/// The distinction between the source map spec's [sourcemap::Index] and our
/// [SourceMap::Sectioned] is whether the sections are represented with Vcs
/// pointers.
#[turbo_tasks::value(shared)]
#[turbo_tasks::value(shared, cell = "new")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you don't want cells to ever match using equality? Which I imagine should be never unless you've got another bug (e.g. inconsistent cell creation order?).

I agree this seems weird and like we're masking bigger problems.

@sokra sokra merged commit f5a1e7d into main Jul 15, 2024
56 of 58 checks passed
@sokra sokra deleted the sokra/equal-check branch July 15, 2024 06:09
sokra added a commit to vercel/next.js that referenced this pull request Jul 16, 2024
* vercel/turborepo#8721 <!-- Tobias Koppers - fix
equal checks for cells and output -->
* vercel/turborepo#8671 <!-- Tobias Koppers - add
unloading of tasks to GC -->
* vercel/turborepo#8749 <!-- Tobias Koppers - fix
unloading stateful check -->
* vercel/turborepo#8750 <!-- Tobias Koppers -
upgrade deps to avoid conflict with next.js -->
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
### Description

* Check for equal Vc on returning a value
* Avoid PartialEq checks for values that are never equal

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
### Description

* Check for equal Vc on returning a value
* Avoid PartialEq checks for values that are never equal

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
### Description

* Check for equal Vc on returning a value
* Avoid PartialEq checks for values that are never equal

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
### Description

* Check for equal Vc on returning a value
* Avoid PartialEq checks for values that are never equal

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 16, 2024
* vercel/turborepo#8721 <!-- Tobias Koppers - fix
equal checks for cells and output -->
* vercel/turborepo#8671 <!-- Tobias Koppers - add
unloading of tasks to GC -->
* vercel/turborepo#8749 <!-- Tobias Koppers - fix
unloading stateful check -->
* vercel/turborepo#8750 <!-- Tobias Koppers -
upgrade deps to avoid conflict with next.js -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants