|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- /**
- * Copyright 2019-2022 Huawei Technologies Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- #ifndef INC_EXTERNAL_ACL_ACL_TDT_H_
- #define INC_EXTERNAL_ACL_ACL_TDT_H_
-
- #include "acl/acl_base.h"
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- enum acltdtTensorType {
- ACL_TENSOR_DATA_UNDEFINED = -1,
- ACL_TENSOR_DATA_TENSOR,
- ACL_TENSOR_DATA_END_OF_SEQUENCE,
- ACL_TENSOR_DATA_ABNORMAL
- };
-
- typedef struct acltdtDataItem acltdtDataItem;
- typedef struct acltdtDataset acltdtDataset;
- typedef struct acltdtChannelHandle acltdtChannelHandle;
-
- /**
- * @ingroup AscendCL
- * @brief Get tensor type from item
- *
- * @param dataItem [IN] pointer to the data item
- *
- * @retval Tensor type.
- * @retval ACL_DT_UNDEFINED if dataItem is null
- */
- ACL_FUNC_VISIBILITY acltdtTensorType acltdtGetTensorTypeFromItem(const acltdtDataItem *dataItem);
-
- /**
- * @ingroup AscendCL
- * @brief Get data type from item
- *
- * @param dataItem [IN] pointer to the data item
- *
- * @retval Data type.
- * @retval ACL_DT_UNDEFINED if dataItem is null
- */
- ACL_FUNC_VISIBILITY aclDataType acltdtGetDataTypeFromItem(const acltdtDataItem *dataItem);
-
- /**
- * @ingroup AscendCL
- * @brief Get data address from item
- *
- * @param dataItem [IN] pointer to data item
- *
- * @retval null for failed
- * @retval OtherValues success
- */
- ACL_FUNC_VISIBILITY void *acltdtGetDataAddrFromItem(const acltdtDataItem *dataItem);
-
- /**
- * @ingroup AscendCL
- * @brief Get data size from item
- *
- * @param dataItem [IN] pointer to data item
- *
- * @retval 0 for failed
- * @retval OtherValues success
- */
- ACL_FUNC_VISIBILITY size_t acltdtGetDataSizeFromItem(const acltdtDataItem *dataItem);
-
- /**
- * @ingroup AscendCL
- * @brief Get dim's number from item
- *
- * @param dataItem [IN] pointer to data item
- *
- * @retval 0 for failed
- * @retval OtherValues success
- */
- ACL_FUNC_VISIBILITY size_t acltdtGetDimNumFromItem(const acltdtDataItem *dataItem);
-
- /**
- * @ingroup AscendCL
- * @brief Get dims from item
- *
- * @param dataItem [IN] the struct of data item
- * @param dims [IN|OUT] pointer to the dims of dataTtem
- * @param dimNum [IN] the size of the dims
- *
- * @retval ACL_SUCCESS The function is successfully executed.
- * @retval OtherValues Failure
- */
- ACL_FUNC_VISIBILITY aclError acltdtGetDimsFromItem(const acltdtDataItem *dataItem, int64_t *dims, size_t dimNum);
-
- /**
- * @ingroup AscendCL
- * @brief Create the struct of data item
- *
- * @param tdtType [IN] Tdt tensor type
- * @param dims [IN] pointer of tdtDataItem's dims
- * @param dimNum [IN] Dim number
- * @param dataType [IN] Data type
- * @param data [IN] Data pointer
- * @param size [IN] Data size
- *
- * @retval null for failed
- * @retval OtherValues success
- *
- * @see acltdtDestroyDataItem
- */
- ACL_FUNC_VISIBILITY acltdtDataItem *acltdtCreateDataItem(acltdtTensorType tdtType, const int64_t *dims, size_t dimNum,
- aclDataType dataType, void *data, size_t size);
-
- /**
- * @ingroup AscendCL
- * @brief Destroy the struct of data item
- *
- * @param dataItem [IN] pointer to the data item
- *
- * @retval ACL_SUCCESS The function is successfully executed.
- * @retval OtherValues Failure
- *
- * @see acltdtCreateDataItem
- */
- ACL_FUNC_VISIBILITY aclError acltdtDestroyDataItem(acltdtDataItem *dataItem);
-
- /**
- * @ingroup AscendCL
- * @brief Create the tdt dataset
- *
- * @retval null for failed
- * @retval OtherValues success
- *
- * @see acltdtDestroyDataset
- */
- ACL_FUNC_VISIBILITY acltdtDataset *acltdtCreateDataset();
-
- /**
- * @ingroup AscendCL
- * @brief Destroy the tdt dataset
- *
- * @param dataset [IN] pointer to the dataset
- *
- * @retval ACL_SUCCESS The function is successfully executed.
- * @retval OtherValues Failure
- *
- * @see acltdtCreateDataset
- */
- ACL_FUNC_VISIBILITY aclError acltdtDestroyDataset(acltdtDataset *dataset);
-
- /**
- * @ingroup AscendCL
- * @brief Get the data item
- *
- * @param dataset [IN] pointer to the dataset
- * @param index [IN] index of the dataset
- *
- * @retval null for failed
- * @retval OtherValues success
- *
- * @see acltdtAddDataItem
- */
- ACL_FUNC_VISIBILITY acltdtDataItem *acltdtGetDataItem(const acltdtDataset *dataset, size_t index);
-
- /**
- * @ingroup AscendCL
- * @brief Get the data item
- *
- * @param dataset [OUT] pointer to the dataset
- * @param dataItem [IN] pointer to the data item
- *
- * @retval ACL_SUCCESS The function is successfully executed.
- * @retval OtherValues Failure
- *
- * @see acltdtGetDataItem
- */
- ACL_FUNC_VISIBILITY aclError acltdtAddDataItem(acltdtDataset *dataset, acltdtDataItem *dataItem);
-
- /**
- * @ingroup AscendCL
- * @brief Get the size of dataset
- *
- * @param dataset [IN] pointer to the dataset
- *
- * @retval 0 for failed
- * @retval OtherValues success
- */
- ACL_FUNC_VISIBILITY size_t acltdtGetDatasetSize(const acltdtDataset *dataset);
-
- /**
- * @ingroup AscendCL
- * @brief Get the name of dataset
- *
- * @param dataset [IN] pointer to the dataset
- *
- * @retval null for failed
- * @retval OtherValues success
- */
- ACL_FUNC_VISIBILITY const char *acltdtGetDatasetName(const acltdtDataset *dataset);
-
- /**
- * @ingroup AscendCL
- * @brief Stop the channel
- *
- * @param handle [IN] pointer to the channel handle
- *
- * @retval ACL_SUCCESS The function is successfully executed.
- * @retval OtherValues Failure
- *
- * @see acltdtCreateChannel | acltdtDestroyChannel
- */
- ACL_FUNC_VISIBILITY aclError acltdtStopChannel(acltdtChannelHandle *handle);
-
- /**
- * @ingroup AscendCL
- * @brief Create the channel
- *
- * @param deviceId [IN] the device id
- * @param name [IN] the name of channel
- *
- * @retval null for failed
- * @retval OtherValues success
- *
- * @see acltdtStopChannel | acltdtDestroyChannel
- */
- ACL_FUNC_VISIBILITY acltdtChannelHandle *acltdtCreateChannel(uint32_t deviceId, const char *name);
-
- /**
- * @ingroup AscendCL
- * @brief Create the channel with max size
- *
- * @param deviceId [IN] the device id
- * @param name [IN] the name of channel
- * @param capacity [IN] the capacity of channel
- *
- * @retval null for failed
- * @retval OtherValues success
- *
- * @see acltdtDestroyChannel
- */
- ACL_FUNC_VISIBILITY acltdtChannelHandle *acltdtCreateChannelWithCapacity(uint32_t deviceId, const char *name,
- size_t capacity);
-
- /**
- * @ingroup AscendCL
- * @brief Destroy the channel
- *
- * @param handle [IN] pointer to the channel handle
- *
- * @retval ACL_SUCCESS The function is successfully executed.
- * @retval OtherValues Failure
- *
- * @see acltdtCreateChannel | acltdtStopChannel
- */
- ACL_FUNC_VISIBILITY aclError acltdtDestroyChannel(acltdtChannelHandle *handle);
-
- /**
- * @ingroup AscendCL
- * @brief Send tensor to device
- *
- * @param handle [IN] pointer to the channel handle
- * @param dataset [IN] pointer to the dataset
- * @param timeout [IN] to be reserved, now it must be -1
- *
- * @retval ACL_SUCCESS The function is successfully executed.
- * @retval OtherValues Failure
- *
- * @see acltdtReceiveTensor
- */
- ACL_FUNC_VISIBILITY aclError acltdtSendTensor(const acltdtChannelHandle *handle, const acltdtDataset *dataset,
- int32_t timeout);
-
- /**
- * @ingroup AscendCL
- * @brief Receive tensor from device
- *
- * @param handle [IN] pointer to the channel handle
- * @param dataset [OUT] pointer to the dataset
- * @param timeout [IN] to be reserved, now it must be -1
- *
- * @retval ACL_SUCCESS The function is successfully executed.
- * @retval OtherValues Failure
- *
- * @see acltdtSendTensor
- */
- ACL_FUNC_VISIBILITY aclError acltdtReceiveTensor(const acltdtChannelHandle *handle, acltdtDataset *dataset,
- int32_t timeout);
-
- /**
- * @ingroup AscendCL
- * @brief query the size of the channel
- *
- * @param handle [IN] pointer to the channel handle
- * @param size [OUT] current size of this channel
- *
- * @retval ACL_SUCCESS The function is successfully executed.
- * @retval OtherValues Failure
- *
- */
- ACL_FUNC_VISIBILITY aclError acltdtQueryChannelSize(const acltdtChannelHandle *handle, size_t *size);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif // INC_EXTERNAL_ACL_ACL_TDT_H_
|