Skip to content

Refactoring Factors: data -> state, observation and operational memory #1127

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

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

Affie
Copy link
Member

@Affie Affie commented Apr 2, 2025

Affie and others added 2 commits June 11, 2025 20:42
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* defFactorFunction macro

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* update defFactorType

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update DFGFactor.jl

---------

Co-authored-by: Johannes Terblanche <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
:bcf1,
[:b, :c],
ZonedDateTime("2020-08-11T00:12:03.000-05:00"),
GenericFunctionNodeData(; fnc=TestCCW{TestFunctorInferenceType1}());
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
GenericFunctionNodeData(; fnc=TestCCW{TestFunctorInferenceType1}());
GenericFunctionNodeData(; fnc = TestCCW{TestFunctorInferenceType1}());

@@ -473,7 +473,7 @@ function VariablesandFactorsCRUD_SET!(fg, v1, v2, v3, f0, f1, f2)
@test getLabel(fg[getLabel(v1)]) == getLabel(v1)

#TODO standardize this error and res also for that matter
fnope = FactorCompute{TestCCW{TestFunctorInferenceType1}}(:broken, [:a, :nope])
fnope = FactorCompute(:broken, [:a, :nope], GenericFunctionNodeData(; fnc=TestCCW{TestFunctorInferenceType1}()))
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
fnope = FactorCompute(:broken, [:a, :nope], GenericFunctionNodeData(; fnc=TestCCW{TestFunctorInferenceType1}()))
fnope = FactorCompute(
:broken,
[:a, :nope],
GenericFunctionNodeData(; fnc = TestCCW{TestFunctorInferenceType1}()),
)

@@ -1683,7 +1683,7 @@ function ProducingDotFiles(
end
if f1 === nothing
if (FACTYPE == FactorCompute)
f1 = FactorCompute{TestFunctorInferenceType1}(:abf1, [:a, :b])
f1 = FactorCompute(:abf1, [:a, :b], GenericFunctionNodeData(;fnc = TestFunctorInferenceType1()))
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
f1 = FactorCompute(:abf1, [:a, :b], GenericFunctionNodeData(;fnc = TestFunctorInferenceType1()))
f1 = FactorCompute(
:abf1,
[:a, :b],
GenericFunctionNodeData(; fnc = TestFunctorInferenceType1()),
)

Symbol("x$(n)x$(n+1)f1"),
[verts[n].label, verts[n + 1].label],
GenericFunctionNodeData(; fnc=TestFunctorInferenceType1())
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
GenericFunctionNodeData(; fnc=TestFunctorInferenceType1())
GenericFunctionNodeData(; fnc = TestFunctorInferenceType1()),

Copy link

codecov bot commented Jun 12, 2025

Codecov Report

Attention: Patch coverage is 57.89474% with 32 lines in your changes missing coverage. Please review.

Project coverage is 74.81%. Comparing base (05ad44d) to head (eba3b38).

Files with missing lines Patch % Lines
src/services/Serialization.jl 47.82% 12 Missing ⚠️
src/services/DFGFactor.jl 41.17% 10 Missing ⚠️
src/entities/DFGFactor.jl 79.16% 5 Missing ⚠️
src/Deprecated.jl 0.00% 3 Missing ⚠️
src/services/CustomPrinting.jl 71.42% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1127      +/-   ##
===========================================
- Coverage    75.32%   74.81%   -0.51%     
===========================================
  Files           28       28              
  Lines         2399     2450      +51     
===========================================
+ Hits          1807     1833      +26     
- Misses         592      617      +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

data::GenericFunctionNodeData{T} = GenericFunctionNodeData(; fnc = T());
kw...,
) where {T}
solverData = nothing
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
solverData = nothing
solverData = nothing,

Comment on lines +315 to +318
Base.depwarn(
"`FactorCompute` solverData is deprecated",
:FactorCompute,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
Base.depwarn(
"`FactorCompute` solverData is deprecated",
:FactorCompute,
)
Base.depwarn("`FactorCompute` solverData is deprecated", :FactorCompute)

)
refsolverData = Ref(solverData)
end

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

Comment on lines +288 to +291
"""Temporary, non-persistent memory used internally by the solver for intermediate numerical computations and buffers.
`workmem` is lazily allocated and only used during factor operations; it is not serialized or retained after solving.
Accessors: [`getWorkmem`](@ref), [`setWorkmem!`](@ref)"""
workmem::Base.RefValue{<:FactorOperationalMemory} #TODO easy of use vs. performance as container is abstract in any case.
Copy link
Member Author

@Affie Affie Jun 13, 2025

Choose a reason for hiding this comment

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

@dehann, I would like some input on the naming here. I asked copilot and it came up with Workmem (working memory). I came up with Opmem (operational memory). As you know the only implementation here is CommonConvWrapper.
FactorOperationalMemory can also be renamed to FactorWorkingMemory if it is clearer.

A confusing name such as rebuildFactorMetadata! will then become rebuildFactorWorkmem since Metadata has another meaning.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it is part of the SDKs and likely only for advanced (solver) devs.

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.

2 participants