llvm-project

Форк
0
/
LegacyAPI.cpp 
201 строка · 10.0 Кб
1
//===-------- LegacyAPI.cpp - Target independent OpenMP target RTL --------===//
2
//
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
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// Legacy interfaces for libomptarget used to maintain backwards-compatibility.
10
//
11
//===----------------------------------------------------------------------===//
12

13
#include "OpenMP/OMPT/Interface.h"
14
#include "omptarget.h"
15
#include "private.h"
16

17
#include "Shared/Profile.h"
18

19
#ifdef OMPT_SUPPORT
20
using namespace llvm::omp::target::ompt;
21
#endif
22

23
EXTERN void __tgt_target_data_begin(int64_t DeviceId, int32_t ArgNum,
24
                                    void **ArgsBase, void **Args,
25
                                    int64_t *ArgSizes, int64_t *ArgTypes) {
26
  TIMESCOPE();
27
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
28
  __tgt_target_data_begin_mapper(nullptr, DeviceId, ArgNum, ArgsBase, Args,
29
                                 ArgSizes, ArgTypes, nullptr, nullptr);
30
}
31

32
EXTERN void __tgt_target_data_begin_nowait(int64_t DeviceId, int32_t ArgNum,
33
                                           void **ArgsBase, void **Args,
34
                                           int64_t *ArgSizes, int64_t *ArgTypes,
35
                                           int32_t DepNum, void *DepList,
36
                                           int32_t NoAliasDepNum,
37
                                           void *NoAliasDepList) {
38
  TIMESCOPE();
39
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
40
  __tgt_target_data_begin_mapper(nullptr, DeviceId, ArgNum, ArgsBase, Args,
41
                                 ArgSizes, ArgTypes, nullptr, nullptr);
42
}
43

44
EXTERN void __tgt_target_data_end(int64_t DeviceId, int32_t ArgNum,
45
                                  void **ArgsBase, void **Args,
46
                                  int64_t *ArgSizes, int64_t *ArgTypes) {
47
  TIMESCOPE();
48
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
49
  __tgt_target_data_end_mapper(nullptr, DeviceId, ArgNum, ArgsBase, Args,
50
                               ArgSizes, ArgTypes, nullptr, nullptr);
51
}
52

53
EXTERN void __tgt_target_data_update(int64_t DeviceId, int32_t ArgNum,
54
                                     void **ArgsBase, void **Args,
55
                                     int64_t *ArgSizes, int64_t *ArgTypes) {
56
  TIMESCOPE();
57
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
58
  __tgt_target_data_update_mapper(nullptr, DeviceId, ArgNum, ArgsBase, Args,
59
                                  ArgSizes, ArgTypes, nullptr, nullptr);
60
}
61

62
EXTERN void __tgt_target_data_update_nowait(
63
    int64_t DeviceId, int32_t ArgNum, void **ArgsBase, void **Args,
64
    int64_t *ArgSizes, int64_t *ArgTypes, int32_t DepNum, void *DepList,
65
    int32_t NoAliasDepNum, void *NoAliasDepList) {
66
  TIMESCOPE();
67
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
68
  __tgt_target_data_update_mapper(nullptr, DeviceId, ArgNum, ArgsBase, Args,
69
                                  ArgSizes, ArgTypes, nullptr, nullptr);
70
}
71

72
EXTERN void __tgt_target_data_end_nowait(int64_t DeviceId, int32_t ArgNum,
73
                                         void **ArgsBase, void **Args,
74
                                         int64_t *ArgSizes, int64_t *ArgTypes,
75
                                         int32_t DepNum, void *DepList,
76
                                         int32_t NoAliasDepNum,
77
                                         void *NoAliasDepList) {
78
  TIMESCOPE();
79
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
80
  __tgt_target_data_end_mapper(nullptr, DeviceId, ArgNum, ArgsBase, Args,
81
                               ArgSizes, ArgTypes, nullptr, nullptr);
82
}
83

84
EXTERN int __tgt_target_mapper(ident_t *Loc, int64_t DeviceId, void *HostPtr,
85
                               uint32_t ArgNum, void **ArgsBase, void **Args,
86
                               int64_t *ArgSizes, int64_t *ArgTypes,
87
                               map_var_info_t *ArgNames, void **ArgMappers) {
88
  TIMESCOPE_WITH_IDENT(Loc);
89
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
90
  KernelArgsTy KernelArgs{1,        ArgNum,   ArgsBase,   Args, ArgSizes,
91
                          ArgTypes, ArgNames, ArgMappers, 0,    {},
92
                          {},       {},       0};
93
  return __tgt_target_kernel(Loc, DeviceId, -1, -1, HostPtr, &KernelArgs);
94
}
95

96
EXTERN int __tgt_target(int64_t DeviceId, void *HostPtr, int32_t ArgNum,
97
                        void **ArgsBase, void **Args, int64_t *ArgSizes,
98
                        int64_t *ArgTypes) {
99
  TIMESCOPE();
100
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
101
  return __tgt_target_mapper(nullptr, DeviceId, HostPtr, ArgNum, ArgsBase, Args,
102
                             ArgSizes, ArgTypes, nullptr, nullptr);
103
}
104

105
EXTERN int __tgt_target_nowait(int64_t DeviceId, void *HostPtr, int32_t ArgNum,
106
                               void **ArgsBase, void **Args, int64_t *ArgSizes,
107
                               int64_t *ArgTypes, int32_t DepNum, void *DepList,
108
                               int32_t NoAliasDepNum, void *NoAliasDepList) {
109
  TIMESCOPE();
110
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
111
  return __tgt_target_mapper(nullptr, DeviceId, HostPtr, ArgNum, ArgsBase, Args,
112
                             ArgSizes, ArgTypes, nullptr, nullptr);
113
}
114

