1 #ifndef HeterogeneousCore_SonicTriton_TritonData 2 #define HeterogeneousCore_SonicTriton_TritonData 10 #include <unordered_map> 17 #include "grpc_client.h" 18 #include "grpc_service.pb.h" 22 template <
typename IO>
24 template <
typename IO>
26 template <
typename IO>
28 #ifdef TRITON_ENABLE_GPU 29 template <
typename IO>
30 class TritonGpuShmResource;
34 template <
typename DT>
36 template <
typename DT>
40 template <
typename DT>
46 template <
typename IO>
49 using Result = triton::client::InferResult;
62 template <
typename DT>
64 template <
typename DT>
67 template <
typename DT>
88 #ifdef TRITON_ENABLE_GPU 89 friend class TritonGpuShmResource<IO>;
125 #ifdef TRITON_ENABLE_GPU 126 friend class TritonGpuShmResource<IO>;
145 unsigned fullLoc(
unsigned loc)
const;
151 triton::client::InferenceServerGrpcClient*
client();
152 template <
typename DT>
154 if (!triton_utils::checkType<DT>(
dtype_))
156 <<
name_ <<
": inconsistent data type " <<
typeid(
DT).
name() <<
" for " <<
dname_;
161 return std::any_of(vec.
begin(), vec.
end(), [](int64_t
i) {
return i < 0; });
165 return std::accumulate(
166 vec.
begin(), vec.
end(), 1, [](int64_t dim1, int64_t dim2) {
return dim1 *
std::max(0
l, dim2); });
170 static std::atomic<unsigned>
uid{0};
220 template <
typename DT>
223 template <
typename DT>
228 template <
typename DT>
std::vector< std::vector< DT > > TritonInput
std::vector< TritonDataEntry > entries_
int64_t sizeShape(unsigned entry=0) const
void addEntryImpl(unsigned entry)
std::shared_ptr< void > holder_
unsigned fullLoc(unsigned loc) const
void createObject(IO **ioptr, const std::string &name, const std::string &dname)
std::shared_ptr< IO > data_
const std::string & dname() const
void computeSizes(int64_t shapeSize, int64_t byteSize, int64_t batchSize)
void updateMem(size_t size)
const ShapeView & shape(unsigned entry=0) const
IO * data(unsigned entry=0)
TritonInputContainer< DT > allocate(bool reserve=true)
std::shared_ptr< Result > result_
std::vector< edm::Span< const DT * > > TritonOutput
void setResult(std::shared_ptr< Result > result, unsigned entry=0)
triton::client::InferResult Result
void setShape(const ShapeType &newShape, unsigned entry=0)
TritonDataEntry(const ShapeType &dims, bool noOuterDim, const std::string &name, const std::string &dname)
bool anyNeg(const ShapeView &vec) const
TritonData(const std::string &name, const TensorMetadata &model_info, TritonClient *client, const std::string &pid)
std::unordered_map< std::string, TritonInputData > TritonInputMap
inference::ModelMetadataResponse_TensorMetadata TensorMetadata
std::shared_ptr< TritonInput< DT > > TritonInputContainer
TritonOutput< DT > fromServer() const
triton::client::InferenceServerGrpcClient * client()
inference::DataType dtype_
std::shared_ptr< TritonMemResource< IO > > memResource_
int64_t dimProduct(const ShapeView &vec) const
std::vector< int64_t > ShapeType
bool variableDims() const
void toServer(TritonInputContainer< DT > ptr)
std::unordered_map< std::string, TritonOutputData > TritonOutputMap
void addEntry(unsigned entry)