Skip to content

Comments

Sync fft interfaces#235

Closed
anantsrivastava30 wants to merge 10 commits intouxlfoundation:developfrom
anantsrivastava30:sync_fft_interfaces
Closed

Sync fft interfaces#235
anantsrivastava30 wants to merge 10 commits intouxlfoundation:developfrom
anantsrivastava30:sync_fft_interfaces

Conversation

@anantsrivastava30
Copy link
Contributor

Description

Please include a summary of the change. Please also include relevant
motivation and context. See
contribution guidelines
for more details. If the change fixes an issue not documented in the project's
Github issue tracker, please document all steps necessary to reproduce it.

Fixes # (GitHub issue)

Checklist

All Submissions

  • Do all unit tests pass locally? Attach a log.
  • Have you formatted the code using clang-format?

New interfaces

  • Have you provided motivation for adding a new feature as part of RFC and
    it was accepted? # (RFC)
  • What version of oneAPI spec the interface is targeted?
  • Complete New features checklist

New features

  • Have you provided motivation for adding a new feature?
  • Have you added relevant tests?

Bug fixes

  • Have you added relevant regression tests?
  • Have you included information on how to reproduce the issue (either in a
    GitHub issue or in this PR)?

namespace dft {
namespace detail {

class descriptor_impl {
Copy link
Contributor

@t4c1 t4c1 Oct 12, 2022

Choose a reason for hiding this comment

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

Everything in this impl class is general (not backend specific). So, it does not need to be in descriptor_impl, but can be in the descriptor class. We only need pimpl for backend-specific parts (factorizations, twiddle tables etc) and these can only be initialized in the commit call, not in descriptor constructor.

Implementations will need to be backend specific (so one in every backend) and for now you can leave them empty. They will only be initialized in commit implementation for each backend.

Maybe we dont even need pimpl, just a pointer that each backend can set to point to its internal data it needs to store in the descriptor (just thinking out loud).

Copy link
Contributor Author

@anantsrivastava30 anantsrivastava30 Oct 13, 2022

Choose a reason for hiding this comment

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

Hey Tadej, thank you for the review, I have a few options to move forward

  1. impliment the constructor and the set_value + get_value in the descriptor.hpp, use pimpl only for commit
  2. if we prefer to separate implimentation and declaration then I would have to explicitly specialize consturctors + pre-commit member functinos, which would bloat the implimentation code (e.g. src/dft/backend/descriptor.cxx)
  3. could use detail::create_descriptor (pointer to class impl) for general implimentation, and detail::create_commit(pointer to different commit class ?) along withmklcpu::create_commit(...mklgpu::create_commit`), this would avoid some bloating as create_descriptor can be templated and passed on to the impl class.

for now I can work on option 1 as the prefered way, let me know your thoughts on this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I like 1 the best as well. Other options sound like unnecessary complications.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

710a4e1, should enable you to work on gpu commit.

Comment on lines 21 to 25
template <oneapi::mkl::dft::precision prec, oneapi::mkl::dft::domain dom>
oneapi::mkl::dft::detail::descriptor_impl* create_descriptor(std::size_t length);

template <oneapi::mkl::dft::precision prec, oneapi::mkl::dft::domain dom>
oneapi::mkl::dft::detail::descriptor_impl* create_descriptor(std::vector<std::int64_t> dimensions);
Copy link
Contributor

Choose a reason for hiding this comment

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

We won't need these after everything from descriptor_impl is moved to descriptor.

Copy link
Contributor

@t4c1 t4c1 left a comment

Choose a reason for hiding this comment

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

I added multiple comments, but I think only the first one actually blocks any further implementations.

Comment on lines 48 to 53
#ifdef ENABLE_MKLCPU_BACKEND
: pimpl_(mklcpu::create_descriptor(length)) {}
#endif
#ifdef ENABLE_MKLGPU_BACKEND
: pimpl_(mklgpu::create_descriptor(length)) {}
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

This will prevent us from compiling for multiple backends. pimpl_ should be initialized in commit, where we know which backend is used (from the queue).

descriptor(std::vector<std::int64_t> dimensions);

~descriptor();
// ~descriptor();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why comment out destructor? I think this should be reverted.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, destructor should free pimpl if commit was called before descriptor is destroyed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pimpl is casted as unique_ptr, it will free itself as it goes out of scope.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense. This is fine as it is.

}

protected:
sycl::queue queue_;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we don't need queue in the descriptor_impl, as it is part of the descriptor.


namespace mklcpu {

ONEMKL_EXPORT oneapi::mkl::dft::detail::descriptor_impl* create_descriptor(std::size_t length);
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not need those anymore. In fact, this whole file can be removed.

@anantsrivastava30
Copy link
Contributor Author

I added multiple comments, but I think only the first one actually blocks any further implementations.

I think you reviewed old code, there have been a few commits after the one you reviewed.

@t4c1
Copy link
Contributor

t4c1 commented Oct 17, 2022

Right. Nothing in this should block us now, but the comment about not needing queue in descriptor_impl still stands.

@KumudhaN
Copy link
Contributor

@anantsrivastava30 Can you modify the PR to target the develop branch in your fork and then we should be able to work on top of that.
Thanks!

@anantsrivastava30
Copy link
Contributor Author

@anantsrivastava30 Can you modify the PR to target the develop branch in your fork and then we should be able to work on top of that. Thanks!

@KumudhaN thanks for pointing out opend a local PR! and merging it to local anantsrivastava30#1

@Rbiessy
Copy link
Contributor

Rbiessy commented May 9, 2023

@anantsrivastava30 I think this can be closed right?

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.

4 participants