Skip to content

Commit 499bee7

Browse files
committed
Check in auto-generated Offload files
1 parent 264b1a5 commit 499bee7

File tree

12 files changed

+985
-5
lines changed

12 files changed

+985
-5
lines changed

offload/new-api/CMakeLists.txt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,30 @@ tablegen(OFFLOAD offload_entry_points.inc -gen-entry-points)
88
tablegen(OFFLOAD offload_print.hpp -gen-print-header)
99
tablegen(OFFLOAD offload_exports -gen-exports)
1010

11-
add_public_tablegen_target(OffloadHeaderGen)
11+
foreach(itm IN LISTS TABLEGEN_OUTPUT)
12+
message(${itm})
13+
endforeach()
14+
15+
set(OFFLOAD_GENERATED_FILES ${TABLEGEN_OUTPUT})
16+
add_public_tablegen_target(OffloadGenerate)
17+
18+
add_custom_command(TARGET OffloadGenerate POST_BUILD COMMAND ${CMAKE_COMMAND}
19+
-E copy_if_different ${OFFLOAD_GENERATED_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/include")
1220

1321
add_llvm_library(offload_new SHARED
1422
src/offload_lib.cpp
1523
src/offload_impl.cpp
16-
DEPENDS OffloadHeaderGen)
24+
DEPENDS OffloadGenerate)
1725

1826
foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD)
1927
target_link_libraries(offload_new PRIVATE omptarget.rtl.${plugin})
2028
endforeach()
2129

