Compute Library
 21.02
CLDistribution1D Class Reference

CLDistribution1D object class. More...

#include <CLDistribution1D.h>

Collaboration diagram for CLDistribution1D:
[legend]

Public Member Functions

 CLDistribution1D (size_t num_bins, int32_t offset, uint32_t range)
 Constructor: Creates a 1D CLDistribution of a consecutive interval [offset, offset + range - 1] defined by a start offset and valid range, divided equally into num_bins parts. More...
 
 CLDistribution1D (const CLDistribution1D &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLDistribution1Doperator= (const CLDistribution1D &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
void map (bool blocking=true)
 Enqueue a map operation of the allocated buffer. More...
 
void unmap ()
 Enqueue an unmap operation of the allocated and mapped buffer. More...
 
cl::Buffer & cl_buffer () override
 Interface to be implemented by the child class to return a reference to the OpenCL buffer containing the distribution's data. More...
 
- Public Member Functions inherited from ICLDistribution1D
 ICLDistribution1D (size_t num_bins, int32_t offset, uint32_t range)
 Constructor: Creates a 1D CLDistribution of a consecutive interval [offset, offset + range - 1] defined by a start offset and valid range, divided equally into num_bins parts. More...
 
 ICLDistribution1D (const ICLDistribution1D &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
const ICLDistribution1Doperator= (const ICLDistribution1D &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
void map (cl::CommandQueue &q, bool blocking=true)
 Enqueue a map operation of the allocated buffer on the given queue. More...
 
void unmap (cl::CommandQueue &q)
 Enqueue an unmap operation of the allocated and mapped buffer on the given queue. More...
 
uint32_t * buffer () const override
 Returns a pointer to the start of the distribution. More...
 
- Public Member Functions inherited from IDistribution1D
 IDistribution1D (size_t num_bins, int32_t offset, uint32_t range)
 Constructor: Creates a 1D Distribution of a consecutive interval [offset, offset + range - 1] defined by a start offset and valid range, divided equally into num_bins parts. More...
 
size_t num_bins () const
 Returns the number of bins that the distribution has. More...
 
int32_t offset () const
 Returns the offset of the distribution. More...
 
uint32_t range () const
 Returns the range of the distribution. More...
 
uint32_t window () const
 Returns the window of the distribution, which is the range divided by the number of bins. More...
 
void set_range (uint32_t range)
 Sets the range of the distribution. More...
 
size_t size () const override
 Returns the total size in bytes of the distribution. More...
 
size_t dimensions () const override
 Returns the dimensions of the distribution. More...
 
- Public Member Functions inherited from IDistribution
virtual ~IDistribution ()=default
 Default virtual destructor. More...
 
void clear () const
 Clears the distribution by setting every element to zero. More...
 

Detailed Description

CLDistribution1D object class.

Definition at line 36 of file CLDistribution1D.h.

Constructor & Destructor Documentation

◆ CLDistribution1D() [1/2]

CLDistribution1D ( size_t  num_bins,
int32_t  offset,
uint32_t  range 
)

Constructor: Creates a 1D CLDistribution of a consecutive interval [offset, offset + range - 1] defined by a start offset and valid range, divided equally into num_bins parts.

Parameters
[in]num_binsThe number of bins the distribution is divided in.
[in]offsetThe start of the values to use.
[in]rangeThe total number of the consecutive values of the distribution interval.

Definition at line 31 of file CLDistribution1D.cpp.

32  : ICLDistribution1D(num_bins, offset, range), _mem(CLScheduler::get().context(), CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, num_bins * sizeof(int32_t))
33 {
34 }
static CLScheduler & get()
Access the scheduler singleton.
uint32_t range() const
Returns the range of the distribution.
ICLDistribution1D(size_t num_bins, int32_t offset, uint32_t range)
Constructor: Creates a 1D CLDistribution of a consecutive interval [offset, offset + range - 1] defin...
size_t num_bins() const
Returns the number of bins that the distribution has.
int32_t offset() const
Returns the offset of the distribution.

◆ CLDistribution1D() [2/2]

CLDistribution1D ( const CLDistribution1D )
delete

Prevent instances of this class from being copied (As this class contains pointers)

Member Function Documentation

◆ cl_buffer()

cl::Buffer & cl_buffer ( )
overridevirtual

Interface to be implemented by the child class to return a reference to the OpenCL buffer containing the distribution's data.

Returns
A reference to an OpenCL buffer containing the distribution's data.

Implements ICLDistribution1D.

Definition at line 58 of file CLDistribution1D.cpp.

59 {
60  return _mem;
61 }

◆ map()

void map ( bool  blocking = true)

Enqueue a map operation of the allocated buffer.

Parameters
[in]blockingIf true, then the mapping will be ready to use by the time this method returns, else it is the caller's responsibility to flush the queue and wait for the mapping operation to have completed.

Definition at line 36 of file CLDistribution1D.cpp.

References CLScheduler::get(), and ICLDistribution1D::map().

Referenced by arm_compute::utils::unmap().

37 {
38  ICLDistribution1D::map(CLScheduler::get().queue(), blocking);
39 }
static CLScheduler & get()
Access the scheduler singleton.
void map(cl::CommandQueue &q, bool blocking=true)
Enqueue a map operation of the allocated buffer on the given queue.

◆ operator=()

CLDistribution1D& operator= ( const CLDistribution1D )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ unmap()

void unmap ( )

Enqueue an unmap operation of the allocated and mapped buffer.

Note
This method simply enqueues the unmap operation, it is the caller's responsibility to flush the queue and make sure the unmap is finished before the memory is accessed by the device.

Definition at line 41 of file CLDistribution1D.cpp.

References ARM_COMPUTE_ERROR_ON, CLScheduler::get(), IDistribution1D::size(), and ICLDistribution1D::unmap().

Referenced by arm_compute::utils::unmap().

42 {
44 }
static CLScheduler & get()
Access the scheduler singleton.
void unmap(cl::CommandQueue &q)
Enqueue an unmap operation of the allocated and mapped buffer on the given queue. ...

The documentation for this class was generated from the following files: