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