HCC
HCC is a single-source, C/C++ compiler for heterogeneous computing. It's optimized with HSA (http://www.hsafoundation.com/).
|
This class is the return type of all asynchronous APIs and has an interface analogous to std::shared_future<void>. More...
#include <hc.hpp>
Public Member Functions | |
completion_future () | |
Default constructor. More... | |
completion_future (const completion_future &other) | |
Copy constructor. More... | |
completion_future (completion_future &&other) | |
Move constructor. More... | |
completion_future & | operator= (const completion_future &_Other) |
Copy assignment. More... | |
completion_future & | operator= (completion_future &&_Other) |
Move assignment. More... | |
void | get () const |
This method is functionally identical to std::shared_future<void>::get. More... | |
bool | valid () const |
This method is functionally identical to std::shared_future<void>::valid. More... | |
operator std::shared_future< void > () const | |
Conversion operator to std::shared_future<void>. More... | |
template<typename functor > | |
void | then (const functor &func) |
This method enables specification of a completion callback func which is executed upon completion of the asynchronous operation associated with this completion_future object. More... | |
void * | get_native_handle () const |
Get the native handle for the asynchronous operation encapsulated in this completion_future object. More... | |
uint64_t | get_begin_tick () |
Get the tick number when the underlying asynchronous operation begins. More... | |
uint64_t | get_end_tick () |
Get the tick number when the underlying asynchronous operation ends. More... | |
uint64_t | get_tick_frequency () |
Get the frequency of ticks per second for the underlying asynchrnous operation. More... | |
bool | is_ready () |
Get if the async operations has been completed. More... | |
int | get_use_count () const |
void | wait (hcWaitMode mode=hcWaitModeBlocked) const |
These methods are functionally identical to the corresponding std::shared_future<void> methods. More... | |
template<class _Rep , class _Period > | |
std::future_status | wait_for (const std::chrono::duration< _Rep, _Period > &_Rel_time) const |
These methods are functionally identical to the corresponding std::shared_future<void> methods. More... | |
template<class _Clock , class _Duration > | |
std::future_status | wait_until (const std::chrono::time_point< _Clock, _Duration > &_Abs_time) const |
These methods are functionally identical to the corresponding std::shared_future<void> methods. More... | |
Friends | |
class | Kalmar::HSAQueue |
template<typename T , int N> | |
class | array_view |
class | accelerator_view |
template<int N, typename Kernel > | |
completion_future | parallel_for_each (const accelerator_view &, const extent< N > &, const Kernel &) |
template<typename Kernel > | |
completion_future | parallel_for_each (const accelerator_view &, const extent< 1 > &, const Kernel &) |
template<typename Kernel > | |
completion_future | parallel_for_each (const accelerator_view &, const extent< 2 > &, const Kernel &) |
template<typename Kernel > | |
completion_future | parallel_for_each (const accelerator_view &, const extent< 3 > &, const Kernel &) |
template<typename Kernel > | |
completion_future | parallel_for_each (const accelerator_view &, const tiled_extent< 3 > &, const Kernel &) |
template<typename Kernel > | |
completion_future | parallel_for_each (const accelerator_view &, const tiled_extent< 2 > &, const Kernel &) |
template<typename Kernel > | |
completion_future | parallel_for_each (const accelerator_view &, const tiled_extent< 1 > &, const Kernel &) |
template<typename T , int N> | |
completion_future | copy_async (const array_view< const T, N > &src, const array_view< T, N > &dest) |
The contents of "src" are copied into "dest". More... | |
template<typename T , int N> | |
completion_future | copy_async (const array< T, N > &src, array< T, N > &dest) |
The contents of "src" are copied into "dest". More... | |
template<typename T , int N> | |
completion_future | copy_async (const array< T, N > &src, const array_view< T, N > &dest) |
The contents of "src" are copied into "dest". More... | |
template<typename T , int N> | |
completion_future | copy_async (const array_view< T, N > &src, const array_view< T, N > &dest) |
template<typename T , int N> | |
completion_future | copy_async (const array_view< const T, N > &src, array< T, N > &dest) |
The contents of "src" are copied into "dest". More... | |
template<typename InputIter , typename T , int N> | |
completion_future | copy_async (InputIter srcBegin, InputIter srcEnd, array< T, N > &dest) |
The contents of a source container from the iterator range [srcBegin,srcEnd) are copied into "dest". More... | |
template<typename InputIter , typename T , int N> | |
completion_future | copy_async (InputIter srcBegin, InputIter srcEnd, const array_view< T, N > &dest) |
The contents of a source container from the iterator range [srcBegin,srcEnd) are copied into "dest". More... | |
template<typename InputIter , typename T , int N> | |
completion_future | copy_async (InputIter srcBegin, array< T, N > &dest) |
template<typename InputIter , typename T , int N> | |
completion_future | copy_async (InputIter srcBegin, const array_view< T, N > &dest) |
template<typename OutputIter , typename T , int N> | |
completion_future | copy_async (const array< T, N > &src, OutputIter destBegin) |
The contents of a source array are copied into "dest" starting with iterator destBegin. More... | |
template<typename OutputIter , typename T , int N> | |
completion_future | copy_async (const array_view< T, N > &src, OutputIter destBegin) |
The contents of a source array are copied into "dest" starting with iterator destBegin. More... | |
This class is the return type of all asynchronous APIs and has an interface analogous to std::shared_future<void>.
Similar to std::shared_future, this type provides member methods such as wait and get to wait for asynchronous operations to finish, and the type additionally provides a member method then(), to specify a completion callback functor to be executed upon completion of an asynchronous operation.
|
inline |
Default constructor.
Constructs an empty uninitialized completion_future object which does not refer to any asynchronous operation. Default constructed completion_future objects have valid() == false
|
inline |
Copy constructor.
Constructs a new completion_future object that referes to the same asynchronous operation as the other completion_future object.
[in] | other | An object of type completion_future from which to initialize this. |
|
inline |
Move constructor.
Move constructs a new completion_future object that referes to the same asynchronous operation as originally refered by the other completion_future object. After this constructor returns, other.valid() == false
[in] | other | An object of type completion_future which the new completion_future |
|
inline |
This method is functionally identical to std::shared_future<void>::get.
This method waits for the associated asynchronous operation to finish and returns only upon the completion of the asynchronous operation. If an exception was encountered during the execution of the asynchronous operation, this method throws that stored exception.
|
inline |
Get the tick number when the underlying asynchronous operation begins.
|
inline |
Get the tick number when the underlying asynchronous operation ends.
|
inline |
Get the native handle for the asynchronous operation encapsulated in this completion_future object.
The method is mostly used for debugging purpose. Applications should retain the parent completion_future to ensure the native handle is not deallocated by the HCC runtime. The completion_future pointer to the native handle is reference counted, so a copy of the completion_future is sufficient to retain the native_handle.
|
inline |
Get the frequency of ticks per second for the underlying asynchrnous operation.
|
inline |
|
inline |
Get if the async operations has been completed.
|
inline |
Conversion operator to std::shared_future<void>.
This method returns a shared_future<void> object corresponding to this completion_future object and refers to the same asynchronous operation.
|
inline |
Copy assignment.
Copy assigns the contents of other to this. This method causes this to stop referring its current asynchronous operation and start referring the same asynchronous operation as other.
[in] | other | An object of type completion_future which is copy assigned to this. |
|
inline |
Move assignment.
Move assigns the contents of other to this. This method causes this to stop referring its current asynchronous operation and start referring the same asynchronous operation as other. After this method returns, other.valid() == false
[in] | other | An object of type completion_future which is move assigned to this. |
|
inline |
This method enables specification of a completion callback func which is executed upon completion of the asynchronous operation associated with this completion_future object.
The completion callback func should have an operator() that is valid when invoked with non arguments, i.e., "func()".
|
inline |
This method is functionally identical to std::shared_future<void>::valid.
This returns true if this completion_future is associated with an asynchronous operation.
|
inline |
These methods are functionally identical to the corresponding std::shared_future<void> methods.
The wait method waits for the associated asynchronous operation to finish and returns only upon completion of the associated asynchronous operation or if an exception was encountered when executing the asynchronous operation.
The other variants are functionally identical to the std::shared_future<void> member methods with same names.
waitMode[in] | An optional parameter to specify the wait mode. By default it would be hcWaitModeBlocked. hcWaitModeActive would be used to reduce latency with the expense of using one CPU core for active waiting. |
|
inline |
These methods are functionally identical to the corresponding std::shared_future<void> methods.
The wait method waits for the associated asynchronous operation to finish and returns only upon completion of the associated asynchronous operation or if an exception was encountered when executing the asynchronous operation.
The other variants are functionally identical to the std::shared_future<void> member methods with same names.
waitMode[in] | An optional parameter to specify the wait mode. By default it would be hcWaitModeBlocked. hcWaitModeActive would be used to reduce latency with the expense of using one CPU core for active waiting. |
|
inline |
These methods are functionally identical to the corresponding std::shared_future<void> methods.
The wait method waits for the associated asynchronous operation to finish and returns only upon completion of the associated asynchronous operation or if an exception was encountered when executing the asynchronous operation.
The other variants are functionally identical to the std::shared_future<void> member methods with same names.
waitMode[in] | An optional parameter to specify the wait mode. By default it would be hcWaitModeBlocked. hcWaitModeActive would be used to reduce latency with the expense of using one CPU core for active waiting. |
|
friend |
The contents of "src" are copied into "dest".
If the extents of "src" and "dest" don't match, a runtime exception is thrown.
[in] | src | An object of type array_view<T,N> (or array_view<const T, N>) to be copied from. |
[out] | dest | An object of type array_view<T,N> to be copied to. |
|
friend |
The contents of "src" are copied into "dest".
The source and destination may reside on different accelerators. If the extents of "src" and "dest" don't match, a runtime exception is thrown.
[in] | src | An object of type array<T,N> to be copied from. |
[out] | dest | An object of type array<T,N> to be copied to. |
|
friend |
The contents of "src" are copied into "dest".
If the extents of "src" and "dest" don't match, a runtime exception is thrown.
[in] | src | An object of type array<T,N> to be copied from. |
[out] | dest | An object of type array_view<T,N> to be copied to. |
|
friend |
The contents of "src" are copied into "dest".
If the extents of "src" and "dest" don't match, a runtime exception is thrown.
[in] | src | An object of type array_view<T,N> (or array_view<const T, N>) to be copied from. |
[out] | dest | An object of type array<T,N> to be copied to. |
|
friend |
The contents of a source container from the iterator range [srcBegin,srcEnd) are copied into "dest".
If the number of elements in the iterator range is not equal to "dest.extent.size()", an exception is thrown.
In the overloads which don't take an end-iterator it is assumed that the source iterator is able to provide at least dest.extent.size() elements, but no checking is performed (nor possible).
[in] | srcBegin | An iterator to the first element of a source container. |
[in] | srcEnd | An interator to the end of a source container. |
[out] | dest | An object of type array<T,N> to be copied to. |
|
friend |
The contents of a source container from the iterator range [srcBegin,srcEnd) are copied into "dest".
If the number of elements in the iterator range is not equal to "dest.extent.size()", an exception is thrown.
In the overloads which don't take an end-iterator it is assumed that the source iterator is able to provide at least dest.extent.size() elements, but no checking is performed (nor possible).
[in] | srcBegin | An iterator to the first element of a source container. |
[in] | srcEnd | An interator to the end of a source container. |
[out] | dest | An object of type array_view<T,N> to be copied to. |
|
friend |
The contents of a source array are copied into "dest" starting with iterator destBegin.
If the number of elements in the range starting destBegin in the destination container is smaller than "src.extent.size()", the behavior is undefined.
[in] | src | An object of type array<T,N> to be copied from. |
[out] | destBegin | An output iterator addressing the position of the first element in the destination container. |
|
friend |
The contents of a source array are copied into "dest" starting with iterator destBegin.
If the number of elements in the range starting destBegin in the destination container is smaller than "src.extent.size()", the behavior is undefined.
[in] | src | An object of type array_view<T,N> to be copied from. |
[out] | destBegin | An output iterator addressing the position of the first element in the destination container. |