Skip to content

Commit 698de0a

Browse files
committed
fix code format
1 parent bb71a32 commit 698de0a

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

paddle/fluid/distributed/collective/process_group_flagcx.cc

+11-11
Original file line numberDiff line numberDiff line change
@@ -817,11 +817,11 @@ std::shared_ptr<ProcessGroup::Task> ProcessGroupFlagcx::Collective(
817817
if (use_calc_stream) {
818818
auto calc_stream = calc_ctx->stream();
819819
flagcx_comm_ctx->flagcx_handler_->devHandle->streamCopy(
820-
&flagcx_stream, (void*)&calc_stream);
820+
&flagcx_stream, reinterpret_cast<void*>(&calc_stream));
821821
} else {
822822
auto comm_stream = comm_ctx->stream();
823823
flagcx_comm_ctx->flagcx_handler_->devHandle->streamCopy(
824-
&flagcx_stream, (void*)&comm_stream);
824+
&flagcx_stream, reinterpret_cast<void*>(&comm_stream));
825825
}
826826

827827
if (!FLAGS_enable_async_trace) {
@@ -831,8 +831,8 @@ std::shared_ptr<ProcessGroup::Task> ProcessGroupFlagcx::Collective(
831831
if (!use_calc_stream) {
832832
if (!is_coalescing_) {
833833
task->UpdateWaitChain(*comm_ctx);
834-
allocation_stream_pairs_.emplace_back(tensor.Holder(),
835-
*(gpuStream_t*)flagcx_stream);
834+
allocation_stream_pairs_.emplace_back(
835+
tensor.Holder(), *reinterpret_cast<gpuStream_t*>(flagcx_stream));
836836
} else {
837837
coalescing_tensors_.emplace_back(
838838
std::make_shared<phi::DenseTensor>(tensor));
@@ -906,11 +906,11 @@ std::shared_ptr<ProcessGroup::Task> ProcessGroupFlagcx::Point2Point(
906906
if (use_calc_stream) {
907907
auto calc_stream = calc_ctx->stream();
908908
flagcx_comm_ctx->flagcx_handler_->devHandle->streamCopy(
909-
&flagcx_stream, (void*)&calc_stream);
909+
&flagcx_stream, reinterpret_cast<void*>(&calc_stream));
910910
} else {
911911
auto comm_stream = comm_ctx->stream();
912912
flagcx_comm_ctx->flagcx_handler_->devHandle->streamCopy(
913-
&flagcx_stream, (void*)&comm_stream);
913+
&flagcx_stream, reinterpret_cast<void*>(&comm_stream));
914914
}
915915

916916
if (!FLAGS_enable_async_trace) {
@@ -920,8 +920,8 @@ std::shared_ptr<ProcessGroup::Task> ProcessGroupFlagcx::Point2Point(
920920
if (!use_calc_stream) {
921921
if (!is_coalescing_) {
922922
task->UpdateWaitChain(*comm_ctx);
923-
allocation_stream_pairs_.emplace_back(tensor.Holder(),
924-
*(gpuStream_t*)flagcx_stream);
923+
allocation_stream_pairs_.emplace_back(
924+
tensor.Holder(), *reinterpret_cast<gpuStream_t*>(flagcx_stream));
925925
} else {
926926
coalescing_tensors_.emplace_back(
927927
std::make_shared<phi::DenseTensor>(tensor));
@@ -1008,11 +1008,11 @@ void ProcessGroupFlagcx::EndCoalescing(
10081008
auto comm_stream = comm_ctx->stream();
10091009
flagcxStream_t flagcx_stream;
10101010
flagcx_comm_ctx->flagcx_handler_->devHandle->streamCopy(
1011-
&flagcx_stream, (void*)&comm_stream);
1011+
&flagcx_stream, reinterpret_cast<void*>(&comm_stream));
10121012

10131013
flagcx_task->UpdateWaitChain(*comm_ctx);
1014-
allocation_stream_pairs_.emplace_back(tensor->Holder(),
1015-
*(gpuStream_t*)flagcx_stream);
1014+
allocation_stream_pairs_.emplace_back(
1015+
tensor->Holder(), *reinterpret_cast<gpuStream_t*>(flagcx_stream));
10161016
flagcx_comm_ctx->flagcx_handler_->devHandle->streamFree(flagcx_stream);
10171017
}
10181018

paddle/fluid/distributed/collective/process_group_flagcx.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class ProcessGroupFlagcx final : public ProcessGroupWithStream {
231231
for (const auto& allocation_stream : allocation_stream_pairs_) {
232232
auto holder_ptr = allocation_stream.first.lock();
233233
if (holder_ptr) {
234-
auto stream = (gpuStream_t*)allocation_stream.second;
234+
auto stream = reinterpret_cast<gpuStream_t*>(allocation_stream.second);
235235
memory::EraseStream(holder_ptr, *stream);
236236
}
237237
}

paddle/phi/core/distributed/flagcx_tools.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414

1515
#pragma once
1616

17+
#include <flagcx.h>
1718
#include <string>
18-
1919
#include "paddle/phi/core/distributed/types.h"
2020

21-
#include <flagcx.h>
22-
2321
namespace phi {
2422
namespace distributed {
2523

0 commit comments

Comments
 (0)