triton_cpp v1.2.1
Header-only C++ wrapper for NVIDIA Triton Inference Server clients
Loading...
Searching...
No Matches
triton_cpp::InputData Struct Reference

Couple a Triton input descriptor with its backing storage. More...

#include <types.hpp>

Public Member Functions

 InputData ()=default
 Construct an empty input-storage descriptor.
 
 InputData (const InputData &other)
 Copy an input descriptor and rebind pointers into copied owned storage.
 
 InputData (InputData &&other) noexcept
 Move an input descriptor and preserve its storage association.
 
InputDataoperator= (const InputData &other)
 Copy an input descriptor while preserving storage ownership.
 
InputDataoperator= (InputData &&other) noexcept
 Move an input descriptor while preserving storage ownership.
 
 InputData (std::shared_ptr< triton::client::InferInput > input, std::vector< uint8_t > &&data)
 Construct an input backed by an owned host vector.
 
 InputData (std::shared_ptr< triton::client::InferInput > input, uint8_t *data_raw, std::size_t data_raw_size)
 Construct an input backed by externally owned host memory.
 
 InputData (std::shared_ptr< triton::client::InferInput > input, uint8_t *data_raw, uint8_t *device_data_raw, std::size_t data_raw_size)
 Construct an input backed by CUDA shared memory.
 
bool isHostMappable () const
 
bool isDeviceBacked () const
 

Public Attributes

std::shared_ptr< triton::client::InferInput > input
 
std::vector< uint8_t > data
 
uint8_t * data_raw {nullptr}
 
uint8_t * device_data_raw {nullptr}
 
std::size_t data_raw_size {0}
 

Detailed Description

Couple a Triton input descriptor with its backing storage.

Storage may be an owned host vector, externally owned host shared memory, or CUDA device shared memory. Pointer validity follows the lifetime of the corresponding backing allocation.

Definition at line 157 of file types.hpp.

Constructor & Destructor Documentation

◆ InputData() [1/6]

triton_cpp::InputData::InputData ( )
default

Construct an empty input-storage descriptor.

◆ InputData() [2/6]

triton_cpp::InputData::InputData ( const InputData & other)
inline

Copy an input descriptor and rebind pointers into copied owned storage.

Parameters
otherDescriptor to copy.

Definition at line 176 of file types.hpp.

177 : input{other.input},
178 data{other.data},
179 data_raw{other.ownsHostBuffer() ? data.data() : other.data_raw},
180 device_data_raw{other.device_data_raw},
181 data_raw_size{other.data_raw_size} {}
std::size_t data_raw_size
Definition types.hpp:167
std::shared_ptr< triton::client::InferInput > input
Definition types.hpp:159
uint8_t * device_data_raw
Definition types.hpp:165
std::vector< uint8_t > data
Definition types.hpp:161

◆ InputData() [3/6]

triton_cpp::InputData::InputData ( InputData && other)
inlinenoexcept

Move an input descriptor and preserve its storage association.

Parameters
otherDescriptor to move from.

Definition at line 187 of file types.hpp.

187 {
188 const bool owns_host_buffer = other.ownsHostBuffer();
189 input = std::move(other.input);
190 data = std::move(other.data);
191 data_raw = owns_host_buffer ? data.data() : other.data_raw;
192 device_data_raw = other.device_data_raw;
193 data_raw_size = other.data_raw_size;
194 other.data_raw = nullptr;
195 other.device_data_raw = nullptr;
196 other.data_raw_size = 0;
197 }

References data, data_raw, data_raw_size, device_data_raw, and input.

◆ InputData() [4/6]

triton_cpp::InputData::InputData ( std::shared_ptr< triton::client::InferInput > input,
std::vector< uint8_t > && data )
inline

Construct an input backed by an owned host vector.

Parameters
inputTriton input descriptor.
dataHost buffer used to initialize this object's owned storage.

Definition at line 233 of file types.hpp.

234 : input{std::move(input)},
235 data{std::move(data)},
236 data_raw{this->data.data()},
237 device_data_raw{nullptr},
238 data_raw_size{this->data.size()} {}

◆ InputData() [5/6]

