tvm
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 
25 #include <tvm/runtime/object.h>
26 
27 #include <vector>
28 
29 namespace tvm {
30 namespace runtime {
31 namespace cuda_ipc {
32 
41 class CUDAIPCMemoryObj : public Object {
42  public:
46  int worker_id;
53  std::vector<void*> remote_data;
54 
55  // We introduce the barrier helper data below per CUDAIPCMemory object
56  // so that they can be used by custom collective operations and allow
57  // fine-grained synchronization on each buffer. These barriers have
58  // low overhead, and can potentially enable concurrent execution of
59  // kernels in future.
64  std::vector<void*> barrier_in;
69  std::vector<void*> barrier_out;
72 
73  static constexpr const char* _type_key = "tvm.runtime.disco.cuda_ipc_memory";
74  static constexpr const bool _type_has_method_sequal_reduce = false;
75  static constexpr const bool _type_has_method_shash_reduce = false;
77 };
78 
83 class CUDAIPCMemory : public ObjectRef {
84  public:
93  TVM_DLL static CUDAIPCMemory GetIPCMemoryFromDevicePtr(void* ptr);
94 
96 };
97 
98 } // namespace cuda_ipc
99 } // namespace runtime
100 } // namespace tvm
101 
102 #endif // TVM_RUNTIME_DISCO_CUDA_IPC_MEMORY_H_
Base class of all object reference.
Definition: object.h:520
base class of all object containers.
Definition: object.h:172
The CUDA IPC (interprocess communication) memory object, which internally contains data pointers to C...
Definition: cuda_ipc_memory.h:41
static constexpr const bool _type_has_method_shash_reduce
Definition: cuda_ipc_memory.h:75
static constexpr const bool _type_has_method_sequal_reduce
Definition: cuda_ipc_memory.h:74
static constexpr const char * _type_key
Definition: cuda_ipc_memory.h:73
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:69
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:64
int barrier_flag
The integer buffer flag for all-reduce.
Definition: cuda_ipc_memory.h:71
int num_workers
The number of GPU workers.
Definition: cuda_ipc_memory.h:44
int worker_id
The worker id corresponding to this IPC memory object.
Definition: cuda_ipc_memory.h:46
TVM_DECLARE_BASE_OBJECT_INFO(CUDAIPCMemoryObj, Object)
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:53
Managed reference to CUDAIPCMemoryObj.
Definition: cuda_ipc_memory.h:83
static memory::Allocator * GlobalAllocator()
Get the global singleton CUDAIPCMemory allocator.
TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS(CUDAIPCMemory, ObjectRef, CUDAIPCMemoryObj)
static CUDAIPCMemory GetIPCMemoryFromDevicePtr(void *ptr)
Given a local CUDA data pointer, return the CUDAIPCMemory object of the pointer.
Definition: memory_manager.h:58
Abstract device memory management API.
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:36
A managed object in the TVM runtime.