115
EXTERN int __tgt_target_nowait_mapper(
116
    ident_t *Loc, int64_t DeviceId, void *HostPtr, int32_t ArgNum,
117
    void **ArgsBase, void **Args, int64_t *ArgSizes, int64_t *ArgTypes,
118
    map_var_info_t *ArgNames, void **ArgMappers, int32_t DepNum, void *DepList,
119
    int32_t NoAliasDepNum, void *NoAliasDepList) {
120
  TIMESCOPE_WITH_IDENT(Loc);
121
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
122
  return __tgt_target_mapper(Loc, DeviceId, HostPtr, ArgNum, ArgsBase, Args,
123
                             ArgSizes, ArgTypes, ArgNames, ArgMappers);
124
}
125

126
EXTERN int __tgt_target_teams_mapper(ident_t *Loc, int64_t DeviceId,
127
                                     void *HostPtr, uint32_t ArgNum,
128
                                     void **ArgsBase, void **Args,
129
                                     int64_t *ArgSizes, int64_t *ArgTypes,
130
                                     map_var_info_t *ArgNames,
131
                                     void **ArgMappers, int32_t NumTeams,
132
                                     int32_t ThreadLimit) {
133
  TIMESCOPE_WITH_IDENT(Loc);
134
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
135
  KernelArgsTy KernelArgs{1,        ArgNum,   ArgsBase,   Args, ArgSizes,
136
                          ArgTypes, ArgNames, ArgMappers, 0,    {},
137
                          {},       {},       0};
138
  return __tgt_target_kernel(Loc, DeviceId, NumTeams, ThreadLimit, HostPtr,
139
                             &KernelArgs);
140
}
141

142
EXTERN int __tgt_target_teams(int64_t DeviceId, void *HostPtr, int32_t ArgNum,
143
                              void **ArgsBase, void **Args, int64_t *ArgSizes,
144
                              int64_t *ArgTypes, int32_t NumTeams,
145
                              int32_t ThreadLimit) {
146
  TIMESCOPE();
147
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
148
  return __tgt_target_teams_mapper(nullptr, DeviceId, HostPtr, ArgNum, ArgsBase,
149
                                   Args, ArgSizes, ArgTypes, nullptr, nullptr,
150
                                   NumTeams, ThreadLimit);
151
}
152

153
EXTERN int __tgt_target_teams_nowait(int64_t DeviceId, void *HostPtr,
154
                                     int32_t ArgNum, void **ArgsBase,
155
                                     void **Args, int64_t *ArgSizes,
156
                                     int64_t *ArgTypes, int32_t NumTeams,
157
                                     int32_t ThreadLimit, int32_t DepNum,
158
                                     void *DepList, int32_t NoAliasDepNum,
159
                                     void *NoAliasDepList) {
160
  TIMESCOPE();
161
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
162
  return __tgt_target_teams_mapper(nullptr, DeviceId, HostPtr, ArgNum, ArgsBase,
163
                                   Args, ArgSizes, ArgTypes, nullptr, nullptr,
164
                                   NumTeams, ThreadLimit);
165
}
166

167
EXTERN int __tgt_target_teams_nowait_mapper(
168
    ident_t *Loc, int64_t DeviceId, void *HostPtr, int32_t ArgNum,
169
    void **ArgsBase, void **Args, int64_t *ArgSizes, int64_t *ArgTypes,
170
    map_var_info_t *ArgNames, void **ArgMappers, int32_t NumTeams,
171
    int32_t ThreadLimit, int32_t DepNum, void *DepList, int32_t NoAliasDepNum,
172
    void *NoAliasDepList) {
173
  TIMESCOPE_WITH_IDENT(Loc);
174
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
175
  return __tgt_target_teams_mapper(Loc, DeviceId, HostPtr, ArgNum, ArgsBase,
176
                                   Args, ArgSizes, ArgTypes, ArgNames,
177
                                   ArgMappers, NumTeams, ThreadLimit);
178
}
179

180
EXTERN void __kmpc_push_target_tripcount_mapper(ident_t *Loc, int64_t DeviceId,
181
                                                uint64_t LoopTripcount) {
182
  TIMESCOPE_WITH_IDENT(Loc);
183
  DP("WARNING: __kmpc_push_target_tripcount has been deprecated and is a noop");
184
}
185

186
EXTERN void __kmpc_push_target_tripcount(int64_t DeviceId,
187
                                         uint64_t LoopTripcount) {
188
  __kmpc_push_target_tripcount_mapper(nullptr, DeviceId, LoopTripcount);
189
}
190

191
EXTERN int __tgt_target_kernel_nowait(ident_t *Loc, int64_t DeviceId,
192
                                      int32_t NumTeams, int32_t ThreadLimit,
193
                                      void *HostPtr, KernelArgsTy *KernelArgs,
194
                                      int32_t DepNum, void *DepList,
195
                                      int32_t NoAliasDepNum,
196
                                      void *NoAliasDepList) {
197
  TIMESCOPE_WITH_IDENT(Loc);
198
  OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
199
  return __tgt_target_kernel(Loc, DeviceId, NumTeams, ThreadLimit, HostPtr,
200
                             KernelArgs);
201
}
202

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.