triton_cpp::InputData::InputData ( std::shared_ptr< triton::client::InferInput > input,
uint8_t * data_raw,
std::size_t data_raw_size )
inline

Construct an input backed by externally owned host memory.

Parameters
inputTriton input descriptor.
data_rawHost buffer address.
data_raw_sizeBuffer size in bytes.

Definition at line 246 of file types.hpp.

◆ InputData() [6/6]

triton_cpp::InputData::InputData ( std::shared_ptr< triton::client::InferInput > input,
uint8_t * data_raw,
uint8_t * device_data_raw,
std::size_t data_raw_size )
inline

Construct an input backed by CUDA shared memory.

Parameters
inputTriton input descriptor.
data_rawOptional host address; normally nullptr for CUDA-only storage.
device_data_rawCUDA device address.
data_raw_sizeBuffer size in bytes.

Definition at line 256 of file types.hpp.

Member Function Documentation

◆ isDeviceBacked()

bool triton_cpp::InputData::isDeviceBacked ( ) const
inline
Returns
true when the input is backed by a CUDA device allocation.

Definition at line 265 of file types.hpp.

265{ return device_data_raw != nullptr; }

References device_data_raw.

◆ isHostMappable()

bool triton_cpp::InputData::isHostMappable ( ) const
inline
Returns
true when the input exposes a host-accessible address.

Definition at line 263 of file types.hpp.

263{ return data_raw != nullptr; }

References data_raw.

◆ operator=() [1/2]

InputData & triton_cpp::InputData::operator= ( const InputData & other)
inline

Copy an input descriptor while preserving storage ownership.

Definition at line 200 of file types.hpp.

200 {
201 if (this != &other) {
202 const bool owns_host_buffer = other.ownsHostBuffer();
203 input = other.input;
204 data = other.data;
205 data_raw = owns_host_buffer ? data.data() : other.data_raw;
206 device_data_raw = other.device_data_raw;
207 data_raw_size = other.data_raw_size;
208 }
209 return *this;
210 }

References data, data_raw, data_raw_size, device_data_raw, and input.

◆ operator=() [2/2]

InputData & triton_cpp::InputData::operator= ( InputData && other)
inlinenoexcept

Move an input descriptor while preserving storage ownership.

Definition at line 213 of file types.hpp.

213 {
214 if (this != &other) {
215 const bool owns_host_buffer = other.ownsHostBuffer();
216 input = std::move(other.input);
217 data = std::move(other.data);
218 data_raw = owns_host_buffer ? data.data() : other.data_raw;
219 device_data_raw = other.device_data_raw;
220 data_raw_size = other.data_raw_size;
221 other.data_raw = nullptr;
222 other.device_data_raw = nullptr;
223 other.data_raw_size = 0;
224 }
225 return *this;
226 }

References data, data_raw, data_raw_size, device_data_raw, and input.

Member Data Documentation

◆ data

std::vector<uint8_t> triton_cpp::InputData::data

Owned storage used by standard host inputs.

Definition at line 161 of file types.hpp.

Referenced by InputData(), operator=(), and operator=().

◆ data_raw

uint8_t* triton_cpp::InputData::data_raw {nullptr}

Host-mappable buffer address, or nullptr for device-only storage.

Definition at line 163 of file types.hpp.

163{nullptr};

Referenced by InputData(), isHostMappable(), operator=(), and operator=().

◆ data_raw_size

std::size_t triton_cpp::InputData::data_raw_size {0}

Buffer size in bytes.

Definition at line 167 of file types.hpp.

167{0};

Referenced by InputData(), operator=(), and operator=().

◆ device_data_raw

uint8_t* triton_cpp::InputData::device_data_raw {nullptr}

CUDA device buffer address, or nullptr for host storage.

Definition at line 165 of file types.hpp.

165{nullptr};

Referenced by InputData(), isDeviceBacked(), operator=(), and operator=().

◆ input

std::shared_ptr<triton::client::InferInput> triton_cpp::InputData::input

Triton input descriptor.

Definition at line 159 of file types.hpp.

Referenced by InputData(), operator=(), and operator=().


The documentation for this struct was generated from the following file: