Skip to content

1888/precision handling - #2065

Open
MarcelKoch wants to merge 5 commits into
1888/dense-linopfrom
1888/precision-handling
Open

1888/precision handling#2065
MarcelKoch wants to merge 5 commits into
1888/dense-linopfrom
1888/precision-handling

Conversation

@MarcelKoch

Copy link
Copy Markdown
Member

This PR adds runtime precision handling to LinOp. A new enum is created to provide the precision at runtime. The precision enum has values for all supported value types (depending on the cmake configuration). Additionally, it has the two values none and any. none is used to denote missing precision information or an invalid state. The any value can be used for mixed-precision applications.

The precision is stored in the LinOp class. Each existing linop sets the correct precision. There are helper variables to map a compile time type to a runtime enum value.

The opposite map is available by creating a variant from the enum.

@MarcelKoch MarcelKoch added this to the Ginkgo 2.0 milestone Aug 17, 2026
@MarcelKoch MarcelKoch self-assigned this Aug 17, 2026
@ginkgo-bot ginkgo-bot added reg:build This is related to the build system. reg:testing This is related to testing. mod:core This is related to the core module. type:solver This is related to the solvers type:preconditioner This is related to the preconditioners type:matrix-format This is related to the Matrix formats type:factorization This is related to the Factorizations type:reordering This is related to the matrix(LinOp) reordering labels Aug 17, 2026
@MarcelKoch MarcelKoch mentioned this pull request Aug 17, 2026
9 tasks
@MarcelKoch
MarcelKoch force-pushed the 1888/precision-handling branch 2 times, most recently from 8e4015d to 55551dd Compare August 18, 2026 14:57
@MarcelKoch
MarcelKoch force-pushed the 1888/precision-handling branch from 55551dd to 560109c Compare August 19, 2026 12:38
@MarcelKoch
MarcelKoch force-pushed the 1888/precision-handling branch from 560109c to ebe527a Compare August 19, 2026 12:56
@yhmtsai

yhmtsai commented Aug 20, 2026

Copy link
Copy Markdown
Member

could you elaborate more on the precision?
currently, it mostly translate ValueType in template to runtime.
FFT with any, but it actually only accepts complex float and complex double
Jacobi with valuetype, but it can store different precision inside.
Is there any place other than default advanced apply_impl using that out of the concrete class scope?
in the concrete class scope, we can always grab runtime variable from template.

@MarcelKoch

Copy link
Copy Markdown
Member Author

could you elaborate more on the precision?
currently, it mostly translate ValueType in template to runtime.

Yes, that's mostly the goal. It essentially allows the as_precision mechanism for the abstract multivector interface.

FFT with any, but it actually only accepts complex float and complex double
Jacobi with valuetype, but it can store different precision inside.

These two are the outliers we currently have. Here speaking of precision of the operator doesn't make much sense. I think rather it's about the vector precision the operator can be applied to.
Maybe for operators it should better be get_compatible_precision[s]. This could fix the issues with FFT and Jacobi.

Is there any place other than default advanced apply_impl using that out of the concrete class scope?
in the concrete class scope, we can always grab runtime variable from template.

I think you are right. In the current usages, we have the compile type available (except the generic linop advanced apply, which could be moved back to each class).
But I still think we need to have a runtime type available. For the multivector interface we could have as_precision<ValueType>, but this needs still to call a non-templated virtual function. So we need to translate between compile time and runtime type anyway.

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

Labels

1:ST:ready-for-review This PR is ready for review 1:ST:skip-full-test mod:core This is related to the core module. reg:build This is related to the build system. reg:testing This is related to testing. type:factorization This is related to the Factorizations type:matrix-format This is related to the Matrix formats type:preconditioner This is related to the preconditioners type:reordering This is related to the matrix(LinOp) reordering type:solver This is related to the solvers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants