Skip to content

Commit 770f56e

Browse files
committed
Rename new offload library and try to match LLVM style
1 parent 0004013 commit 770f56e

35 files changed

+82
-100
lines changed

offload/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ add_subdirectory(tools)
378378
add_subdirectory(src)
379379

380380
add_subdirectory(tools/offload-tblgen)
381-
add_subdirectory(new-api)
381+
add_subdirectory(liboffload)
382382

383383
# Add tests.
384384
add_subdirectory(test)
File renamed without changes.

offload/new-api/API/CMakeLists.txt renamed to offload/liboffload/API/CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@ find_program(CLANG_FORMAT clang-format PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT
66
if (CLANG_FORMAT)
77
set(LLVM_TARGET_DEFINITIONS ${CMAKE_CURRENT_SOURCE_DIR}/OffloadAPI.td)
88

9-
tablegen(OFFLOAD offload_api.h -gen-api)
10-
tablegen(OFFLOAD offload_funcs.inc -gen-func-names)
11-
tablegen(OFFLOAD offload_impl_func_decls.inc -gen-impl-func-decls)
12-
tablegen(OFFLOAD offload_entry_points.inc -gen-entry-points)
13-
tablegen(OFFLOAD offload_print.hpp -gen-print-header)
14-
tablegen(OFFLOAD offload_exports -gen-exports)
9+
tablegen(OFFLOAD OffloadAPI.h -gen-api)
10+
tablegen(OFFLOAD OffloadFuncs.inc -gen-func-names)
11+
tablegen(OFFLOAD OffloadImplFuncDecls.inc -gen-impl-func-decls)
12+
tablegen(OFFLOAD OffloadPrint.hpp -gen-print-header)
13+
tablegen(OFFLOAD OffloadExports -gen-exports)
1514

1615
set(OFFLOAD_GENERATED_FILES ${TABLEGEN_OUTPUT})
1716
add_public_tablegen_target(OffloadGenerate)
1817
add_custom_command(TARGET OffloadGenerate POST_BUILD COMMAND ${CLANG_FORMAT}
1918
-i ${OFFLOAD_GENERATED_FILES})
2019
add_custom_command(TARGET OffloadGenerate POST_BUILD COMMAND ${CMAKE_COMMAND}
21-
-E copy_if_different ${OFFLOAD_GENERATED_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/../include")
20+
-E copy_if_different ${OFFLOAD_GENERATED_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/../include/generated")
2221
else()
2322
message(WARNING "clang-format was not found, so the OffloadGenerate target\
2423
will not be available. Offload will still build, but you will not be\
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

offload/liboffload/CMakeLists.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
add_subdirectory(API)
2+
3+
add_llvm_library(LLVMOffload SHARED
4+
src/OffloadLib.cpp
5+
src/OffloadImpl.cpp)
6+
7+
foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD)
8+
target_link_libraries(LLVMOffload PRIVATE omptarget.rtl.${plugin})
9+
endforeach()
10+
11+
if(LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
12+
target_link_libraries(LLVMOffload PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
13+
endif()
14+
15+
target_include_directories(LLVMOffload PUBLIC
16+
${CMAKE_CURRENT_BINARY_DIR}/../include
17+
${CMAKE_CURRENT_SOURCE_DIR}/include
18+
${CMAKE_CURRENT_SOURCE_DIR}/include/generated
19+
${CMAKE_CURRENT_SOURCE_DIR}/../include
20+
${CMAKE_CURRENT_SOURCE_DIR}/../plugins-nextgen/common/include)
21+
22+
target_compile_options(LLVMOffload PRIVATE ${offload_compile_flags})
23+
target_link_options(LLVMOffload PRIVATE ${offload_link_flags})
24+
25+
set_target_properties(LLVMOffload PROPERTIES
26+
POSITION_INDEPENDENT_CODE ON
27+
INSTALL_RPATH "$ORIGIN"
28+
BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
29+
install(TARGETS LLVMOffload LIBRARY COMPONENT LLVMOffload DESTINATION "${OFFLOAD_INSTALL_LIBDIR}")
30+
31+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/OffloadAPI.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/offload)
32+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/OffloadPrint.hpp DESTINATION ${CMAKE_INSTALL_PREFIX}/include/offload)
File renamed without changes.

offload/liboffload/exports

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
VERS1.0 {
2+
global:
3+
ol*;
4+
local:
5+
*;
6+
};

offload/new-api/include/offload_impl.hpp renamed to offload/liboffload/include/OffloadImpl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//===----------------------------------------------------------------------===//
88
#pragma once
99

10+
#include <OffloadAPI.h>
1011
#include <iostream>
1112
#include <memory>
12-
#include <offload_api.h>
1313
#include <optional>
1414
#include <set>
1515
#include <string>

offload/new-api/include/offload_print.hpp renamed to offload/liboffload/include/generated/OffloadPrint.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#pragma once
1212

13-
#include <offload_api.h>
13+
#include <OffloadAPI.h>
1414
#include <ostream>
1515

1616
template <typename T>

offload/new-api/src/helpers.hpp renamed to offload/liboffload/src/Helpers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#include "offload_api.h"
15+
#include "OffloadAPI.h"
1616

1717
#include <cstring>
1818

offload/new-api/src/offload_impl.cpp renamed to offload/liboffload/src/OffloadImpl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
#include "offload_impl.hpp"
14+
#include "OffloadImpl.hpp"
15+
#include "Helpers.hpp"
1516
#include "PluginManager.h"
16-
#include "helpers.hpp"
1717
#include "llvm/Support/FormatVariadic.h"
18-
#include <offload_api.h>
18+
#include <OffloadAPI.h>
1919

2020
#include <mutex>
2121

offload/new-api/src/offload_lib.cpp renamed to offload/liboffload/src/OffloadLib.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "offload_impl.hpp"
14-
#include <offload_api.h>
15-
#include <offload_print.hpp>
13+
#include "OffloadImpl.hpp"
14+
#include <OffloadAPI.h>
15+
#include <OffloadPrint.hpp>
1616

1717
#include <iostream>
1818

@@ -38,7 +38,7 @@ OffloadConfig &offloadConfig() {
3838

3939
// Pull in the declarations for the implementation funtions. The actual entry
4040
// points in this file wrap these.
41-
#include "offload_impl_func_decls.inc"
41+
#include "OffloadImplFuncDecls.inc"
4242

4343
// Pull in the tablegen'd entry point definitions.
44-
#include "offload_entry_points.inc"
44+
#include "OffloadEntryPoints.inc"

offload/new-api/CMakeLists.txt

Lines changed: 0 additions & 30 deletions
This file was deleted.

offload/new-api/include/offload_exports

Lines changed: 0 additions & 25 deletions
This file was deleted.

offload/tools/offload-tblgen/PrintGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void EmitOffloadPrintHeader(RecordKeeper &Records, raw_ostream &OS) {
157157
158158
#pragma once
159159
160-
#include <offload_api.h>
160+
#include <OffloadAPI.h>
161161
#include <ostream>
162162
163163

offload/unittests/OffloadAPI/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
set(PLUGINS_TEST_COMMON offload_new)
1+
set(PLUGINS_TEST_COMMON LLVMOffload)
22
set(PLUGINS_TEST_INCLUDE ${LIBOMPTARGET_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common)
33

44
add_libompt_unittest("offload.unittests"
5-
${CMAKE_CURRENT_SOURCE_DIR}/common/environment.cpp
5+
${CMAKE_CURRENT_SOURCE_DIR}/common/Environment.cpp
66
${CMAKE_CURRENT_SOURCE_DIR}/platform/olGetPlatform.cpp
77
${CMAKE_CURRENT_SOURCE_DIR}/platform/olGetPlatformCount.cpp
88
${CMAKE_CURRENT_SOURCE_DIR}/platform/olGetPlatformInfo.cpp

offload/unittests/OffloadAPI/common/environment.cpp renamed to offload/unittests/OffloadAPI/common/Environment.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "environment.hpp"
10-
#include "fixtures.hpp"
9+
#include "Environment.hpp"
10+
#include "Fixtures.hpp"
1111
#include "llvm/Support/CommandLine.h"
12-
#include <offload_api.h>
12+
#include <OffloadAPI.h>
1313

1414
using namespace llvm;
1515

offload/unittests/OffloadAPI/common/environment.hpp renamed to offload/unittests/OffloadAPI/common/Environment.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#pragma once
1010

11+
#include <OffloadAPI.h>
1112
#include <gtest/gtest.h>
12-
#include <offload_api.h>
1313

1414
namespace TestEnvironment {
1515
const std::vector<ol_platform_handle_t> &getPlatforms();

offload/unittests/OffloadAPI/common/fixtures.hpp renamed to offload/unittests/OffloadAPI/common/Fixtures.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include <OffloadAPI.h>
10+
#include <OffloadPrint.hpp>
911
#include <gtest/gtest.h>
10-
#include <offload_api.h>
11-
#include <offload_print.hpp>
1212

13-
#include "environment.hpp"
13+
#include "Environment.hpp"
1414

1515
#pragma once
1616

offload/unittests/OffloadAPI/device/olGetDevice.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "../common/fixtures.hpp"
9+
#include "../common/Fixtures.hpp"
10+
#include <OffloadAPI.h>
1011
#include <gtest/gtest.h>
11-
#include <offload_api.h>
1212

1313
using olGetDeviceTest = offloadPlatformTest;
1414

offload/unittests/OffloadAPI/device/olGetDeviceCount.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "../common/fixtures.hpp"
9+
#include "../common/Fixtures.hpp"
10+
#include <OffloadAPI.h>
1011
#include <gtest/gtest.h>
11-
#include <offload_api.h>
1212

1313
using olGetDeviceCountTest = offloadPlatformTest;
1414

offload/unittests/OffloadAPI/device/olGetDeviceInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "../common/fixtures.hpp"
9+
#include "../common/Fixtures.hpp"
1010
#include "olDeviceInfo.hpp"
11+
#include <OffloadAPI.h>
1112
#include <gtest/gtest.h>
12-
#include <offload_api.h>
1313

1414
struct olGetDeviceInfoTest : offloadDeviceTest,
1515
::testing::WithParamInterface<ol_device_info_t> {

offload/unittests/OffloadAPI/device/olGetDeviceInfoSize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <offload_api.h>
9+
#include <OffloadAPI.h>
1010

11-
#include "../common/fixtures.hpp"
11+
#include "../common/Fixtures.hpp"
1212
#include "olDeviceInfo.hpp"
1313

1414
struct olGetDeviceInfoSizeTest

offload/unittests/OffloadAPI/platform/olGetPlatform.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "../common/fixtures.hpp"
9+
#include "../common/Fixtures.hpp"
10+
#include <OffloadAPI.h>
1011
#include <gtest/gtest.h>
11-
#include <offload_api.h>
1212

1313
using olGetPlatformTest = offloadTest;
1414

offload/unittests/OffloadAPI/platform/olGetPlatformCount.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "../common/fixtures.hpp"
9+
#include "../common/Fixtures.hpp"
10+
#include <OffloadAPI.h>
1011
#include <gtest/gtest.h>
11-
#include <offload_api.h>
1212

1313
using olGetPlatformCountTest = offloadTest;
1414

offload/unittests/OffloadAPI/platform/olGetPlatformInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <offload_api.h>
9+
#include <OffloadAPI.h>
1010

11-
#include "../common/fixtures.hpp"
11+
#include "../common/Fixtures.hpp"
1212
#include "olPlatformInfo.hpp"
1313

1414
struct olGetPlatformInfoTest

offload/unittests/OffloadAPI/platform/olGetPlatformInfoSize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <offload_api.h>
9+
#include <OffloadAPI.h>
1010

11-
#include "../common/fixtures.hpp"
11+
#include "../common/Fixtures.hpp"
1212
#include "olPlatformInfo.hpp"
1313

1414
struct olGetPlatformInfoSizeTest

0 commit comments

Comments
 (0)