Skip to content

Commit 936bcde

Browse files
author
Carsten Griwodz
committed
some initial thoughts on the AI guide
1 parent e38c5af commit 936bcde

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

AI_DEVELOPMENT_GUIDE.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@ It ensures that contributions (from GitHub Copilot, ChatGPT, Claude, etc.) follo
99

1010
- Always prioritize **readability** and **clarity** over micro-optimizations.
1111
- Follow **modern C++17 best practices**.
12-
- Keep host-side C++ and CUDA device code **cleanly separated**.
12+
- Keep device-side __global__ functions in the same source file as the host-side C++ code that starts this kernel.
13+
- Always compile __device__ functions with the functions that call them. Preferably declare them static inline.
1314
- Prefer **modularity**: each class or major component should live in its own file.
1415
- Code should be **self-documenting** whenever possible, with clear naming and structure.
1516

1617
---
1718

1819
## C++ Guidelines
1920

20-
- **Standard**: Use **C++17**. Prefer `constexpr`, `auto`, `enum class`, range-based for loops, and smart pointers (`std::unique_ptr`, `std::shared_ptr`).
21+
- **Standard**:
22+
- Use **C++17**. Prefer `constexpr`, `auto` and `enum class`.
23+
- Use range-based for loops on the host side.
24+
- Use smart pointers (`std::unique_ptr`, `std::shared_ptr`) on the host side.
25+
- Never pass smart pointers as parameters to __global__ functions.
26+
- Avoid dynamic memory allocation on the device side.
2127
- **Memory Management**: Use RAII. Avoid raw `new`/`delete` except in CUDA contexts where unavoidable.
2228
- **Error Handling**:
2329
- Use exceptions in host C++ code.

0 commit comments

Comments
 (0)