Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .agents/skills/code-review/references/custom-code-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,28 @@ ModelOutput forward(torch::Tensor tokens, ...) override;
virtual ModelOutput forward(torch::Tensor tokens, ...);
```

- **Declare functions `noexcept` if they won't emit exceptions.** This is part of the function's interface contract, like `const`. Pay special attention to move constructors, move assignment operators, and `swap`: `std::vector` reallocation moves elements only when move is `noexcept`. Do not use C++98 exception specifications (`throw()`). Do not mark `noexcept` on functions that may throw or call APIs that can throw.

```cpp
// Good – move is noexcept; vector reallocation can move instead of copy
MyResource(MyResource&& other) noexcept;
MyResource& operator=(MyResource&& other) noexcept;

void swap(MyResource& lhs, MyResource& rhs) noexcept;
```

```cpp
// Bad – move not noexcept; std::vector may fall back to copy
MyResource(MyResource&& other);
MyResource& operator=(MyResource&& other);

// Bad – deprecated C++98 exception specification
void reset() throw();

// Bad – noexcept on a function that may throw
void parse_file(const std::string& path) noexcept;
```

- **Structs must not have member functions**. If you need methods, use a `class`. Structs are for plain data aggregation only.

---
Expand Down
4 changes: 2 additions & 2 deletions xllm/core/framework/model/model_input_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ struct BlockTransferInfo {
memcpy(hash_key, other.hash_key, XXH3_128BITS_HASH_VALUE_LEN);
}

BlockTransferInfo(BlockTransferInfo&& other)
BlockTransferInfo(BlockTransferInfo&& other) noexcept
: src_block_id(other.src_block_id),
dst_block_id(other.dst_block_id),
transfer_type(other.transfer_type) {
Expand All @@ -679,7 +679,7 @@ struct BlockTransferInfo {
return *this;
}

BlockTransferInfo& operator=(BlockTransferInfo&& other) {
BlockTransferInfo& operator=(BlockTransferInfo&& other) noexcept {
src_block_id = other.src_block_id;
dst_block_id = other.dst_block_id;
transfer_type = other.transfer_type;
Expand Down
4 changes: 2 additions & 2 deletions xllm/core/layers/npu/buffer/atb_workspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class AtbWorkspace {

AtbWorkspace& operator=(const AtbWorkspace&) = delete;

AtbWorkspace(AtbWorkspace&&) = default;
AtbWorkspace(AtbWorkspace&&) noexcept = default;

AtbWorkspace& operator=(AtbWorkspace&&) = default;
AtbWorkspace& operator=(AtbWorkspace&&) noexcept = default;

void* get_workspace_buffer(uint64_t bufferSize);

Expand Down
2 changes: 1 addition & 1 deletion xllm/core/platform/stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Stream {

Stream(const Stream&) = delete;
Stream& operator=(const Stream&) = delete;
Stream(Stream&&) = default;
Stream(Stream&&) noexcept = default;
Stream& operator=(Stream&&) = default;

explicit Stream(PlatformStream stream, const int32_t timeout = -1);
Expand Down
Loading