2230
if(LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
23-
target_link_libraries(offload_new PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/offload_exports")
31+
target_link_libraries(offload_new PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/include/offload_exports")
2432
endif()
2533

2634
target_include_directories(offload_new PUBLIC
27-
${CMAKE_CURRENT_BINARY_DIR}
2835
${CMAKE_CURRENT_BINARY_DIR}/../include
2936
${CMAKE_CURRENT_SOURCE_DIR}/include
3037
${CMAKE_CURRENT_SOURCE_DIR}/../include
@@ -39,4 +46,4 @@ set_target_properties(offload_new PROPERTIES
3946
BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
4047
install(TARGETS offload_new LIBRARY COMPONENT offload_new DESTINATION "${OFFLOAD_INSTALL_LIBDIR}")
4148

42-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/offload_api.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/offload)
49+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/offload_api.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/offload)

offload/new-api/include/offload_api.h

Lines changed: 342 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
//===- Auto-generated file, part of the LLVM/Offload project --------------===//
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+
///////////////////////////////////////////////////////////////////////////////
10+
offload_result_t offloadGetErrorDetails_val(
11+
size_t* SizeRet, const char** DetailStringRet) {
12+
if (true /*enableParameterValidation*/) {
13+
}
14+
15+
return offloadGetErrorDetails_impl(SizeRet, DetailStringRet);
16+
17+
}
18+
OFFLOAD_APIEXPORT offload_result_t OFFLOAD_APICALL offloadGetErrorDetails(
19+
size_t* SizeRet, const char** DetailStringRet) {
20+
if (std::getenv("OFFLOAD_TRACE")) {
21+
std::cout << "---> offloadGetErrorDetails";
22+
}
23+
24+
offload_result_t result = offloadGetErrorDetails_val(SizeRet, DetailStringRet);
25+
26+
if (std::getenv("OFFLOAD_TRACE")) {
27+
offload_get_error_details_params_t Params = { &SizeRet, &DetailStringRet};
28+
std::cout << "(" << &Params << ")";
29+
std::cout << "-> " << result << "\n";
30+
if (result != OFFLOAD_RESULT_SUCCESS && LastErrorDetails()) {
31+
std::cout << " *Error Details* " << *LastErrorDetails() << " \n";
32+
}
33+
}
34+
return result;
35+
}
36+
37+
///////////////////////////////////////////////////////////////////////////////
38+
offload_result_t offloadPlatformGet_val(
39+
uint32_t NumEntries, offload_platform_handle_t* phPlatforms, uint32_t* pNumPlatforms) {
40+
if (true /*enableParameterValidation*/) {
41+
if (NumEntries == 0 && phPlatforms != NULL) {
42+
return OFFLOAD_RESULT_ERROR_INVALID_SIZE;
43+
}
44+
45+
}
46+
47+
return offloadPlatformGet_impl(NumEntries, phPlatforms, pNumPlatforms);
48+
49+
}
50+
OFFLOAD_APIEXPORT offload_result_t OFFLOAD_APICALL offloadPlatformGet(
51+
uint32_t NumEntries, offload_platform_handle_t* phPlatforms, uint32_t* pNumPlatforms) {
52+
if (std::getenv("OFFLOAD_TRACE")) {
53+
std::cout << "---> offloadPlatformGet";
54+
}
55+
56+
offload_result_t result = offloadPlatformGet_val(NumEntries, phPlatforms, pNumPlatforms);
57+
58+
if (std::getenv("OFFLOAD_TRACE")) {
59+
offload_platform_get_params_t Params = { &NumEntries, &phPlatforms, &pNumPlatforms};
60+
std::cout << "(" << &Params << ")";
61+
std::cout << "-> " << result << "\n";
62+
if (result != OFFLOAD_RESULT_SUCCESS && LastErrorDetails()) {
63+
std::cout << " *Error Details* " << *LastErrorDetails() << " \n";
64+
}
65+
}
66+
return result;
67+
}
68+
69+
///////////////////////////////////////////////////////////////////////////////
70+
offload_result_t offloadPlatformGetInfo_val(
71+
offload_platform_handle_t hPlatform, offload_platform_info_t propName, size_t propSize, void* pPropValue, size_t* pPropSizeRet) {
72+
if (true /*enableParameterValidation*/) {
73+
if (propSize == 0 && pPropValue != NULL) {
74+
return OFFLOAD_RESULT_ERROR_INVALID_SIZE;
75+
}
76+
77+
if (propSize != 0 && pPropValue == NULL) {
78+
return OFFLOAD_RESULT_ERROR_INVALID_NULL_POINTER;
79+
}
80+
81+
if (pPropValue == NULL && pPropSizeRet == NULL) {
82+
return OFFLOAD_RESULT_ERROR_INVALID_NULL_POINTER;
83+
}
84+
85+
if (NULL == hPlatform) {
86+
return OFFLOAD_RESULT_ERROR_INVALID_NULL_HANDLE;
87+
}
88+
89+
}
90+
91+
return offloadPlatformGetInfo_impl(hPlatform, propName, propSize, pPropValue, pPropSizeRet);
92+
93+
}
94+
OFFLOAD_APIEXPORT offload_result_t OFFLOAD_APICALL offloadPlatformGetInfo(
95+
offload_platform_handle_t hPlatform, offload_platform_info_t propName, size_t propSize, void* pPropValue, size_t* pPropSizeRet) {
96+
if (std::getenv("OFFLOAD_TRACE")) {
97+
std::cout << "---> offloadPlatformGetInfo";
98+
}
99+
100+
offload_result_t result = offloadPlatformGetInfo_val(hPlatform, propName, propSize, pPropValue, pPropSizeRet);
101+
102+
if (std::getenv("OFFLOAD_TRACE")) {
103+
offload_platform_get_info_params_t Params = { &hPlatform, &propName, &propSize, &pPropValue, &pPropSizeRet};
104+
std::cout << "(" << &Params << ")";
105+
std::cout << "-> " << result << "\n";
106+
if (result != OFFLOAD_RESULT_SUCCESS && LastErrorDetails()) {
107+
std::cout << " *Error Details* " << *LastErrorDetails() << " \n";
108+
}
109+
}
110+
return result;
111+
}
112+
113+
///////////////////////////////////////////////////////////////////////////////
114+
offload_result_t offloadDeviceGet_val(
115+
offload_platform_handle_t hPlatform, offload_device_type_t DeviceType, uint32_t NumEntries, offload_device_handle_t* phDevices, uint32_t* pNumDevices) {
116+
if (true /*enableParameterValidation*/) {
117+
if (NumEntries == 0 && phDevices != NULL) {
118+
return OFFLOAD_RESULT_ERROR_INVALID_SIZE;
119+
}
120+
121+
if (NumEntries > 0 && phDevices == NULL) {
122+
return OFFLOAD_RESULT_ERROR_INVALID_NULL_POINTER;
123+
}
124+
125+
if (NULL == hPlatform) {
126+
return OFFLOAD_RESULT_ERROR_INVALID_NULL_HANDLE;
127+
}
128+
129+
}
130+
131+
return offloadDeviceGet_impl(hPlatform, DeviceType, NumEntries, phDevices, pNumDevices);
132+
133+
}
134+
OFFLOAD_APIEXPORT offload_result_t OFFLOAD_APICALL offloadDeviceGet(
135+
offload_platform_handle_t hPlatform, offload_device_type_t DeviceType, uint32_t NumEntries, offload_device_handle_t* phDevices, uint32_t* pNumDevices) {
136+
if (std::getenv("OFFLOAD_TRACE")) {
137+
std::cout << "---> offloadDeviceGet";
138+
}
139+
140+
offload_result_t result = offloadDeviceGet_val(hPlatform, DeviceType, NumEntries, phDevices, pNumDevices);
141+
142+
if (std::getenv("OFFLOAD_TRACE")) {
143+
offload_device_get_params_t Params = { &hPlatform, &DeviceType, &NumEntries, &phDevices, &pNumDevices};
144+
std::cout << "(" << &Params << ")";
145+
std::cout << "-> " << result << "\n";
146+
if (result != OFFLOAD_RESULT_SUCCESS && LastErrorDetails()) {
147+
std::cout << " *Error Details* " << *LastErrorDetails() << " \n";
148+
}
149+
}
150+
return result;
151+
}
152+
153+
///////////////////////////////////////////////////////////////////////////////
154+
offload_result_t offloadDeviceGetInfo_val(
155+
offload_device_handle_t hDevice, offload_device_info_t propName, size_t propSize, void* pPropValue, size_t* pPropSizeRet) {
156+
if (true /*enableParameterValidation*/) {
157+
if (propSize == 0 && pPropValue != NULL) {
158+
return OFFLOAD_RESULT_ERROR_INVALID_SIZE;
159+
}
160+
161+
if (propSize != 0 && pPropValue == NULL) {
162+
return OFFLOAD_RESULT_ERROR_INVALID_NULL_POINTER;
163+
}
164+
165+
if (pPropValue == NULL && pPropSizeRet == NULL) {
166+
return OFFLOAD_RESULT_ERROR_INVALID_NULL_POINTER;
167+
}
168+
169+
if (NULL == hDevice) {
170+
return OFFLOAD_RESULT_ERROR_INVALID_NULL_HANDLE;
171+
}
172+
173+
}
174+
175+
return offloadDeviceGetInfo_impl(hDevice, propName, propSize, pPropValue, pPropSizeRet);
176+
177+
}
178+
OFFLOAD_APIEXPORT offload_result_t OFFLOAD_APICALL offloadDeviceGetInfo(
179+
offload_device_handle_t hDevice, offload_device_info_t propName, size_t propSize, void* pPropValue, size_t* pPropSizeRet) {
180+
if (std::getenv("OFFLOAD_TRACE")) {
181+
std::cout << "---> offloadDeviceGetInfo";
182+
}
183+
184+
offload_result_t result = offloadDeviceGetInfo_val(hDevice, propName, propSize, pPropValue, pPropSizeRet);
185+
186+
if (std::getenv("OFFLOAD_TRACE")) {
187+
offload_device_get_info_params_t Params = { &hDevice, &propName, &propSize, &pPropValue, &pPropSizeRet};
188+
std::cout << "(" << &Params << ")";
189+
std::cout << "-> " << result << "\n";
190+
if (result != OFFLOAD_RESULT_SUCCESS && LastErrorDetails()) {
191+
std::cout << " *Error Details* " << *LastErrorDetails() << " \n";
192+
}
193+
}
194+
return result;
195+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
VERS1.0 {
2+
global:
3+
offloadGetErrorDetails;
4+
offloadPlatformGet;
5+
offloadPlatformGetInfo;
6+
offloadDeviceGet;
7+
offloadDeviceGetInfo;
8+
local:
9+
*;
10+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//===- Auto-generated file, part of the LLVM/Offload project --------------===//
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+
#ifndef OFFLOAD_FUNC
10+
#error Please define the macro OFFLOAD_FUNC(Function)
11+
#endif
12+
13+
OFFLOAD_FUNC(offloadGetErrorDetails)
14+
OFFLOAD_FUNC(offloadPlatformGet)
15+
OFFLOAD_FUNC(offloadPlatformGetInfo)
16+
OFFLOAD_FUNC(offloadDeviceGet)
17+
OFFLOAD_FUNC(offloadDeviceGetInfo)
18+
19+
#undef OFFLOAD_FUNC
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//===- Auto-generated file, part of the LLVM/Offload project --------------===//
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+
offload_result_t offloadGetErrorDetails_impl(size_t* SizeRet, const char** DetailStringRet);
9+
offload_impl_result_t offloadPlatformGet_impl(uint32_t NumEntries, offload_platform_handle_t* phPlatforms, uint32_t* pNumPlatforms);
10+
offload_impl_result_t offloadPlatformGetInfo_impl(offload_platform_handle_t hPlatform, offload_platform_info_t propName, size_t propSize, void* pPropValue, size_t* pPropSizeRet);
11+
offload_impl_result_t offloadDeviceGet_impl(offload_platform_handle_t hPlatform, offload_device_type_t DeviceType, uint32_t NumEntries, offload_device_handle_t* phDevices, uint32_t* pNumDevices);
12+
offload_impl_result_t offloadDeviceGetInfo_impl(offload_device_handle_t hDevice, offload_device_info_t propName, size_t propSize, void* pPropValue, size_t* pPropSizeRet);

0 commit comments

Comments
 (0)