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

remove fence that GC change made unnecessary #56986

Merged

Conversation

oscardssmith
Copy link
Member

@gbaraldi and I think that this fence can probably be removed now that #55223 is merged. This should slightly expand the set of cases where the Memory is removable.

@oscardssmith oscardssmith added the performance Must go faster label Jan 8, 2025
@oscardssmith oscardssmith requested a review from gbaraldi January 8, 2025 03:11
@oscardssmith oscardssmith added the needs pkgeval Tests for all registered packages should be run with this change label Jan 8, 2025
@gbaraldi
Copy link
Member

gbaraldi commented Jan 8, 2025

I'm still spooked about DSE being able to delete stores into our objects, but LGTM

@vtjnash
Copy link
Member

vtjnash commented Jan 8, 2025

I thought we already have this fence in our safepoint lowering?

@gbaraldi
Copy link
Member

gbaraldi commented Jan 8, 2025

This fence is not the safepoint one. It's specifically for the length field of a memory, which if it is unused can be DSEd out. We used to use it during sweeping to decrement the GC length, but not anymore.

@oscardssmith
Copy link
Member Author

@nanosoldier runtests()

@vtjnash
Copy link
Member

vtjnash commented Jan 8, 2025

We use it during marking, to decide what memory to access

@gbaraldi
Copy link
Member

gbaraldi commented Jan 8, 2025

So that's where we have some questions. From what we've seen this was only an issue if the memory was allocated and was instantly dead (i.e never marked). Which might be wrong, though this is what we were discussing yesterday in relation to initialization.

@nanosoldier
Copy link
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Report summary

❗ Packages that crashed

2 packages crashed only on the current version.

  • A segmentation fault happened: 2 packages

13 packages crashed on the previous version too.

✖ Packages that failed

20 packages failed only on the current version.

  • Package has test failures: 5 packages
  • Tests became inactive: 2 packages
  • Test duration exceeded the time limit: 13 packages

1311 packages failed on the previous version too.

✔ Packages that passed tests

19 packages passed tests only on the current version.

  • Other: 19 packages

5212 packages passed tests on the previous version too.

~ Packages that at least loaded

11 packages successfully loaded only on the current version.

  • Other: 11 packages

2713 packages successfully loaded on the previous version too.

➖ Packages that were skipped altogether

913 packages were skipped on the previous version too.

@oscardssmith oscardssmith removed the needs pkgeval Tests for all registered packages should be run with this change label Jan 9, 2025
@oscardssmith
Copy link
Member Author

oscardssmith commented Jan 9, 2025

The pkgeval failures look fairly unrelated, but I think @vtjnash and @gbaraldi are most likely to be able to figure out whether this is valid or not.

@oscardssmith
Copy link
Member Author

From looking at this with Jeff, we realized that GC-safepoints have a CST fence, which should make this safe (since that requires LLVM not to delay the store of a living object beyond the fence).

@gbaraldi
Copy link
Member

gbaraldi commented Jan 9, 2025

Right, but does LLVM treat other things that are safepoints, i.e julia function calls and friends as seq-cst fences. (I believe it does) so I think merging is fine.

@oscardssmith
Copy link
Member Author

oscardssmith commented Jan 9, 2025

I think the situation here is somewhat complicated. Currently, I believe this optimization is safe since LLVM believes that all Julia function calls may allias all memory. Interestingly, since calling a julia function may run GC this is almost true, in that any function call may read any live memory (in the mark phase), but will not read any dead memory. In some ways, this would be a lot cleaner if the safepoint on functions calls was added by the caller rather than the callee.

@KristofferC
Copy link
Member

@nanosoldier runtests(["SimpleLooper", "WeaklyHard", "EarlyStopping", "MbedTLS", "TuePlots", "FaultDetectionTools", "Andes", "AstroRepresentations", "RandomLinearAlgebraSolvers", "Optim", "PlotRNA", "MomentMatching", "DynamicMovementPrimitives", "DynamicalSystems", "Trebuchet", "ModelOrderReductionToolkit", "ViscousFlow", "Yunir", "StirredReactor", "Survey", "SoilWater_ToolBox", "Chamber"])

@nanosoldier
Copy link
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Report summary

✖ Packages that failed

2 packages failed only on the current version.

  • Tests became inactive: 2 packages

2 packages failed on the previous version too.

✔ Packages that passed tests

12 packages passed tests on the previous version too.

~ Packages that at least loaded

6 packages successfully loaded on the previous version too.

@oscardssmith oscardssmith merged commit 64706d7 into JuliaLang:master Jan 10, 2025
10 of 11 checks passed
@oscardssmith oscardssmith deleted the os/remove-Memorynew-fence branch January 10, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants