Files
mscclpp/src/include/execution_common.hpp
Binyang Li 26a87535f9 Fix bug for construct sempaphore (#341)
Current semaphore construction requires two-way communication, e.g., to
construct a semaphore signaling from rank 0 to rank 1, both rank 0 and
rank 1 need to send a message to each other. This PR fixes an executor
bug that fails to conduct two-way communication for constructing such
one-way semaphores, and instead hangs during the semaphore construction.
In the future, we may need to change the implementation to construct
semaphore via one-way communication.

---------

Co-authored-by: Changho Hwang <changhohwang@microsoft.com>
2024-09-04 19:42:03 +08:00

88 lines
2.0 KiB
C++

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#ifndef MSCCLPP_EXECUTION_COMMON_HPP_
#define MSCCLPP_EXECUTION_COMMON_HPP_
#include <mscclpp/proxy_channel.hpp>
#include <mscclpp/sm_channel.hpp>
namespace mscclpp {
constexpr int MAX_CHANNEL = 16;
constexpr int MAX_CHANNEL_PER_OPERATION = 8;
constexpr int MAX_OPERATION = 64;
enum class BufferType : uint8_t {
NONE,
INPUT,
OUTPUT,
SCRATCH,
};
enum class ChannelType : uint8_t {
NONE,
SM,
PROXY,
};
// NOTE(chhwang): any modification here requires corresponding updates in `tools/npkit/npkit_trace_generator.py`.
enum class OperationType : uint8_t {
BARRIER,
PUT,
PUT_PACKET,
GET,
COPY,
COPY_PACKET,
TRANSFORM_TO_PACKET,
SIGNAL,
WAIT,
FLUSH,
REDUCE,
REDUCE_PACKET,
REDUCE_SEND,
REDUCE_SEND_PACKET,
READ_REDUCE_COPY,
READ_REDUCE_COPY_SEND,
};
struct Channels {
mscclpp::DeviceHandle<mscclpp::SmChannel> smChannels[MAX_CHANNEL];
mscclpp::DeviceHandle<mscclpp::SimpleProxyChannel> proxyChannels[MAX_CHANNEL];
};
struct Operation {
OperationType type;
ChannelType channelType;
BufferType srcBufferType;
BufferType dstBufferType;
uint8_t nInputs;
uint8_t nOutputs;
union {
uint8_t inputChannelIndexes[MAX_CHANNEL_PER_OPERATION];
BufferType inputBufferType;
};
union {
uint8_t outputChannelIndexes[MAX_CHANNEL_PER_OPERATION];
BufferType outputBufferType;
};
uint32_t inputOffsets[MAX_CHANNEL_PER_OPERATION];
uint32_t outputOffsets[MAX_CHANNEL_PER_OPERATION];
uint32_t srcOffset;
uint32_t dstOffset;
uint32_t size;
};
// total size = 1920 + 6400 + 4 + 4(padding) + 12(align) = 8336 bytes
struct __attribute__((aligned(16))) DeviceExecutionPlan {
uint8_t nSmChannels; // 1 bytes
uint8_t nProxyChannels; // 1 bytes
uint16_t nOperations; // 2 bytes
Channels channels; // 1920 bytes
Operation operations[MAX_OPERATION]; // 64 * 100 = 6400 bytes
};
} // namespace mscclpp
#endif // MSCCLPP_EXECUTION_COMMON_HPP_