1 //===--- amdgpu/impl/impl_runtime.h ------------------------------- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #ifndef INCLUDE_IMPL_RUNTIME_H_
9 #define INCLUDE_IMPL_RUNTIME_H_
10 
11 #include "impl.h"
12 #include "hsa_api.h"
13 
14 extern "C" {
15 
16 /** \defgroup module_functions ATMI Module
17  * @{
18  */
19 
20 /**
21  * @brief Register the ATMI code module from memory on to a specific place
22  * (device).
23  *
24  * @detail Currently, only GPU devices need explicit module registration because
25  * of their specific ISAs that require a separate compilation phase. On the
26  * other
27  * hand, CPU devices execute regular x86 functions that are compiled with the
28  * host program.
29  *
30  * @param[in] module_bytes A memory region that contains the GPU modules
31  * targeting ::AMDGCN platform types. Value cannot be NULL.
32  *
33  * @param[in] module_size Size of module region
34  *
35  * @param[in] place Denotes the execution place (device) on which the module
36  * should be registered and loaded.
37  *
38  * @param[in] on_deserialized_data Callback run on deserialized code object,
39  * before loading it
40  *
41  * @param[in] cb_state void* passed to on_deserialized_data callback
42  *
43  * @retval ::HSA_STATUS_SUCCESS The function has executed successfully.
44  *
45  * @retval ::HSA_STATUS_ERROR The function encountered errors.
46  *
47  */
48 hsa_status_t atmi_module_register_from_memory_to_place(
49     void *module_bytes, size_t module_size, int DeviceId,
50     hsa_status_t (*on_deserialized_data)(void *data, size_t size,
51                                          void *cb_state),
52     void *cb_state);
53 
54 /** @} */
55 
56 hsa_status_t atmi_memcpy_h2d(hsa_signal_t signal, void *deviceDest,
57                              const void *hostSrc, size_t size,
58                              hsa_agent_t agent,
59                              hsa_amd_memory_pool_t MemoryPool);
60 
61 hsa_status_t atmi_memcpy_d2h(hsa_signal_t sig, void *hostDest,
62                              const void *deviceSrc, size_t size,
63                              hsa_agent_t agent,
64                              hsa_amd_memory_pool_t MemoryPool);
65 
66 /** @} */
67 
68 }
69 
70 #endif // INCLUDE_IMPL_RUNTIME_H_
71