[llvm] [Offload] Don't check in generated files (PR #141982)
Callum Fare via llvm-commits
llvm-commits at lists.llvm.org
Thu May 29 10:12:58 PDT 2025
https://github.com/callumfare updated https://github.com/llvm/llvm-project/pull/141982
>From fb1b3cbd4d91f31e9485a4ae733b6fbde1d72511 Mon Sep 17 00:00:00 2001
From: Callum Fare <callum at codeplay.com>
Date: Thu, 29 May 2025 17:45:38 +0100
Subject: [PATCH] [Offload] Don't check in generated files
---
offload/CMakeLists.txt | 3 +-
offload/include/Shared/OffloadErrcodes.inc | 51 -
offload/liboffload/API/CMakeLists.txt | 65 +-
offload/liboffload/CMakeLists.txt | 9 +-
.../liboffload/include/generated/OffloadAPI.h | 1021 -----------------
.../include/generated/OffloadEntryPoints.inc | 903 ---------------
.../include/generated/OffloadFuncs.inc | 52 -
.../generated/OffloadImplFuncDecls.inc | 60 -
.../include/generated/OffloadPrint.hpp | 645 -----------
offload/libomptarget/CMakeLists.txt | 7 +
offload/plugins-nextgen/CMakeLists.txt | 2 +
11 files changed, 58 insertions(+), 2760 deletions(-)
delete mode 100644 offload/include/Shared/OffloadErrcodes.inc
delete mode 100644 offload/liboffload/include/generated/OffloadAPI.h
delete mode 100644 offload/liboffload/include/generated/OffloadEntryPoints.inc
delete mode 100644 offload/liboffload/include/generated/OffloadFuncs.inc
delete mode 100644 offload/liboffload/include/generated/OffloadImplFuncDecls.inc
delete mode 100644 offload/liboffload/include/generated/OffloadPrint.hpp
diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index c7cafd105f52a..09eae0f5d3aea 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -363,6 +363,8 @@ set(LIBOMPTARGET_LLVM_LIBRARY_DIR "${LLVM_LIBRARY_DIR}" CACHE STRING
set(LIBOMPTARGET_LLVM_LIBRARY_INTDIR "${LIBOMPTARGET_INTDIR}" CACHE STRING
"Path to folder where intermediate libraries will be output")
+add_subdirectory(tools/offload-tblgen)
+
# Build offloading plugins and device RTLs if they are available.
add_subdirectory(plugins-nextgen)
add_subdirectory(DeviceRTL)
@@ -371,7 +373,6 @@ add_subdirectory(tools)
# Build target agnostic offloading library.
add_subdirectory(libomptarget)
-add_subdirectory(tools/offload-tblgen)
add_subdirectory(liboffload)
# Add tests.
diff --git a/offload/include/Shared/OffloadErrcodes.inc b/offload/include/Shared/OffloadErrcodes.inc
deleted file mode 100644
index 130e553aa70a4..0000000000000
--- a/offload/include/Shared/OffloadErrcodes.inc
+++ /dev/null
@@ -1,51 +0,0 @@
-//===- Auto-generated file, part of the LLVM/Offload project --------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef OFFLOAD_ERRC
-#error Please define the macro OFFLOAD_ERRCODE(Name, Desc, Value)
-#endif
-
-// Error codes are shared between PluginInterface and liboffload.
-// To add new error codes, add them to offload/liboffload/API/Common.td and run
-// the GenerateOffload target.
-
-OFFLOAD_ERRC(SUCCESS, "success", 0)
-OFFLOAD_ERRC(UNKNOWN, "unknown or internal error", 1)
-OFFLOAD_ERRC(HOST_IO, "I/O error on host", 2)
-OFFLOAD_ERRC(INVALID_BINARY, "a provided binary image is malformed", 3)
-OFFLOAD_ERRC(INVALID_NULL_POINTER,
- "a pointer argument is null when it should not be", 4)
-OFFLOAD_ERRC(INVALID_ARGUMENT, "an argument is invalid", 5)
-OFFLOAD_ERRC(NOT_FOUND, "requested object was not found in the binary image", 6)
-OFFLOAD_ERRC(OUT_OF_RESOURCES, "out of resources", 7)
-OFFLOAD_ERRC(
- INVALID_SIZE,
- "invalid size or dimensions (e.g., must not be zero, or is out of bounds)",
- 8)
-OFFLOAD_ERRC(INVALID_ENUMERATION, "enumerator argument is not valid", 9)
-OFFLOAD_ERRC(HOST_TOOL_NOT_FOUND,
- "a required binary (linker, etc.) was not found on the host", 10)
-OFFLOAD_ERRC(INVALID_VALUE, "invalid value", 11)
-OFFLOAD_ERRC(UNIMPLEMENTED,
- "generic error code for features currently unimplemented by the "
- "device/backend",
- 12)
-OFFLOAD_ERRC(
- UNSUPPORTED,
- "generic error code for features unsupported by the device/backend", 13)
-OFFLOAD_ERRC(ASSEMBLE_FAILURE,
- "assembler failure while processing binary image", 14)
-OFFLOAD_ERRC(LINK_FAILURE, "linker failure while processing binary image", 15)
-OFFLOAD_ERRC(BACKEND_FAILURE,
- "the plugin backend is in an invalid or unsupported state", 16)
-OFFLOAD_ERRC(INVALID_NULL_HANDLE,
- "a handle argument is null when it should not be", 17)
-OFFLOAD_ERRC(INVALID_PLATFORM, "invalid platform", 18)
-OFFLOAD_ERRC(INVALID_DEVICE, "invalid device", 19)
-OFFLOAD_ERRC(INVALID_QUEUE, "invalid queue", 20)
-OFFLOAD_ERRC(INVALID_EVENT, "invalid event", 21)
diff --git a/offload/liboffload/API/CMakeLists.txt b/offload/liboffload/API/CMakeLists.txt
index 5f8d1435d141f..cf6e132aa57a9 100644
--- a/offload/liboffload/API/CMakeLists.txt
+++ b/offload/liboffload/API/CMakeLists.txt
@@ -1,29 +1,46 @@
-# The OffloadGenerate target is used to regenerate the generated files in the
-# include directory. These files are checked in with the rest of the source,
-# therefore it is only needed when making changes to the API.
+# We want to clang-format the generated files if possible, since OffloadAPI.h is
+# the main public header for liboffload. Generate them in a temporary location,
+# then clang-format and copy them to the proper location. If clang-format is
+# missing just copy them.
+# Ideally we'd just clang-format them in place and avoid the copy but cmake
+# gets confused about the same path being a byproduct of two custom commands.
-find_program(CLANG_FORMAT clang-format PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
-if (CLANG_FORMAT)
- set(LLVM_TARGET_DEFINITIONS ${CMAKE_CURRENT_SOURCE_DIR}/OffloadAPI.td)
+set(LLVM_TARGET_DEFINITIONS ${CMAKE_CURRENT_SOURCE_DIR}/OffloadAPI.td)
+set(files_to_copy "")
- tablegen(OFFLOAD OffloadAPI.h -gen-api)
- tablegen(OFFLOAD OffloadEntryPoints.inc -gen-entry-points)
- tablegen(OFFLOAD OffloadFuncs.inc -gen-func-names)
- tablegen(OFFLOAD OffloadImplFuncDecls.inc -gen-impl-func-decls)
- tablegen(OFFLOAD OffloadPrint.hpp -gen-print-header)
- tablegen(OFFLOAD OffloadErrcodes.inc -gen-errcodes)
+macro(offload_tablegen file)
+ tablegen(OFFLOAD generated/${file}.gen ${ARGN})
+ list(APPEND files_to_copy ${file})
+endmacro()
- set(FILES_TO_COPY "OffloadAPI.h;OffloadEntryPoints.inc;OffloadFuncs.inc;OffloadImplFuncDecls.inc;OffloadPrint.hpp")
- set(GEN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../include/generated)
- add_public_tablegen_target(OffloadGenerate)
- add_custom_command(TARGET OffloadGenerate POST_BUILD COMMAND ${CLANG_FORMAT}
- -i ${TABLEGEN_OUTPUT})
- add_custom_command(TARGET OffloadGenerate POST_BUILD COMMAND ${CMAKE_COMMAND}
- -E copy_if_different ${FILES_TO_COPY} ${GEN_DIR})
- add_custom_command(TARGET OffloadGenerate POST_BUILD COMMAND ${CMAKE_COMMAND}
- -E copy_if_different OffloadErrcodes.inc "${LIBOMPTARGET_INCLUDE_DIR}/Shared/OffloadErrcodes.inc")
+offload_tablegen(OffloadAPI.h -gen-api)
+offload_tablegen(OffloadEntryPoints.inc -gen-entry-points)
+offload_tablegen(OffloadFuncs.inc -gen-func-names)
+offload_tablegen(OffloadImplFuncDecls.inc -gen-impl-func-decls)
+offload_tablegen(OffloadPrint.hpp -gen-print-header)
+
+add_public_tablegen_target(OffloadGenerate)
+
+add_custom_target(OffloadAPI DEPENDS OffloadGenerate)
+find_program(clang_format clang-format PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
+if (clang_format)
+ foreach(file IN LISTS files_to_copy)
+ add_custom_command(
+ OUTPUT ${file}
+ COMMAND ${clang_format} -i generated/${file}.gen
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different generated/${file}.gen ${CMAKE_CURRENT_BINARY_DIR}/${file}
+ DEPENDS generated/${file}.gen
+ )
+ add_custom_target(OffloadAPI.${file} DEPENDS ${file})
+ add_dependencies(OffloadAPI OffloadAPI.${file})
+ endforeach()
else()
- message(WARNING "clang-format was not found, so the OffloadGenerate target\
- will not be available. Offload will still build, but you will not be\
- able to make changes to the API.")
+ message(WARNING "clang-format not found, the generated Offload API headers will not be formatted")
+ foreach(file IN LISTS files_to_copy)
+ add_custom_command(
+ OUTPUT ${file}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different generated/${file}.gen ${CMAKE_CURRENT_BINARY_DIR}/${file}
+ DEPENDS generated/${file}.gen
+ )
+ endforeach()
endif()
diff --git a/offload/liboffload/CMakeLists.txt b/offload/liboffload/CMakeLists.txt
index 1b098bc01e218..e9edf66b9a669 100644
--- a/offload/liboffload/CMakeLists.txt
+++ b/offload/liboffload/CMakeLists.txt
@@ -8,6 +8,9 @@ add_llvm_library(
LINK_COMPONENTS
FrontendOpenMP
Support
+
+ DEPENDS
+ OffloadAPI
)
foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD)
@@ -19,9 +22,9 @@ if(LLVM_HAVE_LINK_VERSION_SCRIPT)
endif()
target_include_directories(LLVMOffload PUBLIC
+ ${CMAKE_CURRENT_BINARY_DIR}/API
${CMAKE_CURRENT_BINARY_DIR}/../include
${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_SOURCE_DIR}/include/generated
${CMAKE_CURRENT_SOURCE_DIR}/../include
${CMAKE_CURRENT_SOURCE_DIR}/../plugins-nextgen/common/include)
@@ -39,5 +42,5 @@ set_target_properties(LLVMOffload PROPERTIES
BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
install(TARGETS LLVMOffload LIBRARY COMPONENT LLVMOffload DESTINATION "${OFFLOAD_INSTALL_LIBDIR}")
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/generated/OffloadAPI.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/offload)
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/generated/OffloadPrint.hpp DESTINATION ${CMAKE_INSTALL_PREFIX}/include/offload)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/API/OffloadAPI.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/offload)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/API/OffloadPrint.hpp DESTINATION ${CMAKE_INSTALL_PREFIX}/include/offload)
diff --git a/offload/liboffload/include/generated/OffloadAPI.h b/offload/liboffload/include/generated/OffloadAPI.h
deleted file mode 100644
index a1d7540519e32..0000000000000
--- a/offload/liboffload/include/generated/OffloadAPI.h
+++ /dev/null
@@ -1,1021 +0,0 @@
-//===- Auto-generated file, part of the LLVM/Offload project --------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Auto-generated file, do not manually edit.
-
-#pragma once
-
-#include <stddef.h>
-#include <stdint.h>
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Defines Return/Error codes
-typedef enum ol_errc_t {
- /// success
- OL_ERRC_SUCCESS = 0,
- /// unknown or internal error
- OL_ERRC_UNKNOWN = 1,
- /// I/O error on host
- OL_ERRC_HOST_IO = 2,
- /// a provided binary image is malformed
- OL_ERRC_INVALID_BINARY = 3,
- /// a pointer argument is null when it should not be
- OL_ERRC_INVALID_NULL_POINTER = 4,
- /// an argument is invalid
- OL_ERRC_INVALID_ARGUMENT = 5,
- /// requested object was not found in the binary image
- OL_ERRC_NOT_FOUND = 6,
- /// out of resources
- OL_ERRC_OUT_OF_RESOURCES = 7,
- /// invalid size or dimensions (e.g., must not be zero, or is out of bounds)
- OL_ERRC_INVALID_SIZE = 8,
- /// enumerator argument is not valid
- OL_ERRC_INVALID_ENUMERATION = 9,
- /// a required binary (linker, etc.) was not found on the host
- OL_ERRC_HOST_TOOL_NOT_FOUND = 10,
- /// invalid value
- OL_ERRC_INVALID_VALUE = 11,
- /// generic error code for features currently unimplemented by the
- /// device/backend
- OL_ERRC_UNIMPLEMENTED = 12,
- /// generic error code for features unsupported by the device/backend
- OL_ERRC_UNSUPPORTED = 13,
- /// assembler failure while processing binary image
- OL_ERRC_ASSEMBLE_FAILURE = 14,
- /// linker failure while processing binary image
- OL_ERRC_LINK_FAILURE = 15,
- /// the plugin backend is in an invalid or unsupported state
- OL_ERRC_BACKEND_FAILURE = 16,
- /// a handle argument is null when it should not be
- OL_ERRC_INVALID_NULL_HANDLE = 17,
- /// invalid platform
- OL_ERRC_INVALID_PLATFORM = 18,
- /// invalid device
- OL_ERRC_INVALID_DEVICE = 19,
- /// invalid queue
- OL_ERRC_INVALID_QUEUE = 20,
- /// invalid event
- OL_ERRC_INVALID_EVENT = 21,
- /// @cond
- OL_ERRC_FORCE_UINT32 = 0x7fffffff
- /// @endcond
-
-} ol_errc_t;
-
-///////////////////////////////////////////////////////////////////////////////
-#ifndef OL_VERSION_MAJOR
-/// @brief Major version of the Offload API
-#define OL_VERSION_MAJOR 0
-#endif // OL_VERSION_MAJOR
-
-///////////////////////////////////////////////////////////////////////////////
-#ifndef OL_VERSION_MINOR
-/// @brief Minor version of the Offload API
-#define OL_VERSION_MINOR 0
-#endif // OL_VERSION_MINOR
-
-///////////////////////////////////////////////////////////////////////////////
-#ifndef OL_VERSION_PATCH
-/// @brief Patch version of the Offload API
-#define OL_VERSION_PATCH 1
-#endif // OL_VERSION_PATCH
-
-///////////////////////////////////////////////////////////////////////////////
-#ifndef OL_APICALL
-#if defined(_WIN32)
-/// @brief Calling convention for all API functions
-#define OL_APICALL __cdecl
-#else
-#define OL_APICALL
-#endif // defined(_WIN32)
-#endif // OL_APICALL
-
-///////////////////////////////////////////////////////////////////////////////
-#ifndef OL_APIEXPORT
-#if defined(_WIN32)
-/// @brief Microsoft-specific dllexport storage-class attribute
-#define OL_APIEXPORT __declspec(dllexport)
-#else
-#define OL_APIEXPORT
-#endif // defined(_WIN32)
-#endif // OL_APIEXPORT
-
-///////////////////////////////////////////////////////////////////////////////
-#ifndef OL_DLLEXPORT
-#if defined(_WIN32)
-/// @brief Microsoft-specific dllexport storage-class attribute
-#define OL_DLLEXPORT __declspec(dllexport)
-#endif // defined(_WIN32)
-#endif // OL_DLLEXPORT
-
-///////////////////////////////////////////////////////////////////////////////
-#ifndef OL_DLLEXPORT
-#if __GNUC__ >= 4
-/// @brief GCC-specific dllexport storage-class attribute
-#define OL_DLLEXPORT __attribute__((visibility("default")))
-#else
-#define OL_DLLEXPORT
-#endif // __GNUC__ >= 4
-#endif // OL_DLLEXPORT
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Handle of a platform instance
-typedef struct ol_platform_impl_t *ol_platform_handle_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Handle of platform's device object
-typedef struct ol_device_impl_t *ol_device_handle_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Handle of context object
-typedef struct ol_context_impl_t *ol_context_handle_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Handle of queue object
-typedef struct ol_queue_impl_t *ol_queue_handle_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Handle of event object
-typedef struct ol_event_impl_t *ol_event_handle_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Handle of program object
-typedef struct ol_program_impl_t *ol_program_handle_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Handle of kernel object
-typedef void *ol_kernel_handle_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Details of the error condition returned by an API call
-typedef struct ol_error_struct_t {
- ol_errc_t Code; /// The error code
- const char *Details; /// String containing error details
-} ol_error_struct_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Result type returned by all entry points.
-typedef const ol_error_struct_t *ol_result_t;
-
-///////////////////////////////////////////////////////////////////////////////
-#ifndef OL_SUCCESS
-/// @brief Success condition
-#define OL_SUCCESS NULL
-#endif // OL_SUCCESS
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Code location information that can optionally be associated with an
-/// API call
-typedef struct ol_code_location_t {
- const char *FunctionName; /// Function name
- const char *SourceFile; /// Source code file
- uint32_t LineNumber; /// Source code line number
- uint32_t ColumnNumber; /// Source code column number
-} ol_code_location_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Perform initialization of the Offload library and plugins
-///
-/// @details
-/// - This must be the first API call made by a user of the Offload library
-/// - Each call will increment an internal reference count that is
-/// decremented by `olShutDown`
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-OL_APIEXPORT ol_result_t OL_APICALL olInit();
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Release the resources in use by Offload
-///
-/// @details
-/// - This decrements an internal reference count. When this reaches 0, all
-/// resources will be released
-/// - Subsequent API calls made after this are not valid
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-OL_APIEXPORT ol_result_t OL_APICALL olShutDown();
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Supported platform info.
-typedef enum ol_platform_info_t {
- /// [char[]] The string denoting name of the platform. The size of the info
- /// needs to be dynamically queried.
- OL_PLATFORM_INFO_NAME = 0,
- /// [char[]] The string denoting name of the vendor of the platform. The size
- /// of the info needs to be dynamically queried.
- OL_PLATFORM_INFO_VENDOR_NAME = 1,
- /// [char[]] The string denoting the version of the platform. The size of the
- /// info needs to be dynamically queried.
- OL_PLATFORM_INFO_VERSION = 2,
- /// [ol_platform_backend_t] The native backend of the platform.
- OL_PLATFORM_INFO_BACKEND = 3,
- /// @cond
- OL_PLATFORM_INFO_FORCE_UINT32 = 0x7fffffff
- /// @endcond
-
-} ol_platform_info_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Identifies the native backend of the platform.
-typedef enum ol_platform_backend_t {
- /// The backend is not recognized
- OL_PLATFORM_BACKEND_UNKNOWN = 0,
- /// The backend is CUDA
- OL_PLATFORM_BACKEND_CUDA = 1,
- /// The backend is AMDGPU
- OL_PLATFORM_BACKEND_AMDGPU = 2,
- /// The backend is the host
- OL_PLATFORM_BACKEND_HOST = 3,
- /// @cond
- OL_PLATFORM_BACKEND_FORCE_UINT32 = 0x7fffffff
- /// @endcond
-
-} ol_platform_backend_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Queries the given property of the platform.
-///
-/// @details
-/// - `olGetPlatformInfoSize` can be used to query the storage size required
-/// for the given query.
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_UNSUPPORTED_ENUMERATION
-/// + If `PropName` is not supported by the platform.
-/// - ::OL_ERRC_INVALID_SIZE
-/// + `PropSize == 0`
-/// + If `PropSize` is less than the real number of bytes needed to
-/// return the info.
-/// - ::OL_ERRC_INVALID_PLATFORM
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Platform`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-/// + `NULL == PropValue`
-OL_APIEXPORT ol_result_t OL_APICALL olGetPlatformInfo(
- // [in] handle of the platform
- ol_platform_handle_t Platform,
- // [in] type of the info to retrieve
- ol_platform_info_t PropName,
- // [in] the number of bytes pointed to by pPlatformInfo.
- size_t PropSize,
- // [out] array of bytes holding the info. If Size is not equal to or greater
- // to the real number of bytes needed to return the info then the
- // OL_ERRC_INVALID_SIZE error is returned and pPlatformInfo is not used.
- void *PropValue);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Returns the storage size of the given platform query.
-///
-/// @details
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_UNSUPPORTED_ENUMERATION
-/// + If `PropName` is not supported by the platform.
-/// - ::OL_ERRC_INVALID_PLATFORM
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Platform`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-/// + `NULL == PropSizeRet`
-OL_APIEXPORT ol_result_t OL_APICALL olGetPlatformInfoSize(
- // [in] handle of the platform
- ol_platform_handle_t Platform,
- // [in] type of the info to query
- ol_platform_info_t PropName,
- // [out] pointer to the number of bytes required to store the query
- size_t *PropSizeRet);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Supported device types.
-typedef enum ol_device_type_t {
- /// The default device type as preferred by the runtime
- OL_DEVICE_TYPE_DEFAULT = 0,
- /// Devices of all types
- OL_DEVICE_TYPE_ALL = 1,
- /// GPU device type
- OL_DEVICE_TYPE_GPU = 2,
- /// CPU device type
- OL_DEVICE_TYPE_CPU = 3,
- /// Host device type
- OL_DEVICE_TYPE_HOST = 4,
- /// @cond
- OL_DEVICE_TYPE_FORCE_UINT32 = 0x7fffffff
- /// @endcond
-
-} ol_device_type_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Supported device info.
-typedef enum ol_device_info_t {
- /// [ol_device_type_t] type of the device
- OL_DEVICE_INFO_TYPE = 0,
- /// [ol_platform_handle_t] the platform associated with the device
- OL_DEVICE_INFO_PLATFORM = 1,
- /// [char[]] Device name
- OL_DEVICE_INFO_NAME = 2,
- /// [char[]] Device vendor
- OL_DEVICE_INFO_VENDOR = 3,
- /// [char[]] Driver version
- OL_DEVICE_INFO_DRIVER_VERSION = 4,
- /// @cond
- OL_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff
- /// @endcond
-
-} ol_device_info_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief User-provided function to be used with `olIterateDevices`
-typedef bool (*ol_device_iterate_cb_t)(
- // the device handle of the current iteration
- ol_device_handle_t Device,
- // optional user data
- void *UserData);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Iterates over all available devices, calling the callback for each
-/// device.
-///
-/// @details
-/// - If the user-provided callback returns `false`, the iteration is
-/// stopped.
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_DEVICE
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-OL_APIEXPORT ol_result_t OL_APICALL olIterateDevices(
- // [in] User-provided function called for each available device
- ol_device_iterate_cb_t Callback,
- // [in][optional] Optional user data to pass to the callback
- void *UserData);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Queries the given property of the device.
-///
-/// @details
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_UNSUPPORTED_ENUMERATION
-/// + If `PropName` is not supported by the device.
-/// - ::OL_ERRC_INVALID_SIZE
-/// + `PropSize == 0`
-/// + If `PropSize` is less than the real number of bytes needed to
-/// return the info.
-/// - ::OL_ERRC_INVALID_DEVICE
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Device`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-/// + `NULL == PropValue`
-OL_APIEXPORT ol_result_t OL_APICALL olGetDeviceInfo(
- // [in] handle of the device instance
- ol_device_handle_t Device,
- // [in] type of the info to retrieve
- ol_device_info_t PropName,
- // [in] the number of bytes pointed to by PropValue.
- size_t PropSize,
- // [out] array of bytes holding the info. If PropSize is not equal to or
- // greater than the real number of bytes needed to return the info then the
- // OL_ERRC_INVALID_SIZE error is returned and PropValue is not used.
- void *PropValue);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Returns the storage size of the given device query.
-///
-/// @details
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_UNSUPPORTED_ENUMERATION
-/// + If `PropName` is not supported by the device.
-/// - ::OL_ERRC_INVALID_DEVICE
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Device`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-/// + `NULL == PropSizeRet`
-OL_APIEXPORT ol_result_t OL_APICALL olGetDeviceInfoSize(
- // [in] handle of the device instance
- ol_device_handle_t Device,
- // [in] type of the info to retrieve
- ol_device_info_t PropName,
- // [out] pointer to the number of bytes required to store the query
- size_t *PropSizeRet);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Represents the type of allocation made with olMemAlloc.
-typedef enum ol_alloc_type_t {
- /// Host allocation
- OL_ALLOC_TYPE_HOST = 0,
- /// Device allocation
- OL_ALLOC_TYPE_DEVICE = 1,
- /// Managed allocation
- OL_ALLOC_TYPE_MANAGED = 2,
- /// @cond
- OL_ALLOC_TYPE_FORCE_UINT32 = 0x7fffffff
- /// @endcond
-
-} ol_alloc_type_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Creates a memory allocation on the specified device.
-///
-/// @details
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_SIZE
-/// + `Size == 0`
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Device`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-/// + `NULL == AllocationOut`
-OL_APIEXPORT ol_result_t OL_APICALL olMemAlloc(
- // [in] handle of the device to allocate on
- ol_device_handle_t Device,
- // [in] type of the allocation
- ol_alloc_type_t Type,
- // [in] size of the allocation in bytes
- size_t Size,
- // [out] output for the allocated pointer
- void **AllocationOut);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Frees a memory allocation previously made by olMemAlloc.
-///
-/// @details
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-/// + `NULL == Address`
-OL_APIEXPORT ol_result_t OL_APICALL olMemFree(
- // [in] address of the allocation to free
- void *Address);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Enqueue a memcpy operation.
-///
-/// @details
-/// - For host pointers, use the host device belonging to the
-/// OL_PLATFORM_BACKEND_HOST platform.
-/// - If a queue is specified, at least one device must be a non-host device
-/// - If a queue is not specified, the memcpy happens synchronously
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_ARGUMENT
-/// + `Queue == NULL && EventOut != NULL`
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == DstDevice`
-/// + `NULL == SrcDevice`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-/// + `NULL == DstPtr`
-/// + `NULL == SrcPtr`
-OL_APIEXPORT ol_result_t OL_APICALL olMemcpy(
- // [in][optional] handle of the queue.
- ol_queue_handle_t Queue,
- // [in] pointer to copy to
- void *DstPtr,
- // [in] device that DstPtr belongs to
- ol_device_handle_t DstDevice,
- // [in] pointer to copy from
- void *SrcPtr,
- // [in] device that SrcPtr belongs to
- ol_device_handle_t SrcDevice,
- // [in] size in bytes of data to copy
- size_t Size,
- // [out][optional] optional recorded event for the enqueued operation
- ol_event_handle_t *EventOut);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Create a queue for the given device.
-///
-/// @details
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Device`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-/// + `NULL == Queue`
-OL_APIEXPORT ol_result_t OL_APICALL olCreateQueue(
- // [in] handle of the device
- ol_device_handle_t Device,
- // [out] output pointer for the created queue
- ol_queue_handle_t *Queue);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Destroy the queue and free all underlying resources.
-///
-/// @details
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Queue`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-OL_APIEXPORT ol_result_t OL_APICALL olDestroyQueue(
- // [in] handle of the queue
- ol_queue_handle_t Queue);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Wait for the enqueued work on a queue to complete.
-///
-/// @details
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Queue`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-OL_APIEXPORT ol_result_t OL_APICALL olWaitQueue(
- // [in] handle of the queue
- ol_queue_handle_t Queue);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Destroy the event and free all underlying resources.
-///
-/// @details
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Event`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-OL_APIEXPORT ol_result_t OL_APICALL olDestroyEvent(
- // [in] handle of the event
- ol_event_handle_t Event);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Wait for the event to be complete.
-///
-/// @details
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Event`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-OL_APIEXPORT ol_result_t OL_APICALL olWaitEvent(
- // [in] handle of the event
- ol_event_handle_t Event);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Create a program for the device from the binary image pointed to by
-/// `ProgData`.
-///
-/// @details
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Device`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-/// + `NULL == ProgData`
-/// + `NULL == Program`
-OL_APIEXPORT ol_result_t OL_APICALL olCreateProgram(
- // [in] handle of the device
- ol_device_handle_t Device,
- // [in] pointer to the program binary data
- const void *ProgData,
- // [in] size of the program binary in bytes
- size_t ProgDataSize,
- // [out] output pointer for the created program
- ol_program_handle_t *Program);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Destroy the program and free all underlying resources.
-///
-/// @details
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Program`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-OL_APIEXPORT ol_result_t OL_APICALL olDestroyProgram(
- // [in] handle of the program
- ol_program_handle_t Program);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Get a kernel from the function identified by `KernelName` in the
-/// given program.
-///
-/// @details
-/// - The kernel handle returned is owned by the device so does not need to
-/// be destroyed.
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Program`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-/// + `NULL == KernelName`
-/// + `NULL == Kernel`
-OL_APIEXPORT ol_result_t OL_APICALL olGetKernel(
- // [in] handle of the program
- ol_program_handle_t Program,
- // [in] name of the kernel entry point in the program
- const char *KernelName,
- // [out] output pointer for the fetched kernel
- ol_kernel_handle_t *Kernel);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Size-related arguments for a kernel launch.
-typedef struct ol_kernel_launch_size_args_t {
- size_t Dimensions; /// Number of work dimensions
- size_t NumGroupsX; /// Number of work groups on the X dimension
- size_t NumGroupsY; /// Number of work groups on the Y dimension
- size_t NumGroupsZ; /// Number of work groups on the Z dimension
- size_t GroupSizeX; /// Size of a work group on the X dimension.
- size_t GroupSizeY; /// Size of a work group on the Y dimension.
- size_t GroupSizeZ; /// Size of a work group on the Z dimension.
- size_t DynSharedMemory; /// Size of dynamic shared memory in bytes.
-} ol_kernel_launch_size_args_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Enqueue a kernel launch with the specified size and parameters.
-///
-/// @details
-/// - If a queue is not specified, kernel execution happens synchronously
-///
-/// @returns
-/// - ::OL_RESULT_SUCCESS
-/// - ::OL_ERRC_UNINITIALIZED
-/// - ::OL_ERRC_DEVICE_LOST
-/// - ::OL_ERRC_INVALID_ARGUMENT
-/// + `Queue == NULL && EventOut != NULL`
-/// - ::OL_ERRC_INVALID_DEVICE
-/// + If Queue is non-null but does not belong to Device
-/// - ::OL_ERRC_INVALID_NULL_HANDLE
-/// + `NULL == Device`
-/// + `NULL == Kernel`
-/// - ::OL_ERRC_INVALID_NULL_POINTER
-/// + `NULL == ArgumentsData`
-/// + `NULL == LaunchSizeArgs`
-OL_APIEXPORT ol_result_t OL_APICALL olLaunchKernel(
- // [in][optional] handle of the queue
- ol_queue_handle_t Queue,
- // [in] handle of the device to execute on
- ol_device_handle_t Device,
- // [in] handle of the kernel
- ol_kernel_handle_t Kernel,
- // [in] pointer to the kernel argument struct
- const void *ArgumentsData,
- // [in] size of the kernel argument struct
- size_t ArgumentsSize,
- // [in] pointer to the struct containing launch size parameters
- const ol_kernel_launch_size_args_t *LaunchSizeArgs,
- // [out][optional] optional recorded event for the enqueued operation
- ol_event_handle_t *EventOut);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olGetPlatformInfo
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_get_platform_info_params_t {
- ol_platform_handle_t *pPlatform;
- ol_platform_info_t *pPropName;
- size_t *pPropSize;
- void **pPropValue;
-} ol_get_platform_info_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olGetPlatformInfoSize
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_get_platform_info_size_params_t {
- ol_platform_handle_t *pPlatform;
- ol_platform_info_t *pPropName;
- size_t **pPropSizeRet;
-} ol_get_platform_info_size_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olIterateDevices
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_iterate_devices_params_t {
- ol_device_iterate_cb_t *pCallback;
- void **pUserData;
-} ol_iterate_devices_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olGetDeviceInfo
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_get_device_info_params_t {
- ol_device_handle_t *pDevice;
- ol_device_info_t *pPropName;
- size_t *pPropSize;
- void **pPropValue;
-} ol_get_device_info_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olGetDeviceInfoSize
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_get_device_info_size_params_t {
- ol_device_handle_t *pDevice;
- ol_device_info_t *pPropName;
- size_t **pPropSizeRet;
-} ol_get_device_info_size_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olMemAlloc
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_mem_alloc_params_t {
- ol_device_handle_t *pDevice;
- ol_alloc_type_t *pType;
- size_t *pSize;
- void ***pAllocationOut;
-} ol_mem_alloc_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olMemFree
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_mem_free_params_t {
- void **pAddress;
-} ol_mem_free_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olMemcpy
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_memcpy_params_t {
- ol_queue_handle_t *pQueue;
- void **pDstPtr;
- ol_device_handle_t *pDstDevice;
- void **pSrcPtr;
- ol_device_handle_t *pSrcDevice;
- size_t *pSize;
- ol_event_handle_t **pEventOut;
-} ol_memcpy_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olCreateQueue
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_create_queue_params_t {
- ol_device_handle_t *pDevice;
- ol_queue_handle_t **pQueue;
-} ol_create_queue_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olDestroyQueue
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_destroy_queue_params_t {
- ol_queue_handle_t *pQueue;
-} ol_destroy_queue_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olWaitQueue
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_wait_queue_params_t {
- ol_queue_handle_t *pQueue;
-} ol_wait_queue_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olDestroyEvent
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_destroy_event_params_t {
- ol_event_handle_t *pEvent;
-} ol_destroy_event_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olWaitEvent
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_wait_event_params_t {
- ol_event_handle_t *pEvent;
-} ol_wait_event_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olCreateProgram
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_create_program_params_t {
- ol_device_handle_t *pDevice;
- const void **pProgData;
- size_t *pProgDataSize;
- ol_program_handle_t **pProgram;
-} ol_create_program_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olDestroyProgram
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_destroy_program_params_t {
- ol_program_handle_t *pProgram;
-} ol_destroy_program_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olGetKernel
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_get_kernel_params_t {
- ol_program_handle_t *pProgram;
- const char **pKernelName;
- ol_kernel_handle_t **pKernel;
-} ol_get_kernel_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Function parameters for olLaunchKernel
-/// @details Each entry is a pointer to the parameter passed to the function;
-typedef struct ol_launch_kernel_params_t {
- ol_queue_handle_t *pQueue;
- ol_device_handle_t *pDevice;
- ol_kernel_handle_t *pKernel;
- const void **pArgumentsData;
- size_t *pArgumentsSize;
- const ol_kernel_launch_size_args_t **pLaunchSizeArgs;
- ol_event_handle_t **pEventOut;
-} ol_launch_kernel_params_t;
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olInit that also sets source code location information
-/// @details See also ::olInit
-OL_APIEXPORT ol_result_t OL_APICALL
-olInitWithCodeLoc(ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olShutDown that also sets source code location information
-/// @details See also ::olShutDown
-OL_APIEXPORT ol_result_t OL_APICALL
-olShutDownWithCodeLoc(ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olGetPlatformInfo that also sets source code location
-/// information
-/// @details See also ::olGetPlatformInfo
-OL_APIEXPORT ol_result_t OL_APICALL olGetPlatformInfoWithCodeLoc(
- ol_platform_handle_t Platform, ol_platform_info_t PropName, size_t PropSize,
- void *PropValue, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olGetPlatformInfoSize that also sets source code location
-/// information
-/// @details See also ::olGetPlatformInfoSize
-OL_APIEXPORT ol_result_t OL_APICALL olGetPlatformInfoSizeWithCodeLoc(
- ol_platform_handle_t Platform, ol_platform_info_t PropName,
- size_t *PropSizeRet, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olIterateDevices that also sets source code location
-/// information
-/// @details See also ::olIterateDevices
-OL_APIEXPORT ol_result_t OL_APICALL
-olIterateDevicesWithCodeLoc(ol_device_iterate_cb_t Callback, void *UserData,
- ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olGetDeviceInfo that also sets source code location
-/// information
-/// @details See also ::olGetDeviceInfo
-OL_APIEXPORT ol_result_t OL_APICALL olGetDeviceInfoWithCodeLoc(
- ol_device_handle_t Device, ol_device_info_t PropName, size_t PropSize,
- void *PropValue, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olGetDeviceInfoSize that also sets source code location
-/// information
-/// @details See also ::olGetDeviceInfoSize
-OL_APIEXPORT ol_result_t OL_APICALL olGetDeviceInfoSizeWithCodeLoc(
- ol_device_handle_t Device, ol_device_info_t PropName, size_t *PropSizeRet,
- ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olMemAlloc that also sets source code location information
-/// @details See also ::olMemAlloc
-OL_APIEXPORT ol_result_t OL_APICALL olMemAllocWithCodeLoc(
- ol_device_handle_t Device, ol_alloc_type_t Type, size_t Size,
- void **AllocationOut, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olMemFree that also sets source code location information
-/// @details See also ::olMemFree
-OL_APIEXPORT ol_result_t OL_APICALL
-olMemFreeWithCodeLoc(void *Address, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olMemcpy that also sets source code location information
-/// @details See also ::olMemcpy
-OL_APIEXPORT ol_result_t OL_APICALL olMemcpyWithCodeLoc(
- ol_queue_handle_t Queue, void *DstPtr, ol_device_handle_t DstDevice,
- void *SrcPtr, ol_device_handle_t SrcDevice, size_t Size,
- ol_event_handle_t *EventOut, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olCreateQueue that also sets source code location
-/// information
-/// @details See also ::olCreateQueue
-OL_APIEXPORT ol_result_t OL_APICALL
-olCreateQueueWithCodeLoc(ol_device_handle_t Device, ol_queue_handle_t *Queue,
- ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olDestroyQueue that also sets source code location
-/// information
-/// @details See also ::olDestroyQueue
-OL_APIEXPORT ol_result_t OL_APICALL olDestroyQueueWithCodeLoc(
- ol_queue_handle_t Queue, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olWaitQueue that also sets source code location
-/// information
-/// @details See also ::olWaitQueue
-OL_APIEXPORT ol_result_t OL_APICALL olWaitQueueWithCodeLoc(
- ol_queue_handle_t Queue, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olDestroyEvent that also sets source code location
-/// information
-/// @details See also ::olDestroyEvent
-OL_APIEXPORT ol_result_t OL_APICALL olDestroyEventWithCodeLoc(
- ol_event_handle_t Event, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olWaitEvent that also sets source code location
-/// information
-/// @details See also ::olWaitEvent
-OL_APIEXPORT ol_result_t OL_APICALL olWaitEventWithCodeLoc(
- ol_event_handle_t Event, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olCreateProgram that also sets source code location
-/// information
-/// @details See also ::olCreateProgram
-OL_APIEXPORT ol_result_t OL_APICALL olCreateProgramWithCodeLoc(
- ol_device_handle_t Device, const void *ProgData, size_t ProgDataSize,
- ol_program_handle_t *Program, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olDestroyProgram that also sets source code location
-/// information
-/// @details See also ::olDestroyProgram
-OL_APIEXPORT ol_result_t OL_APICALL olDestroyProgramWithCodeLoc(
- ol_program_handle_t Program, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olGetKernel that also sets source code location
-/// information
-/// @details See also ::olGetKernel
-OL_APIEXPORT ol_result_t OL_APICALL olGetKernelWithCodeLoc(
- ol_program_handle_t Program, const char *KernelName,
- ol_kernel_handle_t *Kernel, ol_code_location_t *CodeLocation);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Variant of olLaunchKernel that also sets source code location
-/// information
-/// @details See also ::olLaunchKernel
-OL_APIEXPORT ol_result_t OL_APICALL olLaunchKernelWithCodeLoc(
- ol_queue_handle_t Queue, ol_device_handle_t Device,
- ol_kernel_handle_t Kernel, const void *ArgumentsData, size_t ArgumentsSize,
- const ol_kernel_launch_size_args_t *LaunchSizeArgs,
- ol_event_handle_t *EventOut, ol_code_location_t *CodeLocation);
-
-#if defined(__cplusplus)
-} // extern "C"
-#endif
diff --git a/offload/liboffload/include/generated/OffloadEntryPoints.inc b/offload/liboffload/include/generated/OffloadEntryPoints.inc
deleted file mode 100644
index 9feebeea09ec3..0000000000000
--- a/offload/liboffload/include/generated/OffloadEntryPoints.inc
+++ /dev/null
@@ -1,903 +0,0 @@
-//===- Auto-generated file, part of the LLVM/Offload project --------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olInit_val() {
- if (offloadConfig().ValidationEnabled) {
- }
-
- return llvm::offload::olInit_impl();
-}
-OL_APIEXPORT ol_result_t OL_APICALL olInit() {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olInit";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(olInit_val());
-
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "()";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olInitWithCodeLoc(ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olInit();
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olShutDown_val() {
- if (offloadConfig().ValidationEnabled) {
- }
-
- return llvm::offload::olShutDown_impl();
-}
-OL_APIEXPORT ol_result_t OL_APICALL olShutDown() {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olShutDown";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(olShutDown_val());
-
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "()";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olShutDownWithCodeLoc(ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olShutDown();
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olGetPlatformInfo_val(ol_platform_handle_t Platform,
- ol_platform_info_t PropName, size_t PropSize,
- void *PropValue) {
- if (offloadConfig().ValidationEnabled) {
- if (PropSize == 0) {
- return createOffloadError(error::ErrorCode::INVALID_SIZE,
- "validation failure: PropSize == 0");
- }
-
- if (NULL == Platform) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Platform");
- }
-
- if (NULL == PropValue) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == PropValue");
- }
- }
-
- return llvm::offload::olGetPlatformInfo_impl(Platform, PropName, PropSize,
- PropValue);
-}
-OL_APIEXPORT ol_result_t OL_APICALL
-olGetPlatformInfo(ol_platform_handle_t Platform, ol_platform_info_t PropName,
- size_t PropSize, void *PropValue) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olGetPlatformInfo";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(
- olGetPlatformInfo_val(Platform, PropName, PropSize, PropValue));
-
- if (offloadConfig().TracingEnabled) {
- ol_get_platform_info_params_t Params = {&Platform, &PropName, &PropSize,
- &PropValue};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olGetPlatformInfoWithCodeLoc(ol_platform_handle_t Platform,
- ol_platform_info_t PropName,
- size_t PropSize, void *PropValue,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result =
- ::olGetPlatformInfo(Platform, PropName, PropSize, PropValue);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olGetPlatformInfoSize_val(ol_platform_handle_t Platform,
- ol_platform_info_t PropName,
- size_t *PropSizeRet) {
- if (offloadConfig().ValidationEnabled) {
- if (NULL == Platform) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Platform");
- }
-
- if (NULL == PropSizeRet) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == PropSizeRet");
- }
- }
-
- return llvm::offload::olGetPlatformInfoSize_impl(Platform, PropName,
- PropSizeRet);
-}
-OL_APIEXPORT ol_result_t OL_APICALL
-olGetPlatformInfoSize(ol_platform_handle_t Platform,
- ol_platform_info_t PropName, size_t *PropSizeRet) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olGetPlatformInfoSize";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(
- olGetPlatformInfoSize_val(Platform, PropName, PropSizeRet));
-
- if (offloadConfig().TracingEnabled) {
- ol_get_platform_info_size_params_t Params = {&Platform, &PropName,
- &PropSizeRet};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olGetPlatformInfoSizeWithCodeLoc(ol_platform_handle_t Platform,
- ol_platform_info_t PropName,
- size_t *PropSizeRet,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olGetPlatformInfoSize(Platform, PropName, PropSizeRet);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olIterateDevices_val(ol_device_iterate_cb_t Callback,
- void *UserData) {
- if (offloadConfig().ValidationEnabled) {
- }
-
- return llvm::offload::olIterateDevices_impl(Callback, UserData);
-}
-OL_APIEXPORT ol_result_t OL_APICALL
-olIterateDevices(ol_device_iterate_cb_t Callback, void *UserData) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olIterateDevices";
- }
-
- ol_result_t Result =
- llvmErrorToOffloadError(olIterateDevices_val(Callback, UserData));
-
- if (offloadConfig().TracingEnabled) {
- ol_iterate_devices_params_t Params = {&Callback, &UserData};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olIterateDevicesWithCodeLoc(ol_device_iterate_cb_t Callback,
- void *UserData,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olIterateDevices(Callback, UserData);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olGetDeviceInfo_val(ol_device_handle_t Device,
- ol_device_info_t PropName, size_t PropSize,
- void *PropValue) {
- if (offloadConfig().ValidationEnabled) {
- if (PropSize == 0) {
- return createOffloadError(error::ErrorCode::INVALID_SIZE,
- "validation failure: PropSize == 0");
- }
-
- if (NULL == Device) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Device");
- }
-
- if (NULL == PropValue) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == PropValue");
- }
- }
-
- return llvm::offload::olGetDeviceInfo_impl(Device, PropName, PropSize,
- PropValue);
-}
-OL_APIEXPORT ol_result_t OL_APICALL olGetDeviceInfo(ol_device_handle_t Device,
- ol_device_info_t PropName,
- size_t PropSize,
- void *PropValue) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olGetDeviceInfo";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(
- olGetDeviceInfo_val(Device, PropName, PropSize, PropValue));
-
- if (offloadConfig().TracingEnabled) {
- ol_get_device_info_params_t Params = {&Device, &PropName, &PropSize,
- &PropValue};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olGetDeviceInfoWithCodeLoc(ol_device_handle_t Device,
- ol_device_info_t PropName,
- size_t PropSize, void *PropValue,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olGetDeviceInfo(Device, PropName, PropSize, PropValue);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olGetDeviceInfoSize_val(ol_device_handle_t Device,
- ol_device_info_t PropName,
- size_t *PropSizeRet) {
- if (offloadConfig().ValidationEnabled) {
- if (NULL == Device) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Device");
- }
-
- if (NULL == PropSizeRet) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == PropSizeRet");
- }
- }
-
- return llvm::offload::olGetDeviceInfoSize_impl(Device, PropName, PropSizeRet);
-}
-OL_APIEXPORT ol_result_t OL_APICALL olGetDeviceInfoSize(
- ol_device_handle_t Device, ol_device_info_t PropName, size_t *PropSizeRet) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olGetDeviceInfoSize";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(
- olGetDeviceInfoSize_val(Device, PropName, PropSizeRet));
-
- if (offloadConfig().TracingEnabled) {
- ol_get_device_info_size_params_t Params = {&Device, &PropName,
- &PropSizeRet};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olGetDeviceInfoSizeWithCodeLoc(ol_device_handle_t Device,
- ol_device_info_t PropName,
- size_t *PropSizeRet,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olGetDeviceInfoSize(Device, PropName, PropSizeRet);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olMemAlloc_val(ol_device_handle_t Device, ol_alloc_type_t Type,
- size_t Size, void **AllocationOut) {
- if (offloadConfig().ValidationEnabled) {
- if (Size == 0) {
- return createOffloadError(error::ErrorCode::INVALID_SIZE,
- "validation failure: Size == 0");
- }
-
- if (NULL == Device) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Device");
- }
-
- if (NULL == AllocationOut) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == AllocationOut");
- }
- }
-
- return llvm::offload::olMemAlloc_impl(Device, Type, Size, AllocationOut);
-}
-OL_APIEXPORT ol_result_t OL_APICALL olMemAlloc(ol_device_handle_t Device,
- ol_alloc_type_t Type,
- size_t Size,
- void **AllocationOut) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olMemAlloc";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(
- olMemAlloc_val(Device, Type, Size, AllocationOut));
-
- if (offloadConfig().TracingEnabled) {
- ol_mem_alloc_params_t Params = {&Device, &Type, &Size, &AllocationOut};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olMemAllocWithCodeLoc(ol_device_handle_t Device,
- ol_alloc_type_t Type, size_t Size,
- void **AllocationOut,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olMemAlloc(Device, Type, Size, AllocationOut);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olMemFree_val(void *Address) {
- if (offloadConfig().ValidationEnabled) {
- if (NULL == Address) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == Address");
- }
- }
-
- return llvm::offload::olMemFree_impl(Address);
-}
-OL_APIEXPORT ol_result_t OL_APICALL olMemFree(void *Address) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olMemFree";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(olMemFree_val(Address));
-
- if (offloadConfig().TracingEnabled) {
- ol_mem_free_params_t Params = {&Address};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olMemFreeWithCodeLoc(void *Address,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olMemFree(Address);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olMemcpy_val(ol_queue_handle_t Queue, void *DstPtr,
- ol_device_handle_t DstDevice, void *SrcPtr,
- ol_device_handle_t SrcDevice, size_t Size,
- ol_event_handle_t *EventOut) {
- if (offloadConfig().ValidationEnabled) {
- if (Queue == NULL && EventOut != NULL) {
- return createOffloadError(
- error::ErrorCode::INVALID_ARGUMENT,
- "validation failure: Queue == NULL && EventOut != NULL");
- }
-
- if (NULL == DstDevice) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == DstDevice");
- }
-
- if (NULL == SrcDevice) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == SrcDevice");
- }
-
- if (NULL == DstPtr) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == DstPtr");
- }
-
- if (NULL == SrcPtr) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == SrcPtr");
- }
- }
-
- return llvm::offload::olMemcpy_impl(Queue, DstPtr, DstDevice, SrcPtr,
- SrcDevice, Size, EventOut);
-}
-OL_APIEXPORT ol_result_t OL_APICALL
-olMemcpy(ol_queue_handle_t Queue, void *DstPtr, ol_device_handle_t DstDevice,
- void *SrcPtr, ol_device_handle_t SrcDevice, size_t Size,
- ol_event_handle_t *EventOut) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olMemcpy";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(olMemcpy_val(
- Queue, DstPtr, DstDevice, SrcPtr, SrcDevice, Size, EventOut));
-
- if (offloadConfig().TracingEnabled) {
- ol_memcpy_params_t Params = {&Queue, &DstPtr, &DstDevice, &SrcPtr,
- &SrcDevice, &Size, &EventOut};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olMemcpyWithCodeLoc(ol_queue_handle_t Queue, void *DstPtr,
- ol_device_handle_t DstDevice, void *SrcPtr,
- ol_device_handle_t SrcDevice, size_t Size,
- ol_event_handle_t *EventOut,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result =
- ::olMemcpy(Queue, DstPtr, DstDevice, SrcPtr, SrcDevice, Size, EventOut);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olCreateQueue_val(ol_device_handle_t Device,
- ol_queue_handle_t *Queue) {
- if (offloadConfig().ValidationEnabled) {
- if (NULL == Device) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Device");
- }
-
- if (NULL == Queue) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == Queue");
- }
- }
-
- return llvm::offload::olCreateQueue_impl(Device, Queue);
-}
-OL_APIEXPORT ol_result_t OL_APICALL olCreateQueue(ol_device_handle_t Device,
- ol_queue_handle_t *Queue) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olCreateQueue";
- }
-
- ol_result_t Result =
- llvmErrorToOffloadError(olCreateQueue_val(Device, Queue));
-
- if (offloadConfig().TracingEnabled) {
- ol_create_queue_params_t Params = {&Device, &Queue};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olCreateQueueWithCodeLoc(ol_device_handle_t Device,
- ol_queue_handle_t *Queue,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olCreateQueue(Device, Queue);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olDestroyQueue_val(ol_queue_handle_t Queue) {
- if (offloadConfig().ValidationEnabled) {
- if (NULL == Queue) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Queue");
- }
- }
-
- return llvm::offload::olDestroyQueue_impl(Queue);
-}
-OL_APIEXPORT ol_result_t OL_APICALL olDestroyQueue(ol_queue_handle_t Queue) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olDestroyQueue";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(olDestroyQueue_val(Queue));
-
- if (offloadConfig().TracingEnabled) {
- ol_destroy_queue_params_t Params = {&Queue};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olDestroyQueueWithCodeLoc(ol_queue_handle_t Queue,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olDestroyQueue(Queue);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olWaitQueue_val(ol_queue_handle_t Queue) {
- if (offloadConfig().ValidationEnabled) {
- if (NULL == Queue) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Queue");
- }
- }
-
- return llvm::offload::olWaitQueue_impl(Queue);
-}
-OL_APIEXPORT ol_result_t OL_APICALL olWaitQueue(ol_queue_handle_t Queue) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olWaitQueue";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(olWaitQueue_val(Queue));
-
- if (offloadConfig().TracingEnabled) {
- ol_wait_queue_params_t Params = {&Queue};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olWaitQueueWithCodeLoc(ol_queue_handle_t Queue,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olWaitQueue(Queue);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olDestroyEvent_val(ol_event_handle_t Event) {
- if (offloadConfig().ValidationEnabled) {
- if (NULL == Event) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Event");
- }
- }
-
- return llvm::offload::olDestroyEvent_impl(Event);
-}
-OL_APIEXPORT ol_result_t OL_APICALL olDestroyEvent(ol_event_handle_t Event) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olDestroyEvent";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(olDestroyEvent_val(Event));
-
- if (offloadConfig().TracingEnabled) {
- ol_destroy_event_params_t Params = {&Event};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olDestroyEventWithCodeLoc(ol_event_handle_t Event,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olDestroyEvent(Event);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olWaitEvent_val(ol_event_handle_t Event) {
- if (offloadConfig().ValidationEnabled) {
- if (NULL == Event) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Event");
- }
- }
-
- return llvm::offload::olWaitEvent_impl(Event);
-}
-OL_APIEXPORT ol_result_t OL_APICALL olWaitEvent(ol_event_handle_t Event) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olWaitEvent";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(olWaitEvent_val(Event));
-
- if (offloadConfig().TracingEnabled) {
- ol_wait_event_params_t Params = {&Event};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olWaitEventWithCodeLoc(ol_event_handle_t Event,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olWaitEvent(Event);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olCreateProgram_val(ol_device_handle_t Device, const void *ProgData,
- size_t ProgDataSize,
- ol_program_handle_t *Program) {
- if (offloadConfig().ValidationEnabled) {
- if (NULL == Device) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Device");
- }
-
- if (NULL == ProgData) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == ProgData");
- }
-
- if (NULL == Program) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == Program");
- }
- }
-
- return llvm::offload::olCreateProgram_impl(Device, ProgData, ProgDataSize,
- Program);
-}
-OL_APIEXPORT ol_result_t OL_APICALL
-olCreateProgram(ol_device_handle_t Device, const void *ProgData,
- size_t ProgDataSize, ol_program_handle_t *Program) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olCreateProgram";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(
- olCreateProgram_val(Device, ProgData, ProgDataSize, Program));
-
- if (offloadConfig().TracingEnabled) {
- ol_create_program_params_t Params = {&Device, &ProgData, &ProgDataSize,
- &Program};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olCreateProgramWithCodeLoc(ol_device_handle_t Device,
- const void *ProgData,
- size_t ProgDataSize,
- ol_program_handle_t *Program,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result =
- ::olCreateProgram(Device, ProgData, ProgDataSize, Program);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olDestroyProgram_val(ol_program_handle_t Program) {
- if (offloadConfig().ValidationEnabled) {
- if (NULL == Program) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Program");
- }
- }
-
- return llvm::offload::olDestroyProgram_impl(Program);
-}
-OL_APIEXPORT ol_result_t OL_APICALL
-olDestroyProgram(ol_program_handle_t Program) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olDestroyProgram";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(olDestroyProgram_val(Program));
-
- if (offloadConfig().TracingEnabled) {
- ol_destroy_program_params_t Params = {&Program};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olDestroyProgramWithCodeLoc(ol_program_handle_t Program,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olDestroyProgram(Program);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error olGetKernel_val(ol_program_handle_t Program, const char *KernelName,
- ol_kernel_handle_t *Kernel) {
- if (offloadConfig().ValidationEnabled) {
- if (NULL == Program) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Program");
- }
-
- if (NULL == KernelName) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == KernelName");
- }
-
- if (NULL == Kernel) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == Kernel");
- }
- }
-
- return llvm::offload::olGetKernel_impl(Program, KernelName, Kernel);
-}
-OL_APIEXPORT ol_result_t OL_APICALL olGetKernel(ol_program_handle_t Program,
- const char *KernelName,
- ol_kernel_handle_t *Kernel) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olGetKernel";
- }
-
- ol_result_t Result =
- llvmErrorToOffloadError(olGetKernel_val(Program, KernelName, Kernel));
-
- if (offloadConfig().TracingEnabled) {
- ol_get_kernel_params_t Params = {&Program, &KernelName, &Kernel};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olGetKernelWithCodeLoc(ol_program_handle_t Program,
- const char *KernelName,
- ol_kernel_handle_t *Kernel,
- ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result = ::olGetKernel(Program, KernelName, Kernel);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-llvm::Error
-olLaunchKernel_val(ol_queue_handle_t Queue, ol_device_handle_t Device,
- ol_kernel_handle_t Kernel, const void *ArgumentsData,
- size_t ArgumentsSize,
- const ol_kernel_launch_size_args_t *LaunchSizeArgs,
- ol_event_handle_t *EventOut) {
- if (offloadConfig().ValidationEnabled) {
- if (Queue == NULL && EventOut != NULL) {
- return createOffloadError(
- error::ErrorCode::INVALID_ARGUMENT,
- "validation failure: Queue == NULL && EventOut != NULL");
- }
-
- if (NULL == Device) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Device");
- }
-
- if (NULL == Kernel) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_HANDLE,
- "validation failure: NULL == Kernel");
- }
-
- if (NULL == ArgumentsData) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == ArgumentsData");
- }
-
- if (NULL == LaunchSizeArgs) {
- return createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
- "validation failure: NULL == LaunchSizeArgs");
- }
- }
-
- return llvm::offload::olLaunchKernel_impl(Queue, Device, Kernel,
- ArgumentsData, ArgumentsSize,
- LaunchSizeArgs, EventOut);
-}
-OL_APIEXPORT ol_result_t OL_APICALL olLaunchKernel(
- ol_queue_handle_t Queue, ol_device_handle_t Device,
- ol_kernel_handle_t Kernel, const void *ArgumentsData, size_t ArgumentsSize,
- const ol_kernel_launch_size_args_t *LaunchSizeArgs,
- ol_event_handle_t *EventOut) {
- if (offloadConfig().TracingEnabled) {
- llvm::errs() << "---> olLaunchKernel";
- }
-
- ol_result_t Result = llvmErrorToOffloadError(
- olLaunchKernel_val(Queue, Device, Kernel, ArgumentsData, ArgumentsSize,
- LaunchSizeArgs, EventOut));
-
- if (offloadConfig().TracingEnabled) {
- ol_launch_kernel_params_t Params = {
- &Queue, &Device, &Kernel, &ArgumentsData,
- &ArgumentsSize, &LaunchSizeArgs, &EventOut};
- llvm::errs() << "(" << &Params << ")";
- llvm::errs() << "-> " << Result << "\n";
- if (Result && Result->Details) {
- llvm::errs() << " *Error Details* " << Result->Details << " \n";
- }
- }
- return Result;
-}
-ol_result_t olLaunchKernelWithCodeLoc(
- ol_queue_handle_t Queue, ol_device_handle_t Device,
- ol_kernel_handle_t Kernel, const void *ArgumentsData, size_t ArgumentsSize,
- const ol_kernel_launch_size_args_t *LaunchSizeArgs,
- ol_event_handle_t *EventOut, ol_code_location_t *CodeLocation) {
- currentCodeLocation() = CodeLocation;
- ol_result_t Result =
- ::olLaunchKernel(Queue, Device, Kernel, ArgumentsData, ArgumentsSize,
- LaunchSizeArgs, EventOut);
-
- currentCodeLocation() = nullptr;
- return Result;
-}
diff --git a/offload/liboffload/include/generated/OffloadFuncs.inc b/offload/liboffload/include/generated/OffloadFuncs.inc
deleted file mode 100644
index 78ff9ddb82799..0000000000000
--- a/offload/liboffload/include/generated/OffloadFuncs.inc
+++ /dev/null
@@ -1,52 +0,0 @@
-//===- Auto-generated file, part of the LLVM/Offload project --------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef OFFLOAD_FUNC
-#error Please define the macro OFFLOAD_FUNC(Function)
-#endif
-
-OFFLOAD_FUNC(olInit)
-OFFLOAD_FUNC(olShutDown)
-OFFLOAD_FUNC(olGetPlatformInfo)
-OFFLOAD_FUNC(olGetPlatformInfoSize)
-OFFLOAD_FUNC(olIterateDevices)
-OFFLOAD_FUNC(olGetDeviceInfo)
-OFFLOAD_FUNC(olGetDeviceInfoSize)
-OFFLOAD_FUNC(olMemAlloc)
-OFFLOAD_FUNC(olMemFree)
-OFFLOAD_FUNC(olMemcpy)
-OFFLOAD_FUNC(olCreateQueue)
-OFFLOAD_FUNC(olDestroyQueue)
-OFFLOAD_FUNC(olWaitQueue)
-OFFLOAD_FUNC(olDestroyEvent)
-OFFLOAD_FUNC(olWaitEvent)
-OFFLOAD_FUNC(olCreateProgram)
-OFFLOAD_FUNC(olDestroyProgram)
-OFFLOAD_FUNC(olGetKernel)
-OFFLOAD_FUNC(olLaunchKernel)
-OFFLOAD_FUNC(olInitWithCodeLoc)
-OFFLOAD_FUNC(olShutDownWithCodeLoc)
-OFFLOAD_FUNC(olGetPlatformInfoWithCodeLoc)
-OFFLOAD_FUNC(olGetPlatformInfoSizeWithCodeLoc)
-OFFLOAD_FUNC(olIterateDevicesWithCodeLoc)
-OFFLOAD_FUNC(olGetDeviceInfoWithCodeLoc)
-OFFLOAD_FUNC(olGetDeviceInfoSizeWithCodeLoc)
-OFFLOAD_FUNC(olMemAllocWithCodeLoc)
-OFFLOAD_FUNC(olMemFreeWithCodeLoc)
-OFFLOAD_FUNC(olMemcpyWithCodeLoc)
-OFFLOAD_FUNC(olCreateQueueWithCodeLoc)
-OFFLOAD_FUNC(olDestroyQueueWithCodeLoc)
-OFFLOAD_FUNC(olWaitQueueWithCodeLoc)
-OFFLOAD_FUNC(olDestroyEventWithCodeLoc)
-OFFLOAD_FUNC(olWaitEventWithCodeLoc)
-OFFLOAD_FUNC(olCreateProgramWithCodeLoc)
-OFFLOAD_FUNC(olDestroyProgramWithCodeLoc)
-OFFLOAD_FUNC(olGetKernelWithCodeLoc)
-OFFLOAD_FUNC(olLaunchKernelWithCodeLoc)
-
-#undef OFFLOAD_FUNC
diff --git a/offload/liboffload/include/generated/OffloadImplFuncDecls.inc b/offload/liboffload/include/generated/OffloadImplFuncDecls.inc
deleted file mode 100644
index 71d25dee87867..0000000000000
--- a/offload/liboffload/include/generated/OffloadImplFuncDecls.inc
+++ /dev/null
@@ -1,60 +0,0 @@
-//===- Auto-generated file, part of the LLVM/Offload project --------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-Error olInit_impl();
-
-Error olShutDown_impl();
-
-Error olGetPlatformInfo_impl(ol_platform_handle_t Platform,
- ol_platform_info_t PropName, size_t PropSize,
- void *PropValue);
-
-Error olGetPlatformInfoSize_impl(ol_platform_handle_t Platform,
- ol_platform_info_t PropName,
- size_t *PropSizeRet);
-
-Error olIterateDevices_impl(ol_device_iterate_cb_t Callback, void *UserData);
-
-Error olGetDeviceInfo_impl(ol_device_handle_t Device, ol_device_info_t PropName,
- size_t PropSize, void *PropValue);
-
-Error olGetDeviceInfoSize_impl(ol_device_handle_t Device,
- ol_device_info_t PropName, size_t *PropSizeRet);
-
-Error olMemAlloc_impl(ol_device_handle_t Device, ol_alloc_type_t Type,
- size_t Size, void **AllocationOut);
-
-Error olMemFree_impl(void *Address);
-
-Error olMemcpy_impl(ol_queue_handle_t Queue, void *DstPtr,
- ol_device_handle_t DstDevice, void *SrcPtr,
- ol_device_handle_t SrcDevice, size_t Size,
- ol_event_handle_t *EventOut);
-
-Error olCreateQueue_impl(ol_device_handle_t Device, ol_queue_handle_t *Queue);
-
-Error olDestroyQueue_impl(ol_queue_handle_t Queue);
-
-Error olWaitQueue_impl(ol_queue_handle_t Queue);
-
-Error olDestroyEvent_impl(ol_event_handle_t Event);
-
-Error olWaitEvent_impl(ol_event_handle_t Event);
-
-Error olCreateProgram_impl(ol_device_handle_t Device, const void *ProgData,
- size_t ProgDataSize, ol_program_handle_t *Program);
-
-Error olDestroyProgram_impl(ol_program_handle_t Program);
-
-Error olGetKernel_impl(ol_program_handle_t Program, const char *KernelName,
- ol_kernel_handle_t *Kernel);
-
-Error olLaunchKernel_impl(ol_queue_handle_t Queue, ol_device_handle_t Device,
- ol_kernel_handle_t Kernel, const void *ArgumentsData,
- size_t ArgumentsSize,
- const ol_kernel_launch_size_args_t *LaunchSizeArgs,
- ol_event_handle_t *EventOut);
diff --git a/offload/liboffload/include/generated/OffloadPrint.hpp b/offload/liboffload/include/generated/OffloadPrint.hpp
deleted file mode 100644
index 3aad6223d4dea..0000000000000
--- a/offload/liboffload/include/generated/OffloadPrint.hpp
+++ /dev/null
@@ -1,645 +0,0 @@
-//===- Auto-generated file, part of the LLVM/Offload project --------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Auto-generated file, do not manually edit.
-
-#pragma once
-
-#include <OffloadAPI.h>
-#include <llvm/Support/raw_ostream.h>
-
-template <typename T>
-inline ol_result_t printPtr(llvm::raw_ostream &os, const T *ptr);
-template <typename T>
-inline void printTagged(llvm::raw_ostream &os, const void *ptr, T value,
- size_t size);
-template <typename T> struct is_handle : std::false_type {};
-template <> struct is_handle<ol_platform_handle_t> : std::true_type {};
-template <> struct is_handle<ol_device_handle_t> : std::true_type {};
-template <> struct is_handle<ol_context_handle_t> : std::true_type {};
-template <> struct is_handle<ol_queue_handle_t> : std::true_type {};
-template <> struct is_handle<ol_event_handle_t> : std::true_type {};
-template <> struct is_handle<ol_program_handle_t> : std::true_type {};
-template <typename T> inline constexpr bool is_handle_v = is_handle<T>::value;
-
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- enum ol_errc_t value);
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- enum ol_platform_info_t value);
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- enum ol_platform_backend_t value);
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- enum ol_device_type_t value);
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- enum ol_device_info_t value);
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- enum ol_alloc_type_t value);
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Print operator for the ol_errc_t type
-/// @returns llvm::raw_ostream &
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- enum ol_errc_t value) {
- switch (value) {
- case OL_ERRC_SUCCESS:
- os << "OL_ERRC_SUCCESS";
- break;
- case OL_ERRC_UNKNOWN:
- os << "OL_ERRC_UNKNOWN";
- break;
- case OL_ERRC_HOST_IO:
- os << "OL_ERRC_HOST_IO";
- break;
- case OL_ERRC_INVALID_BINARY:
- os << "OL_ERRC_INVALID_BINARY";
- break;
- case OL_ERRC_INVALID_NULL_POINTER:
- os << "OL_ERRC_INVALID_NULL_POINTER";
- break;
- case OL_ERRC_INVALID_ARGUMENT:
- os << "OL_ERRC_INVALID_ARGUMENT";
- break;
- case OL_ERRC_NOT_FOUND:
- os << "OL_ERRC_NOT_FOUND";
- break;
- case OL_ERRC_OUT_OF_RESOURCES:
- os << "OL_ERRC_OUT_OF_RESOURCES";
- break;
- case OL_ERRC_INVALID_SIZE:
- os << "OL_ERRC_INVALID_SIZE";
- break;
- case OL_ERRC_INVALID_ENUMERATION:
- os << "OL_ERRC_INVALID_ENUMERATION";
- break;
- case OL_ERRC_HOST_TOOL_NOT_FOUND:
- os << "OL_ERRC_HOST_TOOL_NOT_FOUND";
- break;
- case OL_ERRC_INVALID_VALUE:
- os << "OL_ERRC_INVALID_VALUE";
- break;
- case OL_ERRC_UNIMPLEMENTED:
- os << "OL_ERRC_UNIMPLEMENTED";
- break;
- case OL_ERRC_UNSUPPORTED:
- os << "OL_ERRC_UNSUPPORTED";
- break;
- case OL_ERRC_ASSEMBLE_FAILURE:
- os << "OL_ERRC_ASSEMBLE_FAILURE";
- break;
- case OL_ERRC_LINK_FAILURE:
- os << "OL_ERRC_LINK_FAILURE";
- break;
- case OL_ERRC_BACKEND_FAILURE:
- os << "OL_ERRC_BACKEND_FAILURE";
- break;
- case OL_ERRC_INVALID_NULL_HANDLE:
- os << "OL_ERRC_INVALID_NULL_HANDLE";
- break;
- case OL_ERRC_INVALID_PLATFORM:
- os << "OL_ERRC_INVALID_PLATFORM";
- break;
- case OL_ERRC_INVALID_DEVICE:
- os << "OL_ERRC_INVALID_DEVICE";
- break;
- case OL_ERRC_INVALID_QUEUE:
- os << "OL_ERRC_INVALID_QUEUE";
- break;
- case OL_ERRC_INVALID_EVENT:
- os << "OL_ERRC_INVALID_EVENT";
- break;
- default:
- os << "unknown enumerator";
- break;
- }
- return os;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Print operator for the ol_platform_info_t type
-/// @returns llvm::raw_ostream &
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- enum ol_platform_info_t value) {
- switch (value) {
- case OL_PLATFORM_INFO_NAME:
- os << "OL_PLATFORM_INFO_NAME";
- break;
- case OL_PLATFORM_INFO_VENDOR_NAME:
- os << "OL_PLATFORM_INFO_VENDOR_NAME";
- break;
- case OL_PLATFORM_INFO_VERSION:
- os << "OL_PLATFORM_INFO_VERSION";
- break;
- case OL_PLATFORM_INFO_BACKEND:
- os << "OL_PLATFORM_INFO_BACKEND";
- break;
- default:
- os << "unknown enumerator";
- break;
- }
- return os;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Print type-tagged ol_platform_info_t enum value
-/// @returns llvm::raw_ostream &
-template <>
-inline void printTagged(llvm::raw_ostream &os, const void *ptr,
- ol_platform_info_t value, size_t size) {
- if (ptr == NULL) {
- printPtr(os, ptr);
- return;
- }
-
- switch (value) {
- case OL_PLATFORM_INFO_NAME: {
- printPtr(os, (const char *)ptr);
- break;
- }
- case OL_PLATFORM_INFO_VENDOR_NAME: {
- printPtr(os, (const char *)ptr);
- break;
- }
- case OL_PLATFORM_INFO_VERSION: {
- printPtr(os, (const char *)ptr);
- break;
- }
- case OL_PLATFORM_INFO_BACKEND: {
- const ol_platform_backend_t *const tptr =
- (const ol_platform_backend_t *const)ptr;
- os << (const void *)tptr << " (";
- os << *tptr;
- os << ")";
- break;
- }
- default:
- os << "unknown enumerator";
- break;
- }
-}
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Print operator for the ol_platform_backend_t type
-/// @returns llvm::raw_ostream &
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- enum ol_platform_backend_t value) {
- switch (value) {
- case OL_PLATFORM_BACKEND_UNKNOWN:
- os << "OL_PLATFORM_BACKEND_UNKNOWN";
- break;
- case OL_PLATFORM_BACKEND_CUDA:
- os << "OL_PLATFORM_BACKEND_CUDA";
- break;
- case OL_PLATFORM_BACKEND_AMDGPU:
- os << "OL_PLATFORM_BACKEND_AMDGPU";
- break;
- case OL_PLATFORM_BACKEND_HOST:
- os << "OL_PLATFORM_BACKEND_HOST";
- break;
- default:
- os << "unknown enumerator";
- break;
- }
- return os;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Print operator for the ol_device_type_t type
-/// @returns llvm::raw_ostream &
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- enum ol_device_type_t value) {
- switch (value) {
- case OL_DEVICE_TYPE_DEFAULT:
- os << "OL_DEVICE_TYPE_DEFAULT";
- break;
- case OL_DEVICE_TYPE_ALL:
- os << "OL_DEVICE_TYPE_ALL";
- break;
- case OL_DEVICE_TYPE_GPU:
- os << "OL_DEVICE_TYPE_GPU";
- break;
- case OL_DEVICE_TYPE_CPU:
- os << "OL_DEVICE_TYPE_CPU";
- break;
- case OL_DEVICE_TYPE_HOST:
- os << "OL_DEVICE_TYPE_HOST";
- break;
- default:
- os << "unknown enumerator";
- break;
- }
- return os;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Print operator for the ol_device_info_t type
-/// @returns llvm::raw_ostream &
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- enum ol_device_info_t value) {
- switch (value) {
- case OL_DEVICE_INFO_TYPE:
- os << "OL_DEVICE_INFO_TYPE";
- break;
- case OL_DEVICE_INFO_PLATFORM:
- os << "OL_DEVICE_INFO_PLATFORM";
- break;
- case OL_DEVICE_INFO_NAME:
- os << "OL_DEVICE_INFO_NAME";
- break;
- case OL_DEVICE_INFO_VENDOR:
- os << "OL_DEVICE_INFO_VENDOR";
- break;
- case OL_DEVICE_INFO_DRIVER_VERSION:
- os << "OL_DEVICE_INFO_DRIVER_VERSION";
- break;
- default:
- os << "unknown enumerator";
- break;
- }
- return os;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Print type-tagged ol_device_info_t enum value
-/// @returns llvm::raw_ostream &
-template <>
-inline void printTagged(llvm::raw_ostream &os, const void *ptr,
- ol_device_info_t value, size_t size) {
- if (ptr == NULL) {
- printPtr(os, ptr);
- return;
- }
-
- switch (value) {
- case OL_DEVICE_INFO_TYPE: {
- const ol_device_type_t *const tptr = (const ol_device_type_t *const)ptr;
- os << (const void *)tptr << " (";
- os << *tptr;
- os << ")";
- break;
- }
- case OL_DEVICE_INFO_PLATFORM: {
- const ol_platform_handle_t *const tptr =
- (const ol_platform_handle_t *const)ptr;
- os << (const void *)tptr << " (";
- os << *tptr;
- os << ")";
- break;
- }
- case OL_DEVICE_INFO_NAME: {
- printPtr(os, (const char *)ptr);
- break;
- }
- case OL_DEVICE_INFO_VENDOR: {
- printPtr(os, (const char *)ptr);
- break;
- }
- case OL_DEVICE_INFO_DRIVER_VERSION: {
- printPtr(os, (const char *)ptr);
- break;
- }
- default:
- os << "unknown enumerator";
- break;
- }
-}
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Print operator for the ol_alloc_type_t type
-/// @returns llvm::raw_ostream &
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- enum ol_alloc_type_t value) {
- switch (value) {
- case OL_ALLOC_TYPE_HOST:
- os << "OL_ALLOC_TYPE_HOST";
- break;
- case OL_ALLOC_TYPE_DEVICE:
- os << "OL_ALLOC_TYPE_DEVICE";
- break;
- case OL_ALLOC_TYPE_MANAGED:
- os << "OL_ALLOC_TYPE_MANAGED";
- break;
- default:
- os << "unknown enumerator";
- break;
- }
- return os;
-}
-
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- const ol_error_struct_t *Err) {
- if (Err == nullptr) {
- os << "OL_SUCCESS";
- } else {
- os << Err->Code;
- }
- return os;
-}
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Print operator for the ol_code_location_t type
-/// @returns llvm::raw_ostream &
-
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- const struct ol_code_location_t params) {
- os << "(struct ol_code_location_t){";
- os << ".FunctionName = ";
- printPtr(os, params.FunctionName);
- os << ", ";
- os << ".SourceFile = ";
- printPtr(os, params.SourceFile);
- os << ", ";
- os << ".LineNumber = ";
- os << params.LineNumber;
- os << ", ";
- os << ".ColumnNumber = ";
- os << params.ColumnNumber;
- os << "}";
- return os;
-}
-///////////////////////////////////////////////////////////////////////////////
-/// @brief Print operator for the ol_kernel_launch_size_args_t type
-/// @returns llvm::raw_ostream &
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os,
- const struct ol_kernel_launch_size_args_t params) {
- os << "(struct ol_kernel_launch_size_args_t){";
- os << ".Dimensions = ";
- os << params.Dimensions;
- os << ", ";
- os << ".NumGroupsX = ";
- os << params.NumGroupsX;
- os << ", ";
- os << ".NumGroupsY = ";
- os << params.NumGroupsY;
- os << ", ";
- os << ".NumGroupsZ = ";
- os << params.NumGroupsZ;
- os << ", ";
- os << ".GroupSizeX = ";
- os << params.GroupSizeX;
- os << ", ";
- os << ".GroupSizeY = ";
- os << params.GroupSizeY;
- os << ", ";
- os << ".GroupSizeZ = ";
- os << params.GroupSizeZ;
- os << ", ";
- os << ".DynSharedMemory = ";
- os << params.DynSharedMemory;
- os << "}";
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os,
- const struct ol_get_platform_info_params_t *params) {
- os << ".Platform = ";
- printPtr(os, *params->pPlatform);
- os << ", ";
- os << ".PropName = ";
- os << *params->pPropName;
- os << ", ";
- os << ".PropSize = ";
- os << *params->pPropSize;
- os << ", ";
- os << ".PropValue = ";
- printTagged(os, *params->pPropValue, *params->pPropName, *params->pPropSize);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os,
- const struct ol_get_platform_info_size_params_t *params) {
- os << ".Platform = ";
- printPtr(os, *params->pPlatform);
- os << ", ";
- os << ".PropName = ";
- os << *params->pPropName;
- os << ", ";
- os << ".PropSizeRet = ";
- printPtr(os, *params->pPropSizeRet);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os,
- const struct ol_iterate_devices_params_t *params) {
- os << ".Callback = ";
- os << reinterpret_cast<void *>(*params->pCallback);
- os << ", ";
- os << ".UserData = ";
- printPtr(os, *params->pUserData);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os,
- const struct ol_get_device_info_params_t *params) {
- os << ".Device = ";
- printPtr(os, *params->pDevice);
- os << ", ";
- os << ".PropName = ";
- os << *params->pPropName;
- os << ", ";
- os << ".PropSize = ";
- os << *params->pPropSize;
- os << ", ";
- os << ".PropValue = ";
- printTagged(os, *params->pPropValue, *params->pPropName, *params->pPropSize);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os,
- const struct ol_get_device_info_size_params_t *params) {
- os << ".Device = ";
- printPtr(os, *params->pDevice);
- os << ", ";
- os << ".PropName = ";
- os << *params->pPropName;
- os << ", ";
- os << ".PropSizeRet = ";
- printPtr(os, *params->pPropSizeRet);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os, const struct ol_mem_alloc_params_t *params) {
- os << ".Device = ";
- printPtr(os, *params->pDevice);
- os << ", ";
- os << ".Type = ";
- os << *params->pType;
- os << ", ";
- os << ".Size = ";
- os << *params->pSize;
- os << ", ";
- os << ".AllocationOut = ";
- printPtr(os, *params->pAllocationOut);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os, const struct ol_mem_free_params_t *params) {
- os << ".Address = ";
- printPtr(os, *params->pAddress);
- return os;
-}
-
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
- const struct ol_memcpy_params_t *params) {
- os << ".Queue = ";
- printPtr(os, *params->pQueue);
- os << ", ";
- os << ".DstPtr = ";
- printPtr(os, *params->pDstPtr);
- os << ", ";
- os << ".DstDevice = ";
- printPtr(os, *params->pDstDevice);
- os << ", ";
- os << ".SrcPtr = ";
- printPtr(os, *params->pSrcPtr);
- os << ", ";
- os << ".SrcDevice = ";
- printPtr(os, *params->pSrcDevice);
- os << ", ";
- os << ".Size = ";
- os << *params->pSize;
- os << ", ";
- os << ".EventOut = ";
- printPtr(os, *params->pEventOut);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os,
- const struct ol_create_queue_params_t *params) {
- os << ".Device = ";
- printPtr(os, *params->pDevice);
- os << ", ";
- os << ".Queue = ";
- printPtr(os, *params->pQueue);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os,
- const struct ol_destroy_queue_params_t *params) {
- os << ".Queue = ";
- printPtr(os, *params->pQueue);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os, const struct ol_wait_queue_params_t *params) {
- os << ".Queue = ";
- printPtr(os, *params->pQueue);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os,
- const struct ol_destroy_event_params_t *params) {
- os << ".Event = ";
- printPtr(os, *params->pEvent);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os, const struct ol_wait_event_params_t *params) {
- os << ".Event = ";
- printPtr(os, *params->pEvent);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os,
- const struct ol_create_program_params_t *params) {
- os << ".Device = ";
- printPtr(os, *params->pDevice);
- os << ", ";
- os << ".ProgData = ";
- printPtr(os, *params->pProgData);
- os << ", ";
- os << ".ProgDataSize = ";
- os << *params->pProgDataSize;
- os << ", ";
- os << ".Program = ";
- printPtr(os, *params->pProgram);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os,
- const struct ol_destroy_program_params_t *params) {
- os << ".Program = ";
- printPtr(os, *params->pProgram);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os, const struct ol_get_kernel_params_t *params) {
- os << ".Program = ";
- printPtr(os, *params->pProgram);
- os << ", ";
- os << ".KernelName = ";
- printPtr(os, *params->pKernelName);
- os << ", ";
- os << ".Kernel = ";
- printPtr(os, *params->pKernel);
- return os;
-}
-
-inline llvm::raw_ostream &
-operator<<(llvm::raw_ostream &os,
- const struct ol_launch_kernel_params_t *params) {
- os << ".Queue = ";
- printPtr(os, *params->pQueue);
- os << ", ";
- os << ".Device = ";
- printPtr(os, *params->pDevice);
- os << ", ";
- os << ".Kernel = ";
- printPtr(os, *params->pKernel);
- os << ", ";
- os << ".ArgumentsData = ";
- printPtr(os, *params->pArgumentsData);
- os << ", ";
- os << ".ArgumentsSize = ";
- os << *params->pArgumentsSize;
- os << ", ";
- os << ".LaunchSizeArgs = ";
- printPtr(os, *params->pLaunchSizeArgs);
- os << ", ";
- os << ".EventOut = ";
- printPtr(os, *params->pEventOut);
- return os;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// @brief Print pointer value
-template <typename T>
-inline ol_result_t printPtr(llvm::raw_ostream &os, const T *ptr) {
- if (ptr == nullptr) {
- os << "nullptr";
- } else if constexpr (std::is_pointer_v<T>) {
- os << (const void *)(ptr) << " (";
- printPtr(os, *ptr);
- os << ")";
- } else if constexpr (std::is_void_v<T> || is_handle_v<T *>) {
- os << (const void *)ptr;
- } else if constexpr (std::is_same_v<std::remove_cv_t<T>, char>) {
- os << (const void *)(ptr) << " (";
- os << ptr;
- os << ")";
- } else {
- os << (const void *)(ptr) << " (";
- os << *ptr;
- os << ")";
- }
-
- return OL_SUCCESS;
-}
diff --git a/offload/libomptarget/CMakeLists.txt b/offload/libomptarget/CMakeLists.txt
index 93e684e53bf17..cb37924e0c1c7 100644
--- a/offload/libomptarget/CMakeLists.txt
+++ b/offload/libomptarget/CMakeLists.txt
@@ -6,6 +6,13 @@ else()
set(LIBOMP omp)
endif()
+# The error codes in this header are shared with liboffload, so need to be
+# generated from the same source.
+include(TableGen)
+set(LLVM_TARGET_DEFINITIONS ${CMAKE_CURRENT_SOURCE_DIR}/../liboffload/API/OffloadAPI.td)
+tablegen(OFFLOAD ../include/Shared/OffloadErrcodes.inc -gen-errcodes -I ${CMAKE_CURRENT_SOURCE_DIR}/../liboffload/API)
+add_public_tablegen_target(LibomptargetOffloadErrcodes)
+
add_llvm_library(omptarget
SHARED
diff --git a/offload/plugins-nextgen/CMakeLists.txt b/offload/plugins-nextgen/CMakeLists.txt
index 9b5b12bea7142..083c46f7ab279 100644
--- a/offload/plugins-nextgen/CMakeLists.txt
+++ b/offload/plugins-nextgen/CMakeLists.txt
@@ -32,6 +32,8 @@ function(add_target_library target_name lib_name)
NO_INSTALL_RPATH
BUILDTREE_ONLY
+
+ DEPENDS LibomptargetOffloadErrcodes
)
llvm_update_compile_flags(${target_name})
More information about the llvm-commits
mailing list