1 //===-------- LegacyAPI.cpp - Target independent OpenMP target RTL --------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Legacy interfaces for libomptarget used to maintain backwards-compatibility.
11 //===----------------------------------------------------------------------===//
13 #include "omptarget.h"
16 EXTERN
void __tgt_target_data_begin(int64_t DeviceId
, int32_t ArgNum
,
17 void **ArgsBase
, void **Args
,
18 int64_t *ArgSizes
, int64_t *ArgTypes
) {
20 __tgt_target_data_begin_mapper(nullptr, DeviceId
, ArgNum
, ArgsBase
, Args
,
21 ArgSizes
, ArgTypes
, nullptr, nullptr);
24 EXTERN
void __tgt_target_data_begin_nowait(int64_t DeviceId
, int32_t ArgNum
,
25 void **ArgsBase
, void **Args
,
26 int64_t *ArgSizes
, int64_t *ArgTypes
,
27 int32_t DepNum
, void *DepList
,
28 int32_t NoAliasDepNum
,
29 void *NoAliasDepList
) {
32 __tgt_target_data_begin_mapper(nullptr, DeviceId
, ArgNum
, ArgsBase
, Args
,
33 ArgSizes
, ArgTypes
, nullptr, nullptr);
36 EXTERN
void __tgt_target_data_end(int64_t DeviceId
, int32_t ArgNum
,
37 void **ArgsBase
, void **Args
,
38 int64_t *ArgSizes
, int64_t *ArgTypes
) {
40 __tgt_target_data_end_mapper(nullptr, DeviceId
, ArgNum
, ArgsBase
, Args
,
41 ArgSizes
, ArgTypes
, nullptr, nullptr);
44 EXTERN
void __tgt_target_data_update(int64_t DeviceId
, int32_t ArgNum
,
45 void **ArgsBase
, void **Args
,
46 int64_t *ArgSizes
, int64_t *ArgTypes
) {
48 __tgt_target_data_update_mapper(nullptr, DeviceId
, ArgNum
, ArgsBase
, Args
,
49 ArgSizes
, ArgTypes
, nullptr, nullptr);
52 EXTERN
void __tgt_target_data_update_nowait(
53 int64_t DeviceId
, int32_t ArgNum
, void **ArgsBase
, void **Args
,
54 int64_t *ArgSizes
, int64_t *ArgTypes
, int32_t DepNum
, void *DepList
,
55 int32_t NoAliasDepNum
, void *NoAliasDepList
) {
58 __tgt_target_data_update_mapper(nullptr, DeviceId
, ArgNum
, ArgsBase
, Args
,
59 ArgSizes
, ArgTypes
, nullptr, nullptr);
62 EXTERN
void __tgt_target_data_end_nowait(int64_t DeviceId
, int32_t ArgNum
,
63 void **ArgsBase
, void **Args
,
64 int64_t *ArgSizes
, int64_t *ArgTypes
,
65 int32_t DepNum
, void *DepList
,
66 int32_t NoAliasDepNum
,
67 void *NoAliasDepList
) {
70 __tgt_target_data_end_mapper(nullptr, DeviceId
, ArgNum
, ArgsBase
, Args
,
71 ArgSizes
, ArgTypes
, nullptr, nullptr);
74 EXTERN
int __tgt_target_mapper(ident_t
*Loc
, int64_t DeviceId
, void *HostPtr
,
75 uint32_t ArgNum
, void **ArgsBase
, void **Args
,
76 int64_t *ArgSizes
, int64_t *ArgTypes
,
77 map_var_info_t
*ArgNames
, void **ArgMappers
) {
78 TIMESCOPE_WITH_IDENT(Loc
);
79 KernelArgsTy KernelArgs
{1, ArgNum
, ArgsBase
, Args
, ArgSizes
,
80 ArgTypes
, ArgNames
, ArgMappers
, 0};
81 return __tgt_target_kernel(Loc
, DeviceId
, -1, -1, HostPtr
, &KernelArgs
);
84 EXTERN
int __tgt_target(int64_t DeviceId
, void *HostPtr
, int32_t ArgNum
,
85 void **ArgsBase
, void **Args
, int64_t *ArgSizes
,
88 return __tgt_target_mapper(nullptr, DeviceId
, HostPtr
, ArgNum
, ArgsBase
, Args
,
89 ArgSizes
, ArgTypes
, nullptr, nullptr);
92 EXTERN
int __tgt_target_nowait(int64_t DeviceId
, void *HostPtr
, int32_t ArgNum
,
93 void **ArgsBase
, void **Args
, int64_t *ArgSizes
,
94 int64_t *ArgTypes
, int32_t DepNum
, void *DepList
,
95 int32_t NoAliasDepNum
, void *NoAliasDepList
) {
98 return __tgt_target_mapper(nullptr, DeviceId
, HostPtr
, ArgNum
, ArgsBase
, Args
,
99 ArgSizes
, ArgTypes
, nullptr, nullptr);
102 EXTERN
int __tgt_target_nowait_mapper(
103 ident_t
*Loc
, int64_t DeviceId
, void *HostPtr
, int32_t ArgNum
,
104 void **ArgsBase
, void **Args
, int64_t *ArgSizes
, int64_t *ArgTypes
,
105 map_var_info_t
*ArgNames
, void **ArgMappers
, int32_t DepNum
, void *DepList
,
106 int32_t NoAliasDepNum
, void *NoAliasDepList
) {
107 TIMESCOPE_WITH_IDENT(Loc
);
109 return __tgt_target_mapper(Loc
, DeviceId
, HostPtr
, ArgNum
, ArgsBase
, Args
,
110 ArgSizes
, ArgTypes
, ArgNames
, ArgMappers
);
113 EXTERN
int __tgt_target_teams_mapper(ident_t
*Loc
, int64_t DeviceId
,
114 void *HostPtr
, uint32_t ArgNum
,
115 void **ArgsBase
, void **Args
,
116 int64_t *ArgSizes
, int64_t *ArgTypes
,
117 map_var_info_t
*ArgNames
,
118 void **ArgMappers
, int32_t NumTeams
,
119 int32_t ThreadLimit
) {
120 TIMESCOPE_WITH_IDENT(Loc
);
122 KernelArgsTy KernelArgs
{1, ArgNum
, ArgsBase
, Args
, ArgSizes
,
123 ArgTypes
, ArgNames
, ArgMappers
, 0};
124 return __tgt_target_kernel(Loc
, DeviceId
, NumTeams
, ThreadLimit
, HostPtr
,
128 EXTERN
int __tgt_target_teams(int64_t DeviceId
, void *HostPtr
, int32_t ArgNum
,
129 void **ArgsBase
, void **Args
, int64_t *ArgSizes
,
130 int64_t *ArgTypes
, int32_t NumTeams
,
131 int32_t ThreadLimit
) {
133 return __tgt_target_teams_mapper(nullptr, DeviceId
, HostPtr
, ArgNum
, ArgsBase
,
134 Args
, ArgSizes
, ArgTypes
, nullptr, nullptr,
135 NumTeams
, ThreadLimit
);
138 EXTERN
int __tgt_target_teams_nowait(int64_t DeviceId
, void *HostPtr
,
139 int32_t ArgNum
, void **ArgsBase
,
140 void **Args
, int64_t *ArgSizes
,
141 int64_t *ArgTypes
, int32_t NumTeams
,
142 int32_t ThreadLimit
, int32_t DepNum
,
143 void *DepList
, int32_t NoAliasDepNum
,
144 void *NoAliasDepList
) {
147 return __tgt_target_teams_mapper(nullptr, DeviceId
, HostPtr
, ArgNum
, ArgsBase
,
148 Args
, ArgSizes
, ArgTypes
, nullptr, nullptr,
149 NumTeams
, ThreadLimit
);
152 EXTERN
int __tgt_target_teams_nowait_mapper(
153 ident_t
*Loc
, int64_t DeviceId
, void *HostPtr
, int32_t ArgNum
,
154 void **ArgsBase
, void **Args
, int64_t *ArgSizes
, int64_t *ArgTypes
,
155 map_var_info_t
*ArgNames
, void **ArgMappers
, int32_t NumTeams
,
156 int32_t ThreadLimit
, int32_t DepNum
, void *DepList
, int32_t NoAliasDepNum
,
157 void *NoAliasDepList
) {
158 TIMESCOPE_WITH_IDENT(Loc
);
160 return __tgt_target_teams_mapper(Loc
, DeviceId
, HostPtr
, ArgNum
, ArgsBase
,
161 Args
, ArgSizes
, ArgTypes
, ArgNames
,
162 ArgMappers
, NumTeams
, ThreadLimit
);
165 EXTERN
void __kmpc_push_target_tripcount_mapper(ident_t
*Loc
, int64_t DeviceId
,
166 uint64_t LoopTripcount
) {
167 TIMESCOPE_WITH_IDENT(Loc
);
168 DP("WARNING: __kmpc_push_target_tripcount has been deprecated and is a noop");
171 EXTERN
void __kmpc_push_target_tripcount(int64_t DeviceId
,
172 uint64_t LoopTripcount
) {
173 __kmpc_push_target_tripcount_mapper(nullptr, DeviceId
, LoopTripcount
);
176 EXTERN
int __tgt_target_kernel_nowait(ident_t
*Loc
, int64_t DeviceId
,
177 int32_t NumTeams
, int32_t ThreadLimit
,
178 void *HostPtr
, KernelArgsTy
*KernelArgs
,
179 int32_t DepNum
, void *DepList
,
180 int32_t NoAliasDepNum
,
181 void *NoAliasDepList
) {
182 TIMESCOPE_WITH_IDENT(Loc
);
183 return __tgt_target_kernel(Loc
, DeviceId
, NumTeams
, ThreadLimit
, HostPtr
,