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