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 : #ifndef HCCLV2_RMT_RMA_BUFFER_LITE_H
12 : #define HCCLV2_RMT_RMA_BUFFER_LITE_H
13 : #include <string>
14 :
15 : #include "hccl/base.h"
16 : #include "rmt_rma_buf_slice_lite.h"
17 : #include "rma_type.h"
18 : namespace Hccl {
19 :
20 : class RmtRmaBufferLite {
21 : public:
22 : RmtRmaBufferLite() = default;
23 : RmtRmaBufferLite(u64 addr, u64 size);
24 : RmtRmaBufferLite(u64 addr, u64 size, u32 rkey);
25 : RmtRmaBufferLite(u64 addr, u64 size, u32 tokenId, u32 tokenValue);
26 :
27 : RmtRmaBufSliceLite GetRmtRmaBufSliceLite(u64 offset, u64 sliceSize) const;
28 :
29 14 : inline u64 GetAddr() const { return addr_; }
30 14 : inline u64 GetSize() const { return size_; }
31 1 : inline u32 GetTokenId() const { return tokenId_; }
32 1 : inline u32 GetTokenValue() const { return tokenValue_; }
33 12 : inline u32 GetRkey() const { return rkey_; }
34 :
35 : std::string Describe() const;
36 :
37 : private:
38 : RmaType type_;
39 : u64 addr_{0};
40 : u64 size_{0};
41 : u32 rkey_{0};
42 : u32 tokenId_{0};
43 : u32 tokenValue_{0};
44 : };
45 :
46 : } // namespace Hccl
47 : #endif // HCCL_BUFFER_H
|