|
template<typename... Extents> |
| ViewOfViews3 (const std::string name, Extents... extents) |
|
| ViewOfViews3 (const ViewOfViews3< OuterViewRank, InnerViewType, OuterViewProps... > &)=default |
|
ViewOfViews3 & | operator= (const ViewOfViews3< OuterViewRank, InnerViewType, OuterViewProps... > &)=default |
|
| ViewOfViews3 (ViewOfViews3< OuterViewRank, InnerViewType, OuterViewProps... > &&src)=default |
|
ViewOfViews3 & | operator= (ViewOfViews3< OuterViewRank, InnerViewType, OuterViewProps... > &&)=default |
|
void | enableSafetyCheck () |
| Enable safety check in dtor for external references.
|
|
void | disableSafetyCheck () |
| Disable safety check in dtor for external references.
|
|
template<typename... Extents> |
void | initialize (const std::string name, Extents... extents) |
| Allocate the out view objects. Extents are for the outer view.
|
|
bool | isInitialized () const |
|
bool | deviceViewIsSynced () const |
|
bool | safetyCheck () const |
|
template<typename... Indices> |
void | addView (InnerViewType v, Indices... i) |
|
void | syncHostToDevice () |
|
auto | getViewHost () |
|
auto | getViewHost () const |
|
auto | getViewDevice () |
| Returns device view of views.
|
|
auto | getViewDevice () const |
| Returns device view of views.
|
|
template<int OuterViewRank, typename InnerViewType, typename... OuterViewProps>
class PHX::ViewOfViews3< OuterViewRank, InnerViewType, OuterViewProps >
Wrapper class that correctly handles ViewOfViews construction and object lifetime. This class makes sure the host view stays in scope for the life of the device view and makes sure that the device is synced to host before use.
Main restrictions:
- When UVM is not used in the outer view, we need to allocate the outer VofV on host and copy to device to initialize the inner views correctly (tracking object).
- Step 1 means that the host view must exist as long as the device view is being used, otherwise the views may go out of scope. This object exists to pair up the host and device view to make sure the inner views are not deleted early.
- Normally we use an unmanaged view (constructed with the Unmanaged template parameter) for the inner views to prevent double deletion. However, there are use cases where it's painful to pass around views built with the unmanaged template parameter (libraries with finctions that block the unmanaged argument). We can generate an unmanged view without the template parameter by constructing the view with a raw pointer. This thrid implementation does that here.