Skip to content

Commit 86a80ad

Browse files
committed
add risks section
1 parent 8d7aae2 commit 86a80ad

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

proposals/022-C++20-migration.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# SP #022: Upgrading Slang Codebase to C++20
2+
3+
This proposal outlines a plan to upgrade the Slang codebase from C++17 to C++20, enabling the use of modern C++ features.
4+
5+
## Status
6+
7+
Status: Design Review
8+
9+
Implementation: Not yet implemented
10+
11+
Author: Ellie Hermaszewska
12+
13+
Reviewer: TBD
14+
15+
## Background
16+
17+
The Slang codebase currently uses C++17. C++20 introduces several valuable features that could improve code quality, and developer quality of life. There have been requests from people contributing to the Slang codebase to make this upgrade.
18+
19+
## Related Work
20+
21+
Some large, related C++ codebases have or are migrating to C++20:
22+
23+
- The current Unreal Engine coding standards specify C++20
24+
- Godot is making such a transition (some useful discussion and motivation here: https://github.com/godotengine/godot/pull/100749)
25+
26+
However other similar projects such as LLVM and DXC are still on C++17.
27+
28+
## Proposed Approach
29+
30+
The implementation will merely bump the language standard the slang targets are built with, and fix any breakages in a backwards compatible way. This proposal does not aim to introduce any usage of specific C++20 features, the intention is that these will organically be used as time progresses.
31+
32+
Documentation will need to be updated also.
33+
34+
## Risks
35+
36+
# Risks
37+
38+
## Technical Risks
39+
40+
- **Compiler compatibility gaps** across platforms and environments, this hasn't proven to be an issue with any other language versions or features, c++20 support should be standardized and mature by now
41+
- **Build system failures** on specific platforms, this will be picked up by CI before any merge
42+
- **Third-party dependency incompatibilities** all third party dependencies are compatible with C++20
43+
- Unordered Dense
44+
- Spirv headers
45+
- Spirv tools
46+
- Vulkan headers
47+
48+
## Customer Impact
49+
50+
Only those compiling from source will be affected, additionally only those who are both compiling from source, and are on a very old compiler. Binary distributions will not be affected.
51+
52+
For the unlikely possibility that there is a consumer with an unupgradeable old compiler who doesn't use the binary distribution, they can make their use case known with very little friction and we can roll back the change until they sort themselves out.
53+
54+
The COM interfaces in the slang headers will not immediately change to use any C++20 features.
55+
56+
## Compiler Support Matrix
57+
58+
These are the minimum compiler versions we will support.
59+
60+
| Compiler | Minimum Version | Release Date |
61+
| -------- | --------------------- | ------------ |
62+
| MSVC | 19.29 (VS 2019 16.10) | May 2021 |
63+
| GCC | 10.0 | May 2020 |
64+
| Clang | 13.0 | Oct 2021 |
65+
66+
## Detailed Explanation
67+
68+
### Compiler Requirements
69+
70+
Our CI already tests with C++20-compatible compilers:
71+
72+
- GCC 13.0
73+
- Clang 15
74+
- MSVC 19.26
75+
76+
This means we already don't test with older C++17-only compilers.
77+
78+
### Implementation
79+
80+
The implementation will focus on updating build configurations to specify C++20, with minimal code changes initially. We'll gradually adopt C++20 features where they provide clear benefits.
81+
82+
### Documentation Updates
83+
84+
We'll update documentation to reflect new compiler requirements and provide guidance for downstream users.
85+
86+
## Alternatives Considered
87+
88+
1. **Stay on C++17**:
89+
90+
- Pros: No disruption to users with older compilers
91+
- Cons: Miss out on language improvements and modern features
92+
93+
2. **Skip to C++23**:
94+
95+
- Pros: More features, longer before next upgrade needed
96+
- Cons: Limited compiler support, higher migration risk
97+
98+
3. **Partial adoption via feature test macros**:
99+
- Pros: Gradual transition, backward compatibility
100+
- Cons: Complex code with conditional compilation, harder maintenance

0 commit comments

Comments
 (0)