Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #include "coll_scatter_single_rank_executor.h"
12 :
13 : namespace hccl {
14 0 : CollScatterSingleRankExecutor::CollScatterSingleRankExecutor(
15 0 : const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher)
16 0 : : CollScatterExecutor(dispatcher, topoMatcher)
17 0 : {}
18 :
19 0 : HcclResult CollScatterSingleRankExecutor::KernelRun(const OpParam& param, ExecMem& execMem)
20 : {
21 0 : HCCL_CONFIG_INFO(HCCL_ALG, "[CollScatterSingleRankExecutor][KernelRun] starts.");
22 0 : u64 totalSize = execMem.count * SIZE_TABLE[param.DataDes.dataType];
23 0 : bool hugeData = IsHugeData(totalSize); // override
24 0 : auto opMeta = HcclOpMetaInfo::GetOneForScatter(param.root, hugeData);
25 0 : CHK_RET(InitTask(dispatcher_, const_cast<Stream&>(param.stream), opMeta.isEnableCache, opMeta.GetCacheKey()));
26 0 : DeviceMem srcMem(execMem.inputPtr, totalSize);
27 0 : DeviceMem dstMem(execMem.outputPtr, totalSize);
28 0 : CHK_RET(HcclD2DMemcpyAsync(dispatcher_, dstMem, srcMem, const_cast<Stream&>(param.stream)));
29 0 : CHK_RET(LaunchTask(dispatcher_, const_cast<Stream&>(param.stream)));
30 0 : return HCCL_SUCCESS;
31 0 : }
32 :
33 : REGISTER_EXEC("ScatterSingleExecutor", ScatterSingleRank, CollScatterSingleRankExecutor);
34 :
35 : } // namespace hccl
|