tvm
Loading...
Searching...
No Matches
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#include <tvm/runtime/tensor.h>
26
27#include <vector>
28
29namespace tvm {
30namespace runtime {
31namespace cuda_ipc {
32
41class CUDAIPCMemoryObj : public ffi::Object {
42 public:
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 bool _type_mutable = true;
74 TVM_FFI_DECLARE_OBJECT_INFO("tvm.runtime.disco.cuda_ipc_memory", CUDAIPCMemoryObj, ffi::Object);
75};
76
81class CUDAIPCMemory : public ffi::ObjectRef {
82 public:
92
93 explicit CUDAIPCMemory(ffi::UnsafeInit tag, ffi::ObjectPtr<CUDAIPCMemoryObj> n)
94 : ffi::ObjectRef(tag) {
95 data_ = std::move(n);
96 }
97
99};
100
101} // namespace cuda_ipc
102} // namespace runtime
103} // namespace tvm
104
105#endif // TVM_RUNTIME_DISCO_CUDA_IPC_MEMORY_H_
Device-independent tensor allocation, copies, views and serialization.
A cache of owning device tensors.
Definition tensor.h:132
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_mutable
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
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: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
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:81
static TVM_RUNTIME_EXTRA_DLL TensorMemoryPool * GlobalMemoryPool()
Get the global singleton CUDAIPCMemory pool.
static TVM_RUNTIME_EXTRA_DLL CUDAIPCMemory GetIPCMemoryFromDevicePtr(void *ptr)
Given a local CUDA data pointer, return the CUDAIPCMemory object of the pointer.
CUDAIPCMemory(ffi::UnsafeInit tag, ffi::ObjectPtr< CUDAIPCMemoryObj > n)
Definition cuda_ipc_memory.h:93
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(CUDAIPCMemory, ffi::ObjectRef, CUDAIPCMemoryObj)
Parent runtime-extra symbol visibility.
#define TVM_RUNTIME_EXTRA_DLL
Definition extra_base.h:45
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analysis.h:41