compiler_if_target.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. Copyright (c) 2014-2016 Intel Corporation. All Rights Reserved.
  3. Redistribution and use in source and binary forms, with or without
  4. modification, are permitted provided that the following conditions
  5. are met:
  6. * Redistributions of source code must retain the above copyright
  7. notice, this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. * Neither the name of Intel Corporation nor the names of its
  12. contributors may be used to endorse or promote products derived
  13. from this software without specific prior written permission.
  14. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  15. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  16. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  18. HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  19. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  20. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  21. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  22. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  24. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. /*! \file
  27. \brief The interface between compiler-generated target code and runtime library
  28. */
  29. #ifndef COMPILER_IF_TARGET_H_INCLUDED
  30. #define COMPILER_IF_TARGET_H_INCLUDED
  31. #include "offload_target.h"
  32. #define OFFLOAD_TARGET_ENTER OFFLOAD_PREFIX(target_enter)
  33. #define OFFLOAD_TARGET_LEAVE OFFLOAD_PREFIX(target_leave)
  34. #define OFFLOAD_TARGET_MAIN OFFLOAD_PREFIX(target_main)
  35. /*! \fn OFFLOAD_TARGET_ENTER
  36. \brief Fill in variable addresses using VarDesc array.
  37. \brief Then call back the runtime library to fetch data.
  38. \param ofld Offload descriptor created by runtime.
  39. \param var_desc_num Number of variable descriptors.
  40. \param var_desc Pointer to VarDesc array.
  41. \param var_desc2 Pointer to VarDesc2 array.
  42. */
  43. extern "C" void OFFLOAD_TARGET_ENTER(
  44. OFFLOAD ofld,
  45. int var_desc_num,
  46. VarDesc *var_desc,
  47. VarDesc2 *var_desc2
  48. );
  49. /*! \fn OFFLOAD_TARGET_LEAVE
  50. \brief Call back the runtime library to gather outputs using VarDesc array.
  51. \param ofld Offload descriptor created by OFFLOAD_TARGET_ACQUIRE.
  52. */
  53. extern "C" void OFFLOAD_TARGET_LEAVE(
  54. OFFLOAD ofld
  55. );
  56. // Entry point for the target application.
  57. extern "C" void OFFLOAD_TARGET_MAIN(void);
  58. #endif // COMPILER_IF_TARGET_H_INCLUDED