Skip to content

[Core] Add an algorithm interface + StableTasks #269

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

Merged
merged 12 commits into from
Apr 3, 2025
Merged

Conversation

asinghvi17
Copy link
Member

@asinghvi17 asinghvi17 commented Mar 4, 2025

This was factored out of the "dev branch" #259 and contains the subset of changes that apply to GeometryOpsCore, for easier review.

Child PRs: #271 (TGGeometry) -> #275 (AdaptivePredicates) -> #273 (clipping algorithm type) -> #274 (trees)

  • Use StableTasks.jl in apply and applyreduce - its type-stable tasks save us some allocations!
  • Remove Base.@assume_effects on the low level functions, which caused issues on Julia v1.11 and was probably incorrect anyway
  • Add an algorithm interface with an abstract supertype Algorithm{M <: Manifold}, as discussed in Method v/s manifold #247. Also adds an abstract Operator supertype and some discussion in code comments, but no implementation or interface surface there yet.
  • Split out types.jl into a directory types with a bunch of files in it, for ease of readability / docs / use.
  • (out of context change): refactor CI a bit for cleanliness.

TODOs (maybe not this PR):

  • Add a format method that takes in an incompletely specified algorithm and some geometry as input, and returns a completely specified algorithm. What does this mean? Imagine I call GO.intersection(FosterHormannClipping(), geom1, geom2). That FosterHormannClipping() should get expanded to FosterHormannClipping(AutoAlgorithm(), AutoAccelerator()). Then, format will take format(alg, args...) and:
    • get the crstrait of the two geometries, scan for incompatibilities, assign the correct manifold to the algorithm (maybe warn or emit debug info)
    • if no geometries available, get the manifold via best_manifold(::Algorithm).
    • maybe inflate the accelerator by checking npoint and later preparations to see what's most efficient, maybe not - depends on what we want!

StableTasks.jl allows type stable tasks (previously type unstable), so it's significantly easier to multithread.  This commit also shows how you could implement another "execution engine" a la what JuliaFolds2 does (maybe work stealing, etc) if you wanted.

In benchmarking, StableTasks does decrease the number of allocations which can only be a good thing.
Copy link
Member Author

asinghvi17 commented Mar 4, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Member

@rafaqz rafaqz left a comment

Choose a reason for hiding this comment

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

Looks great.

@tiemvanderdeure maybe you want to take a look at the manifold stuff too?

@asinghvi17 asinghvi17 mentioned this pull request Mar 9, 2025
@asinghvi17 asinghvi17 merged commit 87c2c7b into main Apr 3, 2025
6 of 8 checks passed
This was referenced Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants