Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Binyang2014 committed Nov 24, 2024
1 parent e762d5e commit 2fe679e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/executor/execution_plan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ std::vector<T> filter(const std::vector<T>& vec, Predicate pred) {

auto getOpType = [](const std::string& str) {
if (str == "nop") {
return mscclpp::OperationType::THREADBLOCK_BARRIER;
} else if (str == "barrier") {
return mscclpp::OperationType::BARRIER;
} else if (str == "put") {
return mscclpp::OperationType::PUT;
Expand Down Expand Up @@ -456,6 +458,12 @@ void ExecutionPlan::Impl::setupOperations(const json& gpus, size_t constSrcOffse
operation.size =
this->getNChunkSize(rank, this->inputSize, this->outputSize, (uint32_t)op["cnt"], chunkIndexes);
}
if (op.contains("barrier_id")) {
operation.deviceSyncerIndex = op["barrier_id"];
}
if (op.contains("nthread_blocks")) {
operation.nThreadBlocks = op["nthread_blocks"];
}
ops.push_back(operation);
}
this->operations[rank].push_back(ops);
Expand Down
1 change: 1 addition & 0 deletions src/include/execution_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ enum class ChannelType : uint8_t {

// NOTE(chhwang): any modification here requires corresponding updates in `tools/npkit/npkit_trace_generator.py`.
enum class OperationType : uint8_t {
THREADBLOCK_BARRIER,
BARRIER,
PUT,
PUT_PACKET,
Expand Down
4 changes: 3 additions & 1 deletion src/include/execution_kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,9 @@ __global__ void executionKernel([[maybe_unused]] int rank /*for debug*/, T* inpu
event_buffer, &event_buffer_head);
#endif

if (op.type == OperationType::BARRIER) {
if (op.type == OperationType::THREADBLOCK_BARRIER) {
__syncthreads();
} else if (op.type == OperationType::BARRIER) {
int nThreadBlocks = op.nThreadBlocks;
int syncStateIndex = op.deviceSyncerIndex;
deviceSyncers[syncStateIndex].sync(nThreadBlocks);
Expand Down
1 change: 1 addition & 0 deletions tools/npkit/npkit_trace_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
def parse_npkit_event_header(npkit_event_header_path):
npkit_event_def = {"id_to_type": {}, "type_to_id": {}}
executor_ops = [
"THREADBLOCK_BARRIER",
"BARRIER",
"PUT",
"PUT_PACKET",
Expand Down

0 comments on commit 2fe679e

Please sign in to comment.