Skip to content

Move alpaka vecmem logic to functions #857

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 22 commits into
base: main
Choose a base branch
from

Conversation

StewMH
Copy link
Contributor

@StewMH StewMH commented Feb 11, 2025

Templated functions returning shared_ptrs that create vecmem::hip::device_memory_resource etc. Note that because of the casting to a derived class this has to be done via pointers.

@krasznaa think this might be along the lines of what you were thinking of?

Waiting for a substantial PR from @CrossR first

@krasznaa
Copy link
Member

No, not really...

I'm imagining a "simple" class like the following:

namespace traccc::alpaka::details {

class vecmem_objects {

public:
    ...
    vecmem::memory_resource& host_mr() const;
    vecmem::memory_resource& device_mr() const;
    vecmem::memory_resource& shared_mr() const;
    vecmem::copy& copy() const;

private:
    struct impl;
    std::unique_ptr<impl> m_impl;
};
}  // namespace traccc::alpaka::details

I.e. make an opaque class (using Pimpl) that creates (and owns) some vecmem objects, and gives access to these through their generic interfaces. Then clients would just instantiate such an object themselves. Like:

traccc::alpaka::details::vecmem_objects vo{};
...
vecmem::vector<float> foo(&(vo.host_mr()));
...

The goal is to remove all Alpaka related preprocessor statements from the public interface of this library. 🤔

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.

3 participants