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.

megcore_cdefs.h 1.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include <stdint.h>
  3. /**
  4. * \brief MegCore platform types
  5. */
  6. typedef enum {
  7. megcorePlatformCPU = 1,
  8. megcorePlatformCUDA = 4,
  9. megcorePlatformROCM = 6,
  10. megcorePlatformCambricon = 7,
  11. megcorePlatformAtlas = 8,
  12. } megcorePlatform_t;
  13. /**
  14. * \brief MegCore return codes
  15. *
  16. * Note: since MegCore has been merged into MegDNN and uses C++ API with
  17. * exception, this return status only serves for backward compatibility and all
  18. * API would return megcoreSuccess
  19. */
  20. typedef enum {
  21. megcoreSuccess = 0,
  22. megcoreErrorMemoryAllocation = 1,
  23. megcoreErrorInvalidArgument = 2,
  24. megcoreErrorInvalidDeviceHandle = 3,
  25. megcoreErrorInvalidComputingHandle = 4,
  26. megcoreErrorInternalError = 5,
  27. } megcoreStatus_t;
  28. /**
  29. * \brief Memcpy kind
  30. */
  31. typedef enum {
  32. megcoreMemcpyHostToDevice = 1,
  33. megcoreMemcpyDeviceToHost = 2,
  34. megcoreMemcpyDeviceToDevice = 3,
  35. } megcoreMemcpyKind_t;
  36. namespace megcore {
  37. /*!
  38. * \brief error reporting from asynchronous execution devices
  39. *
  40. * This is currently used by CUDA kernels. It is used to report errors that
  41. * depend on input data.
  42. */
  43. struct AsyncErrorInfo {
  44. //! number of errors occurred; only detailed information of the first error
  45. //! would be recorded
  46. uint32_t nr_error;
  47. //! tracker set by set_error_tracker()
  48. void* tracker_ptr;
  49. //! human readable message; it can contain %d which would be replaced by
  50. //! msg_args
  51. char msg[228];
  52. int msg_args[4];
  53. };
  54. } // namespace megcore
  55. // vim: syntax=cpp.doxygen