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