You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

acl_rt.h 3.0 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. * Copyright 2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef ACL_STUB_INC_ACL_RT_H
  17. #define ACL_STUB_INC_ACL_RT_H
  18. #include "acl_base.h"
  19. typedef enum aclrtRunMode {
  20. ACL_DEVICE,
  21. ACL_HOST,
  22. } aclrtRunMode;
  23. typedef enum aclrtTsId {
  24. ACL_TS_ID_AICORE,
  25. ACL_TS_ID_AIVECTOR,
  26. ACL_TS_ID_RESERVED,
  27. } aclrtTsId;
  28. typedef enum aclrtEventStatus {
  29. ACL_EVENT_STATUS_COMPLETE,
  30. ACL_EVENT_STATUS_NOT_READY,
  31. ACL_EVENT_STATUS_RESERVED,
  32. } aclrtEventStatus;
  33. typedef enum aclrtCallbackBlockType {
  34. ACL_CALLBACK_NO_BLOCK,
  35. ACL_CALLBACK_BLOCK,
  36. } aclrtCallbackBlockType;
  37. typedef enum aclrtMemcpyKind {
  38. ACL_MEMCPY_HOST_TO_HOST,
  39. ACL_MEMCPY_HOST_TO_DEVICE,
  40. ACL_MEMCPY_DEVICE_TO_HOST,
  41. ACL_MEMCPY_DEVICE_TO_DEVICE,
  42. } aclrtMemcpyKind;
  43. typedef enum aclrtMemMallocPolicy {
  44. ACL_MEM_MALLOC_HUGE_FIRST,
  45. ACL_MEM_MALLOC_HUGE_ONLY,
  46. ACL_MEM_MALLOC_NORMAL_ONLY,
  47. } aclrtMemMallocPolicy;
  48. typedef struct rtExceptionInfo aclrtExceptionInfo;
  49. typedef void (*aclrtCallback)(void *userData);
  50. typedef void (*aclrtExceptionInfoCallback)(aclrtExceptionInfo *exceptionInfo);
  51. aclError aclrtCreateContext(aclrtContext *context, int32_t deviceId);
  52. aclError aclrtDestroyContext(aclrtContext context);
  53. aclError aclrtSetCurrentContext(aclrtContext context);
  54. aclError aclrtGetCurrentContext(aclrtContext *context);
  55. aclError aclrtSetDevice(int32_t deviceId);
  56. aclError aclrtResetDevice(int32_t deviceId);
  57. aclError aclrtGetDevice(int32_t *deviceId);
  58. aclError aclrtGetRunMode(aclrtRunMode *runMode);
  59. aclError aclrtSynchronizeDevice(void);
  60. aclError aclrtSetTsDevice(aclrtTsId tsId);
  61. aclError aclrtGetDeviceCount(uint32_t *count);
  62. aclError aclrtMalloc(void **devPtr, size_t size, aclrtMemMallocPolicy policy);
  63. aclError aclrtFree(void *devPtr);
  64. aclError aclrtMallocHost(void **hostPtr, size_t size);
  65. aclError aclrtFreeHost(void *hostPtr);
  66. aclError aclrtMemcpy(void *dst, size_t destMax, const void *src, size_t count, aclrtMemcpyKind kind);
  67. aclError aclrtMemset(void *devPtr, size_t maxCount, int32_t value, size_t count);
  68. aclError aclrtMemcpyAsync(void *dst, size_t destMax, const void *src, size_t count, aclrtMemcpyKind kind,
  69. aclrtStream stream);
  70. aclError aclrtMemsetAsync(void *devPtr, size_t maxCount, int32_t value, size_t count, aclrtStream stream);
  71. aclError aclrtCreateStream(aclrtStream *stream);
  72. aclError aclrtDestroyStream(aclrtStream stream);
  73. aclError aclrtSynchronizeStream(aclrtStream stream);
  74. aclError aclrtStreamWaitEvent(aclrtStream stream, aclrtEvent event);
  75. #endif