summaryrefslogtreecommitdiff
path: root/offload/liboffload
diff options
context:
space:
mode:
Diffstat (limited to 'offload/liboffload')
-rw-r--r--offload/liboffload/API/CMakeLists.txt3
-rw-r--r--offload/liboffload/API/Kernel.td6
-rw-r--r--offload/liboffload/API/Memory.td2
-rw-r--r--offload/liboffload/src/OffloadImpl.cpp2
4 files changed, 9 insertions, 4 deletions
diff --git a/offload/liboffload/API/CMakeLists.txt b/offload/liboffload/API/CMakeLists.txt
index cf6e132aa57a..e4baa4772a1e 100644
--- a/offload/liboffload/API/CMakeLists.txt
+++ b/offload/liboffload/API/CMakeLists.txt
@@ -7,6 +7,7 @@
set(LLVM_TARGET_DEFINITIONS ${CMAKE_CURRENT_SOURCE_DIR}/OffloadAPI.td)
set(files_to_copy "")
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)
macro(offload_tablegen file)
tablegen(OFFLOAD generated/${file}.gen ${ARGN})
@@ -42,5 +43,7 @@ else()
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()
endif()
diff --git a/offload/liboffload/API/Kernel.td b/offload/liboffload/API/Kernel.td
index 247f9c1bf5b6..45e3d8112791 100644
--- a/offload/liboffload/API/Kernel.td
+++ b/offload/liboffload/API/Kernel.td
@@ -43,19 +43,21 @@ def : Function {
let name = "olLaunchKernel";
let desc = "Enqueue a kernel launch with the specified size and parameters.";
let details = [
- "If a queue is not specified, kernel execution happens synchronously"
+ "If a queue is not specified, kernel execution happens synchronously",
+ "ArgumentsData may be set to NULL (to indicate no parameters)"
];
let params = [
Param<"ol_queue_handle_t", "Queue", "handle of the queue", PARAM_IN_OPTIONAL>,
Param<"ol_device_handle_t", "Device", "handle of the device to execute on", PARAM_IN>,
Param<"ol_kernel_handle_t", "Kernel", "handle of the kernel", PARAM_IN>,
- Param<"const void*", "ArgumentsData", "pointer to the kernel argument struct", PARAM_IN>,
+ Param<"const void*", "ArgumentsData", "pointer to the kernel argument struct", PARAM_IN_OPTIONAL>,
Param<"size_t", "ArgumentsSize", "size of the kernel argument struct", PARAM_IN>,
Param<"const ol_kernel_launch_size_args_t*", "LaunchSizeArgs", "pointer to the struct containing launch size parameters", PARAM_IN>,
Param<"ol_event_handle_t*", "EventOut", "optional recorded event for the enqueued operation", PARAM_OUT_OPTIONAL>
];
let returns = [
Return<"OL_ERRC_INVALID_ARGUMENT", ["`Queue == NULL && EventOut != NULL`"]>,
+ Return<"OL_ERRC_INVALID_ARGUMENT", ["`ArgumentsSize > 0 && ArgumentsData == NULL`"]>,
Return<"OL_ERRC_INVALID_DEVICE", ["If Queue is non-null but does not belong to Device"]>,
];
}
diff --git a/offload/liboffload/API/Memory.td b/offload/liboffload/API/Memory.td
index 9cd1ef6362e1..029975c44829 100644
--- a/offload/liboffload/API/Memory.td
+++ b/offload/liboffload/API/Memory.td
@@ -57,7 +57,7 @@ def : Function {
Param<"ol_queue_handle_t", "Queue", "handle of the queue.", PARAM_IN_OPTIONAL>,
Param<"void*", "DstPtr", "pointer to copy to", PARAM_IN>,
Param<"ol_device_handle_t", "DstDevice", "device that DstPtr belongs to", PARAM_IN>,
- Param<"void*", "SrcPtr", "pointer to copy from", PARAM_IN>,
+ Param<"const void*", "SrcPtr", "pointer to copy from", PARAM_IN>,
Param<"ol_device_handle_t", "SrcDevice", "device that SrcPtr belongs to", PARAM_IN>,
Param<"size_t", "Size", "size in bytes of data to copy", PARAM_IN>,
Param<"ol_event_handle_t*", "EventOut", "optional recorded event for the enqueued operation", PARAM_OUT_OPTIONAL>
diff --git a/offload/liboffload/src/OffloadImpl.cpp b/offload/liboffload/src/OffloadImpl.cpp
index 7b67cbba43e6..d2b331905ab7 100644
--- a/offload/liboffload/src/OffloadImpl.cpp
+++ b/offload/liboffload/src/OffloadImpl.cpp
@@ -399,7 +399,7 @@ ol_event_handle_t makeEvent(ol_queue_handle_t Queue) {
}
Error olMemcpy_impl(ol_queue_handle_t Queue, void *DstPtr,
- ol_device_handle_t DstDevice, void *SrcPtr,
+ ol_device_handle_t DstDevice, const void *SrcPtr,
ol_device_handle_t SrcDevice, size_t Size,
ol_event_handle_t *EventOut) {
if (DstDevice == HostDevice() && SrcDevice == HostDevice()) {