tvm
Loading...
Searching...
No Matches
disco_worker.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 */
25#ifndef TVM_RUNTIME_DISCO_DISCO_WORKER_H_
26#define TVM_RUNTIME_DISCO_DISCO_WORKER_H_
27
28#include <tvm/ffi/function.h>
31
32#include <vector>
33
34namespace tvm {
35namespace runtime {
36
107
112 thread_local static ThreadLocalDiscoWorker worker;
113 return &worker;
114 }
115};
116
117} // namespace runtime
118} // namespace tvm
119#endif // TVM_RUNTIME_DISCO_DISCO_WORKER_H_
A bi-directional channel for controler-worker communication. This channel is primarily used to transf...
Definition session.h:327
A worker in Disco. It takes a channel to communication with the controler. The worker can be run in a...
Definition disco_worker.h:42
DiscoWorker(int worker_id, int num_workers, int num_groups, WorkerZeroData *worker_zero_data, DiscoChannel *channel)
Construct a worker.
Definition disco_worker.h:53
Device default_device
The default device to allocate data if not specified.
Definition disco_worker.h:81
int local_worker_id
The local id of the worker. This can be different from worker_id if the session is consisted with mul...
Definition disco_worker.h:75
friend struct DiscoWorker::Impl
Definition disco_worker.h:99
int num_groups
Total number of workers.
Definition disco_worker.h:79
int worker_id
The id of the worker.
Definition disco_worker.h:72
static TVM_RUNTIME_EXTRA_DLL DiscoWorker * ThreadLocal()
Get the worker instance on the current thread.
ffi::String ccl
The name of the underlying collective communication library.
Definition disco_worker.h:83
void MainLoop()
Main loop of the worker.
int num_workers
Total number of workers.
Definition disco_worker.h:77
DiscoChannel * channel
The communication channel between the worker and the controler.
Definition disco_worker.h:94
std::vector< ffi::Any > register_file
The registers in the worker.
Definition disco_worker.h:96
WorkerZeroData * worker_zero_data
The data shared between worker-0 and the controler. It's a nullptr if the worker is not worker-0.
Definition disco_worker.h:89
void SetRegister(int reg_id, ffi::AnyView value)
Set the specific register to a specific value.
A special communication channel between controler and worker-0, assuming they are always collocated i...
Definition session.h:344
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
DLDevice Device
Definition device_api.h:46
This file serves as the entry point of Disco and defines key data structures and interfaces.
A threadlocal wrapper of DiscoWorker.
Definition disco_worker.h:104
DiscoWorker * worker
The Disco worker.
Definition disco_worker.h:106
static ThreadLocalDiscoWorker * Get()
Get the threadlocal Disco worker.
Definition disco_worker.h:111