Skip to content

Conversation

@NamjaeChoi
Copy link
Contributor

@NamjaeChoi NamjaeChoi commented Oct 1, 2025

Refs #30655.

Functors are not dispatched but plugged inside the user's parallel code, so I can't think of a way to achieve static polymorphism here. I think I will have to introduce virtual functions minimally in the wrapper class, but any idea to avoid it would be welcome, if you have any. Of course, if the user specifies the exact object type instead of using the abstract type, they will be able to evaluate functors statically.

Concerns are performance and SYCL, but regarding SYCL, Intel is adding an extension to allow virtual functions on GPU. We may be able to leverage it when the time comes to support SYCL. I don't think we are interested in supporting SYCL for backends other than Intel GPU.

@NamjaeChoi
Copy link
Contributor Author

@lindsayad My next thing to look into would be this. I will start from functions. Do you have any thoughts on this?

@lindsayad
Copy link
Member

If we use virtuals, should we consider just adapting the current functor system?

@NamjaeChoi
Copy link
Contributor Author

The problem with that is we can't construct MOOSE objects directly on device. If an object that has virtual methods is constructed on host, the vtable will be populated with host function pointers. What I'm trying to do here is to define a thin wrapper that has virtual methods and is light enough to be built on device, and let the wrapper call the wrapped functor methods statically.

Copy link
Member

@lindsayad lindsayad left a comment

Choose a reason for hiding this comment

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

I think this looks ok to me

@NamjaeChoi NamjaeChoi changed the title WIP: Kokkos Functor System Kokkos Function System and Functor Scratch Oct 23, 2025
@NamjaeChoi NamjaeChoi changed the title Kokkos Function System and Functor Scratch Kokkos Function System Oct 23, 2025
@NamjaeChoi
Copy link
Contributor Author

Still working... just want to run test suite once

@NamjaeChoi NamjaeChoi force-pushed the kokkos_functor branch 3 times, most recently from c723295 to 68df514 Compare October 24, 2025 00:13
@moosebuild
Copy link
Contributor

moosebuild commented Oct 24, 2025

Job Documentation, step Docs: sync website on f9d7ff6 wanted to post the following:

View the site here

This comment will be updated on new commits.

@moosebuild
Copy link
Contributor

moosebuild commented Oct 24, 2025

Job Coverage, step Generate coverage on f9d7ff6 wanted to post the following:

Framework coverage

4e5abd #31653 f9d7ff
Total Total +/- New
Rate 85.99% 85.93% -0.05% 100.00%
Hits 124384 124624 +240 510
Misses 20272 20400 +128 0

Diff coverage report

Full coverage report

Modules coverage

Coverage did not change

Full coverage reports

Reports

This comment will be updated on new commits.

@NamjaeChoi NamjaeChoi force-pushed the kokkos_functor branch 3 times, most recently from 2d9d24b to 977be17 Compare October 24, 2025 19:19
@lindsayad
Copy link
Member

going to unsubscribe for now. Mention me when you want more input or it's ready for review

@NamjaeChoi
Copy link
Contributor Author

NamjaeChoi commented Oct 24, 2025

@lindsayad I might have to hold this. Virtual functions on device seem to require RDC to be fully functional.

@NamjaeChoi
Copy link
Contributor Author

The code is currently in a state where CUDA will work when we have RDC.

@NamjaeChoi
Copy link
Contributor Author

I don't want to indefinitely hold this PR for RDC. I will temporarily disable using virtual dispatch for GPU.

@moosebuild
Copy link
Contributor

Job Test, step Results summary on f9d7ff6 wanted to post the following:

Framework test summary

Compared against 4e5abd1 in job civet.inl.gov/job/3352081.

Removed tests

Added tests

Test Time (s)
kokkos/functions/piecewise_constant.piecewise_constant/json 1.91
kokkos/functions/piecewise_constant.piecewise_constant/xy_data 1.45
kokkos/functions/piecewise_constant.piecewise_constant/csv 1.44
kokkos/functions/concrete_type.invalid_type 1.42
kokkos/functions/piecewise_constant.piecewise_constant/x_y 1.37
kokkos/functions/constant_function.test 1.37
kokkos/functions/default_function.test 1.33
kokkos/functions/concrete_type.concrete_type 1.12

Run time changes

Modules test summary

Compared against 4e5abd1 in job civet.inl.gov/job/3352081.

Removed tests

Added tests

Run time changes

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

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants