driver_mic_source.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2015,2017,2019 CNRS
  4. * Copyright (C) 2012,2017 Inria
  5. * Copyright (C) 2013,2014,2017 Université de Bordeaux
  6. * Copyright (C) 2013 Thibaut Lambert
  7. *
  8. * StarPU is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU Lesser General Public License as published by
  10. * the Free Software Foundation; either version 2.1 of the License, or (at
  11. * your option) any later version.
  12. *
  13. * StarPU is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. *
  17. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  18. */
  19. #ifndef __DRIVER_MIC_SOURCE_H__
  20. #define __DRIVER_MIC_SOURCE_H__
  21. #include <starpu_mic.h>
  22. #include <common/config.h>
  23. #ifdef STARPU_USE_MIC
  24. #include <source/COIProcess_source.h>
  25. #include <source/COIEngine_source.h>
  26. #include <core/workers.h>
  27. #include <drivers/mp_common/mp_common.h>
  28. #include <datawizard/node_ops.h>
  29. extern struct _starpu_node_ops _starpu_driver_mic_node_ops;
  30. /* Array of structures containing all the informations useful to send
  31. * and receive informations with devices */
  32. extern struct _starpu_mp_node *_starpu_mic_nodes[STARPU_MAXMICDEVS];
  33. struct _starpu_mic_async_event *event;
  34. #define STARPU_MIC_REQUEST_COMPLETE 42
  35. #define STARPU_MIC_SRC_REPORT_COI_ERROR(status) \
  36. _starpu_mic_src_report_coi_error(__starpu_func__, __FILE__, __LINE__, status)
  37. #define STARPU_MIC_SRC_REPORT_SCIF_ERROR(status) \
  38. _starpu_mic_src_report_scif_error(__starpu_func__, __FILE__, __LINE__, status)
  39. struct _starpu_mp_node *_starpu_mic_src_get_actual_thread_mp_node();
  40. struct _starpu_mp_node *_starpu_mic_src_get_mp_node_from_memory_node(int memory_node);
  41. void(* _starpu_mic_src_get_kernel_from_job(const struct _starpu_mp_node *node STARPU_ATTRIBUTE_UNUSED, struct _starpu_job *j))(void);
  42. int _starpu_mic_src_register_kernel(starpu_mic_func_symbol_t *symbol, const char *func_name);
  43. starpu_mic_kernel_t _starpu_mic_src_get_kernel(starpu_mic_func_symbol_t symbol);
  44. void _starpu_mic_src_report_coi_error(const char *func, const char *file, int line, const COIRESULT status);
  45. void _starpu_mic_src_report_scif_error(const char *func, const char *file, int line, const int status);
  46. unsigned _starpu_mic_src_get_device_count(void);
  47. starpu_mic_kernel_t _starpu_mic_src_get_kernel_from_codelet(struct starpu_codelet *cl, unsigned nimpl);
  48. void _starpu_mic_src_init(struct _starpu_mp_node *node);
  49. void _starpu_mic_clear_kernels(void);
  50. void _starpu_mic_src_deinit(struct _starpu_mp_node *node);
  51. size_t _starpu_mic_get_global_mem_size(int devid);
  52. size_t _starpu_mic_get_free_mem_size(int devid);
  53. int _starpu_mic_allocate_memory(void **addr, size_t size, unsigned memory_node);
  54. void _starpu_mic_free_memory(void *addr, size_t size, unsigned memory_node);
  55. int _starpu_mic_copy_ram_to_mic(void *src, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst, unsigned dst_node, size_t size);
  56. int _starpu_mic_copy_mic_to_ram(void *src, unsigned src_node, void *dst, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, size_t size);
  57. int _starpu_mic_copy_ram_to_mic_async(void *src, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst, unsigned dst_node, size_t size);
  58. int _starpu_mic_copy_mic_to_ram_async(void *src, unsigned src_node, void *dst, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, size_t size);
  59. int _starpu_mic_init_event(struct _starpu_mic_async_event *event, unsigned memory_node);
  60. void *_starpu_mic_src_worker(void *arg);
  61. #endif /* STARPU_USE_MIC */
  62. unsigned _starpu_mic_test_request_completion(struct _starpu_async_channel *async_channel);
  63. void _starpu_mic_wait_request_completion(struct _starpu_async_channel *async_channel);
  64. int _starpu_mic_copy_data_from_mic_to_cpu(starpu_data_handle_t handle, void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, struct _starpu_data_request *req);
  65. int _starpu_mic_copy_data_from_cpu_to_mic(starpu_data_handle_t handle, void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, struct _starpu_data_request *req);
  66. int _starpu_mic_copy_interface_from_mic_to_cpu(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, unsigned dst_node, size_t size, struct _starpu_async_channel *async_channel);
  67. int _starpu_mic_copy_interface_from_cpu_to_mic(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, unsigned dst_node, size_t size, struct _starpu_async_channel *async_channel);
  68. int _starpu_mic_is_direct_access_supported(unsigned node, unsigned handling_node);
  69. uintptr_t _starpu_mic_malloc_on_node(unsigned dst_node, size_t size, int flags);
  70. void _starpu_mic_free_on_node(unsigned dst_node, uintptr_t addr, size_t size, int flags);
  71. #endif /* __DRIVER_MIC_SOURCE_H__ */