tvm
cuda_ipc_memory.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef TVM_RUNTIME_DISCO_CUDA_IPC_MEMORY_H_
21 #define TVM_RUNTIME_DISCO_CUDA_IPC_MEMORY_H_
22 
23 #include <tvm/runtime/base.h>
25 
26 #include <vector>
27 
28 namespace tvm {
29 namespace runtime {
30 namespace cuda_ipc {
31 
40 class CUDAIPCMemoryObj : public ffi::Object {
41  public:
45  int worker_id;
52  std::vector<void*> remote_data;
53 
54  // We introduce the barrier helper data below per CUDAIPCMemory object
55  // so that they can be used by custom collective operations and allow
56  // fine-grained synchronization on each buffer. These barriers have
57  // low overhead, and can potentially enable concurrent execution of
58  // kernels in future.
63  std::vector<void*> barrier_in;
68  std::vector<void*> barrier_out;
71 
72  static constexpr const bool _type_mutable = true;
73  TVM_FFI_DECLARE_OBJECT_INFO("tvm.runtime.disco.cuda_ipc_memory", CUDAIPCMemoryObj, ffi::Object);
74 };
75 
80 class CUDAIPCMemory : public ffi::ObjectRef {
81  public:
91 
93 };
94 
95 } // namespace cuda_ipc
96 } // namespace runtime
97 } // namespace tvm
98 
99 #endif // TVM_RUNTIME_DISCO_CUDA_IPC_MEMORY_H_
The CUDA IPC (interprocess communication) memory object, which internally contains data pointers to C...
Definition: cuda_ipc_memory.h:40
static constexpr const bool _type_mutable
Definition: cuda_ipc_memory.h:72
std::vector< void * > barrier_out
The pointers to output barrier signals of all workers for all-reduce. It has "num_workers" pointers,...
Definition: cuda_ipc_memory.h:68
std::vector< void * > barrier_in
The pointers to input barrier signals of all workers for all-reduce. It has "num_workers" pointers,...
Definition: cuda_ipc_memory.h:63
TVM_FFI_DECLARE_OBJECT_INFO("tvm.runtime.disco.cuda_ipc_memory", CUDAIPCMemoryObj, ffi::Object)
int barrier_flag
The integer buffer flag for all-reduce.
Definition: cuda_ipc_memory.h:70
int num_workers
The number of GPU workers.
Definition: cuda_ipc_memory.h:43
int worker_id
The worker id corresponding to this IPC memory object.
Definition: cuda_ipc_memory.h:45
std::vector< void * > remote_data
The data pointers of all all-reduce inputs. It has "num_workers" pointers. The i-th pointer is the da...
Definition: cuda_ipc_memory.h:52
Managed reference to CUDAIPCMemoryObj.
Definition: cuda_ipc_memory.h:80
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(CUDAIPCMemory, ffi::ObjectRef, CUDAIPCMemoryObj)
static TVM_RUNTIME_DLL CUDAIPCMemory GetIPCMemoryFromDevicePtr(void *ptr)
Given a local CUDA data pointer, return the CUDAIPCMemory object of the pointer.
static TVM_RUNTIME_DLL memory::Allocator * GlobalAllocator()
Get the global singleton CUDAIPCMemory allocator.
Definition: memory_manager.h:57
Abstract device memory management API.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition: analyzer.h:37
#define TVM_RUNTIME_DLL
Definition: base.h:88