Skip to content

Commit d754c35

Browse files
committed
lint and log
1 parent cd9d504 commit d754c35

3 files changed

Lines changed: 17 additions & 16 deletions

File tree

src/ext/collectives/allreduce/allreduce_nvls_zero_copy.cu

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "allreduce/allreduce_nvls_zero_copy.hpp"
77
#include "allreduce/common.hpp"
88
#include "collective_utils.hpp"
9-
#include "debug.h"
9+
#include "logger.hpp"
1010

1111
namespace mscclpp {
1212
namespace collective {
@@ -116,17 +116,17 @@ CommResult AllreduceNvls::allreduceKernelFunc(const std::shared_ptr<void> ctx_vo
116116
[[maybe_unused]] const std::unordered_map<std::string, uintptr_t>& extras,
117117
mscclpp::DataType accumDtype) {
118118
if (!symmetricMemory_) {
119-
WARN("AllreduceNvls requires symmetric memory for now.");
119+
WARN(ALGO, "AllreduceNvls requires symmetric memory.");
120120
return CommResult::CommInvalidArgument;
121121
}
122122
auto ctx = std::static_pointer_cast<AlgorithmCtx>(ctx_void);
123123
if (isNativeFp8DataType(dtype) && !fp8NvlsSupported_) {
124-
WARN("FP8 NVLS allreduce requires device support for FP8 multimem reduction.");
124+
WARN(ALGO, "FP8 NVLS allreduce requires device support for FP8 multimem reduction.");
125125
return CommResult::CommInvalidArgument;
126126
}
127127
AllreduceFunc allreduce = dispatch<NvlsAdapter>(op, dtype, accumDtype);
128128
if (!allreduce) {
129-
WARN("Unsupported operation or data type for allreduce, dtype=%d", static_cast<int>(dtype));
129+
WARN(ALGO, "Unsupported operation or data type for allreduce, dtype=", static_cast<int>(dtype));
130130
return CommResult::CommInvalidArgument;
131131
}
132132
size_t sendBytes, recvBytes;
@@ -151,7 +151,7 @@ CommResult AllreduceNvls::allreduceKernelFunc(const std::shared_ptr<void> ctx_vo
151151
}
152152
}
153153
if (numBlocksAndThreads.first > MAX_NBLOCKS) {
154-
WARN("Number of blocks exceeds maximum supported value of %d", MAX_NBLOCKS);
154+
WARN(ALGO, "Number of blocks exceeds maximum supported value of ", MAX_NBLOCKS);
155155
return CommResult::CommInvalidArgument;
156156
}
157157
cudaError_t error = allreduce(nullptr, nullptr, nullptr, this->memoryChannelsDeviceHandle_.get(), nullptr,
@@ -160,10 +160,10 @@ CommResult AllreduceNvls::allreduceKernelFunc(const std::shared_ptr<void> ctx_vo
160160
numBlocksAndThreads.first, numBlocksAndThreads.second);
161161
if (error != cudaSuccess) {
162162
if (error == cudaErrorNotSupported) {
163-
WARN("AllreduceNvls does not support the requested data type.");
163+
WARN(ALGO, "AllreduceNvls does not support the requested data type.");
164164
return CommResult::CommInvalidArgument;
165165
}
166-
WARN("AllreduceNvls failed with error: %s", cudaGetErrorString(error));
166+
WARN(ALGO, "AllreduceNvls failed with error: ", cudaGetErrorString(error));
167167
return CommResult::CommUnhandledCudaError;
168168
}
169169
return CommResult::CommSuccess;
@@ -176,6 +176,9 @@ mscclpp::AlgorithmCtxKey AllreduceNvls::generateAllreduceContextKey(const void*
176176
CUdeviceptr sendBasePtr, recvBasePtr;
177177
MSCCLPP_CUTHROW(cuMemGetAddressRange(&sendBasePtr, &sendBytes, (CUdeviceptr)input));
178178
MSCCLPP_CUTHROW(cuMemGetAddressRange(&recvBasePtr, &recvBytes, (CUdeviceptr)output));
179+
INFO(ALGO, "Generated context key with sendBasePtr=", (void*)sendBasePtr, ", recvBasePtr=", (void*)recvBasePtr,
180+
", sendBytes=", sendBytes, ", recvBytes=", recvBytes, ", input offset=", (char*)input - (char*)sendBasePtr,
181+
", output offset=", (char*)output - (char*)recvBasePtr);
179182
return mscclpp::AlgorithmCtxKey{(void*)sendBasePtr, (void*)recvBasePtr, sendBytes, recvBytes, 0};
180183
}
181184

src/ext/collectives/allreduce/allreduce_rsag.cu

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ __global__ void __launch_bounds__(1024, 1)
5353
int4* resultBuff4 = reinterpret_cast<int4*>((char*)resultBuff);
5454
int4* buff4 = reinterpret_cast<int4*>((char*)buff);
5555
DeviceHandle<BaseMemoryChannel>* memoryChannelsLocal = memoryChannels + blockId * nPeers;
56-
using AccumVec =
57-
std::conditional_t<std::is_same_v<T, AccumT>, int4, mscclpp::VectorType<AccumT, nelemsPerInt4>>;
56+
using AccumVec = std::conditional_t<std::is_same_v<T, AccumT>, int4, mscclpp::VectorType<AccumT, nelemsPerInt4>>;
5857

5958
uint32_t nInt4PerBlock = nInt4PerRank / gridDim.x;
6059
uint32_t remainderForBlock = nInt4PerRank % gridDim.x;

src/ext/collectives/collective_utils.cu

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
#include "collective_utils.hpp"
5-
64
#include <algorithm>
75
#include <mscclpp/algorithm.hpp>
86
#include <mscclpp/core.hpp>
97
#include <mscclpp/gpu_utils.hpp>
108
#include <mscclpp/memory_channel.hpp>
119
#include <mscclpp/switch_channel.hpp>
1210

11+
#include "collective_utils.hpp"
12+
1313
namespace mscclpp {
1414
namespace collective {
1515

@@ -37,8 +37,8 @@ bool detectFp8NvlsSupport() {
3737
return false;
3838
}
3939

40-
MSCCLPP_CUDATHROW(cudaMemcpyAsync(&supportedHost, supportedDevice.get(), sizeof(supportedHost),
41-
cudaMemcpyDeviceToHost, stream));
40+
MSCCLPP_CUDATHROW(
41+
cudaMemcpyAsync(&supportedHost, supportedDevice.get(), sizeof(supportedHost), cudaMemcpyDeviceToHost, stream));
4242
err = cudaStreamSynchronize(stream);
4343
if (err != cudaSuccess) {
4444
(void)cudaGetLastError();
@@ -51,9 +51,8 @@ bool detectFp8NvlsSupport() {
5151
} // namespace
5252

5353
bool isFp8DataType(DataType dtype) {
54-
return dtype == DataType::FLOAT8_E4M3FN || dtype == DataType::FLOAT8_E4M3FNUZ ||
55-
dtype == DataType::FLOAT8_E5M2 || dtype == DataType::FLOAT8_E5M2FNUZ ||
56-
dtype == DataType::FLOAT8_E4M3B15;
54+
return dtype == DataType::FLOAT8_E4M3FN || dtype == DataType::FLOAT8_E4M3FNUZ || dtype == DataType::FLOAT8_E5M2 ||
55+
dtype == DataType::FLOAT8_E5M2FNUZ || dtype == DataType::FLOAT8_E4M3B15;
5756
}
5857

5958
bool isNativeFp8DataType(DataType dtype) {

0 commit comments

Comments
 (0)