Skip to content

Commit 65a09ec

Browse files
authored
Move to C++20 - Improve compile times
Down to 0.29ms from 0.45ms for solo include
1 parent c9e7684 commit 65a09ec

File tree

21 files changed

+853
-570
lines changed

21 files changed

+853
-570
lines changed

.github/workflows/unit.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -144,33 +144,33 @@ jobs:
144144
- name: Running Unit Tests
145145
run: cd build && ctest --verbose --output-on-failure -j 2
146146

147-
##################################################################################################
148-
## NVCC targets
149-
##################################################################################################
150-
nvcc:
151-
runs-on: ubuntu-latest
152-
container:
153-
image: nvidia/cuda:12.3.2-devel-ubi8
154-
steps:
155-
- name: Fetch current branch
156-
uses: actions/[email protected]
157-
- name: Compiling Unit Tests
158-
run: |
159-
mkdir build && cd build
160-
nvcc ../test/unit/accelerator.cu -std=c++17 -I../include -o accelerator.device.exe
161-
nvcc ../test/unit/accelerator.cpp -std=c++17 -I../include -o accelerator.host.exe
162-
nvcc ../test/unit/arch.cpp -std=c++17 -I../include -o arch.exe
163-
nvcc ../test/unit/compiler.cpp -std=c++17 -I../include -o compiler.exe
164-
nvcc ../test/unit/data_model.cpp -std=c++17 -I../include -o data_model.exe
165-
nvcc ../test/unit/libc.cpp -std=c++17 -I../include -o libc.exe
166-
nvcc ../test/unit/os.cpp -std=c++17 -I../include -o os.exe
167-
nvcc ../test/unit/simd.cpp -std=c++17 -I../include -o simd.exe
168-
nvcc ../test/unit/stdlib.cpp -std=c++17 -I../include -o stdlib.exe
169-
- name: Running Unit Tests
170-
run: |
171-
cd build
172-
./accelerator.device.exe && ./accelerator.host.exe && ./arch.exe && ./compiler.exe && ./data_model.exe && \
173-
./libc.exe && ./os.exe && ./simd.exe && ./stdlib.exe
147+
# ##################################################################################################
148+
# ## NVCC targets
149+
# ##################################################################################################
150+
# nvcc:
151+
# runs-on: ubuntu-latest
152+
# container:
153+
# image: nvcr.io/nvidia/nvhpc:24.11-devel-cuda_multi-ubuntu22.04
154+
# steps:
155+
# - name: Fetch current branch
156+
# uses: actions/[email protected]
157+
# - name: Compiling Unit Tests
158+
# run: |
159+
# mkdir build && cd build
160+
# nvc++ ../test/unit/accelerator.cu -std=c++20 -I../include -o accelerator.device.exe
161+
# nvc++ ../test/unit/accelerator.cpp -std=c++20 -I../include -o accelerator.host.exe
162+
# nvc++ ../test/unit/arch.cpp -std=c++20 -I../include -o arch.exe
163+
# nvc++ ../test/unit/compiler.cpp -std=c++20 -I../include -o compiler.exe
164+
# nvc++ ../test/unit/data_model.cpp -std=c++20 -I../include -o data_model.exe
165+
# nvc++ ../test/unit/libc.cpp -std=c++20 -I../include -o libc.exe
166+
# nvc++ ../test/unit/os.cpp -std=c++20 -I../include -o os.exe
167+
# nvc++ ../test/unit/simd.cpp -std=c++20 -I../include -o simd.exe
168+
# nvc++ ../test/unit/stdlib.cpp -std=c++20 -I../include -o stdlib.exe
169+
# - name: Running Unit Tests
170+
# run: |
171+
# cd build
172+
# ./accelerator.device.exe && ./accelerator.host.exe && ./arch.exe && ./compiler.exe && ./data_model.exe && \
173+
# ./libc.exe && ./os.exe && ./simd.exe && ./stdlib.exe
174174

175175
##################################################################################################
176176
## DPC++ Target

cmake/compiler.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
##======================================================================================================================
1010
add_library(spy_tests INTERFACE)
1111

12-
target_compile_features ( spy_tests INTERFACE cxx_std_17 )
12+
target_compile_features ( spy_tests INTERFACE cxx_std_20 )
1313

1414
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1515
if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")

doc/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<script type="text/javascript">
2323
DoxygenAwesomeParagraphLink.init()
2424
DoxygenAwesomeFragmentCopyButton.init()
25-
SendToGodbolt.init("spy","clang1600","-O3 -std=c++17 -DNEDBUG")
25+
SendToGodbolt.init("spy","clang1600","-O3 -std=c++20 -DNEDBUG")
2626
</script>
2727
$treeview
2828
$search

doc/index.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//! [Boost.Predef](https://www.boost.org/doc/libs/release/doc/html/predef.html) provides a sanitized
99
//! interface on top of those but still live in a world where the preprocessor is king.
1010
//!
11-
//! SPY is a C++17 (and onward) library that gathers similar information and provides a `constexpr`
11+
//! SPY is a C++20 (and onward) library that gathers similar information and provides a `constexpr`
1212
//! compatible interface to access those information, thus making their exploitation within `constexpr`
1313
//! context possible.
1414
//!

doc/spy.tag

Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
2+
<tagfile doxygen_version="1.9.8" doxygen_gitid="c2fe5c3e4986974eb2a97608b24086683502f07f">
3+
<compound kind="namespace">
4+
<name>literal</name>
5+
<filename>namespaceliteral.html</filename>
6+
</compound>
7+
<compound kind="namespace">
8+
<name>spy</name>
9+
<filename>namespacespy.html</filename>
10+
<member kind="variable">
11+
<type>constexpr arch_type</type>
12+
<name>architecture</name>
13+
<anchorfile>group__api_gaad5f2aa34188a02b894a0d8c7e402d6e.html</anchorfile>
14+
<anchor>gaad5f2aa34188a02b894a0d8c7e402d6e</anchor>
15+
<arglist></arglist>
16+
</member>
17+
<member kind="variable">
18+
<type>constexpr compiler_type</type>
19+
<name>compiler</name>
20+
<anchorfile>group__api_ga2d96c18fea5b9a06ac37487ab570599d.html</anchorfile>
21+
<anchor>ga2d96c18fea5b9a06ac37487ab570599d</anchor>
22+
<arglist></arglist>
23+
</member>
24+
<member kind="variable">
25+
<type>constexpr auto</type>
26+
<name>data_model</name>
27+
<anchorfile>group__api_gaa091fe192a7f9d0d164cf7546083200d.html</anchorfile>
28+
<anchor>gaa091fe192a7f9d0d164cf7546083200d</anchor>
29+
<arglist></arglist>
30+
</member>
31+
<member kind="variable">
32+
<type>constexpr auto</type>
33+
<name>libc</name>
34+
<anchorfile>group__api_ga03dc3f2a9b02b025902f9df3b2db53ab.html</anchorfile>
35+
<anchor>ga03dc3f2a9b02b025902f9df3b2db53ab</anchor>
36+
<arglist></arglist>
37+
</member>
38+
<member kind="variable">
39+
<type>constexpr os_type</type>
40+
<name>operating_system</name>
41+
<anchorfile>group__api_gadb7c5be967e00cff21ae5b98cc12a7dc.html</anchorfile>
42+
<anchor>gadb7c5be967e00cff21ae5b98cc12a7dc</anchor>
43+
<arglist></arglist>
44+
</member>
45+
<member kind="variable">
46+
<type>constexpr auto</type>
47+
<name>simd_instruction_set</name>
48+
<anchorfile>group__api_ga45f64b82d4939d55865b0e6a311b2dde.html</anchorfile>
49+
<anchor>ga45f64b82d4939d55865b0e6a311b2dde</anchor>
50+
<arglist></arglist>
51+
</member>
52+
<member kind="variable">
53+
<type>constexpr auto</type>
54+
<name>stdlib</name>
55+
<anchorfile>group__api_gafe99b815db524eacf659ba8348ca2e0d.html</anchorfile>
56+
<anchor>gafe99b815db524eacf659ba8348ca2e0d</anchor>
57+
<arglist></arglist>
58+
</member>
59+
</compound>
60+
<compound kind="namespace">
61+
<name>supports</name>
62+
<filename>namespacesupports.html</filename>
63+
</compound>
64+
<compound kind="group">
65+
<name>api</name>
66+
<title>Main API</title>
67+
<filename>group__api.html</filename>
68+
<member kind="variable">
69+
<type>constexpr bool</type>
70+
<name>spy::supports::address_sanitizers_status</name>
71+
<anchorfile>group__api_ga37e2c07363dadf1eb40e89a9a91f8121.html</anchorfile>
72+
<anchor>ga37e2c07363dadf1eb40e89a9a91f8121</anchor>
73+
<arglist></arglist>
74+
</member>
75+
<member kind="variable">
76+
<type>constexpr arch_type</type>
77+
<name>spy::architecture</name>
78+
<anchorfile>group__api_gaad5f2aa34188a02b894a0d8c7e402d6e.html</anchorfile>
79+
<anchor>gaad5f2aa34188a02b894a0d8c7e402d6e</anchor>
80+
<arglist></arglist>
81+
</member>
82+
<member kind="variable">
83+
<type>constexpr compiler_type</type>
84+
<name>spy::compiler</name>
85+
<anchorfile>group__api_ga2d96c18fea5b9a06ac37487ab570599d.html</anchorfile>
86+
<anchor>ga2d96c18fea5b9a06ac37487ab570599d</anchor>
87+
<arglist></arglist>
88+
</member>
89+
<member kind="variable">
90+
<type>constexpr auto</type>
91+
<name>spy::supports::cuda</name>
92+
<anchorfile>group__api_gaad706954aedb6aaf6ff1a9858a971e00.html</anchorfile>
93+
<anchor>gaad706954aedb6aaf6ff1a9858a971e00</anchor>
94+
<arglist></arglist>
95+
</member>
96+
<member kind="variable">
97+
<type>constexpr auto</type>
98+
<name>spy::data_model</name>
99+
<anchorfile>group__api_gaa091fe192a7f9d0d164cf7546083200d.html</anchorfile>
100+
<anchor>gaa091fe192a7f9d0d164cf7546083200d</anchor>
101+
<arglist></arglist>
102+
</member>
103+
<member kind="variable">
104+
<type>constexpr auto</type>
105+
<name>spy::libc</name>
106+
<anchorfile>group__api_ga03dc3f2a9b02b025902f9df3b2db53ab.html</anchorfile>
107+
<anchor>ga03dc3f2a9b02b025902f9df3b2db53ab</anchor>
108+
<arglist></arglist>
109+
</member>
110+
<member kind="variable">
111+
<type>constexpr os_type</type>
112+
<name>spy::operating_system</name>
113+
<anchorfile>group__api_gadb7c5be967e00cff21ae5b98cc12a7dc.html</anchorfile>
114+
<anchor>gadb7c5be967e00cff21ae5b98cc12a7dc</anchor>
115+
<arglist></arglist>
116+
</member>
117+
<member kind="variable">
118+
<type>constexpr auto</type>
119+
<name>spy::supports::posix_</name>
120+
<anchorfile>group__api_ga63eef44bc05ea6f77f278ba5b394ada8.html</anchorfile>
121+
<anchor>ga63eef44bc05ea6f77f278ba5b394ada8</anchor>
122+
<arglist></arglist>
123+
</member>
124+
<member kind="variable">
125+
<type>constexpr bool</type>
126+
<name>spy::supports::sanitizers_status</name>
127+
<anchorfile>group__api_ga28313e4f9673ea0f5d0ca44ffd1a967a.html</anchorfile>
128+
<anchor>ga28313e4f9673ea0f5d0ca44ffd1a967a</anchor>
129+
<arglist></arglist>
130+
</member>
131+
<member kind="variable">
132+
<type>constexpr auto</type>
133+
<name>spy::simd_instruction_set</name>
134+
<anchorfile>group__api_ga45f64b82d4939d55865b0e6a311b2dde.html</anchorfile>
135+
<anchor>ga45f64b82d4939d55865b0e6a311b2dde</anchor>
136+
<arglist></arglist>
137+
</member>
138+
<member kind="variable">
139+
<type>constexpr auto</type>
140+
<name>spy::stdlib</name>
141+
<anchorfile>group__api_gafe99b815db524eacf659ba8348ca2e0d.html</anchorfile>
142+
<anchor>gafe99b815db524eacf659ba8348ca2e0d</anchor>
143+
<arglist></arglist>
144+
</member>
145+
<member kind="variable">
146+
<type>constexpr auto</type>
147+
<name>spy::supports::sycl</name>
148+
<anchorfile>group__api_ga03e4a3ae6533a43cdf9bcbf1317707cd.html</anchorfile>
149+
<anchor>ga03e4a3ae6533a43cdf9bcbf1317707cd</anchor>
150+
<arglist></arglist>
151+
</member>
152+
<member kind="variable">
153+
<type>constexpr bool</type>
154+
<name>spy::supports::thread_sanitizers_status</name>
155+
<anchorfile>group__api_ga16591d3ea9aaa049682bfbedd519dc43.html</anchorfile>
156+
<anchor>ga16591d3ea9aaa049682bfbedd519dc43</anchor>
157+
<arglist></arglist>
158+
</member>
159+
<member kind="function">
160+
<type>constexpr auto</type>
161+
<name>spy::literal::operator&quot;&quot;_clang</name>
162+
<anchorfile>group__api.html</anchorfile>
163+
<anchor>gab3e0f11a5ec1b2963564755b84630970</anchor>
164+
<arglist>()</arglist>
165+
</member>
166+
<member kind="function">
167+
<type>constexpr auto</type>
168+
<name>spy::literal::operator&quot;&quot;_cloud</name>
169+
<anchorfile>group__api.html</anchorfile>
170+
<anchor>ga1dc236e3cae2ef3c7ec23d45659b7b30</anchor>
171+
<arglist>()</arglist>
172+
</member>
173+
<member kind="function">
174+
<type>constexpr auto</type>
175+
<name>spy::literal::operator&quot;&quot;_dpcpp</name>
176+
<anchorfile>group__api.html</anchorfile>
177+
<anchor>gab38166c11c2a99b2257e00630db206ec</anchor>
178+
<arglist>()</arglist>
179+
</member>
180+
<member kind="function">
181+
<type>constexpr auto</type>
182+
<name>spy::literal::operator&quot;&quot;_em</name>
183+
<anchorfile>group__api.html</anchorfile>
184+
<anchor>ga8b0155c33f6f54c0d1d2dd498417c536</anchor>
185+
<arglist>()</arglist>
186+
</member>
187+
<member kind="function">
188+
<type>constexpr auto</type>
189+
<name>spy::literal::operator&quot;&quot;_gcc</name>
190+
<anchorfile>group__api.html</anchorfile>
191+
<anchor>ga542b6a98ac5e95f906da14325a2064be</anchor>
192+
<arglist>()</arglist>
193+
</member>
194+
<member kind="function">
195+
<type>constexpr auto</type>
196+
<name>spy::literal::operator&quot;&quot;_gnu</name>
197+
<anchorfile>group__api.html</anchorfile>
198+
<anchor>ga01fac6d9d1025344d16c3ab4fee137c8</anchor>
199+
<arglist>()</arglist>
200+
</member>
201+
<member kind="function">
202+
<type>constexpr auto</type>
203+
<name>spy::literal::operator&quot;&quot;_intel</name>
204+
<anchorfile>group__api.html</anchorfile>
205+
<anchor>ga17b7828b022e763e749aebf056d24195</anchor>
206+
<arglist>()</arglist>
207+
</member>
208+
<member kind="function">
209+
<type>constexpr auto</type>
210+
<name>spy::literal::operator&quot;&quot;_msvc</name>
211+
<anchorfile>group__api.html</anchorfile>
212+
<anchor>gaafdbca6599d9792e579da8041b5addcd</anchor>
213+
<arglist>()</arglist>
214+
</member>
215+
<member kind="function">
216+
<type>constexpr auto</type>
217+
<name>spy::literal::operator&quot;&quot;_nvcc</name>
218+
<anchorfile>group__api.html</anchorfile>
219+
<anchor>ga39f9d138ef1adb4b5c12f4279878f1fc</anchor>
220+
<arglist>()</arglist>
221+
</member>
222+
<member kind="function">
223+
<type>constexpr auto</type>
224+
<name>spy::literal::operator&quot;&quot;_uc</name>
225+
<anchorfile>group__api.html</anchorfile>
226+
<anchor>ga0c3666ca0bb5f551cc0103e355a28569</anchor>
227+
<arglist>()</arglist>
228+
</member>
229+
<member kind="function">
230+
<type>constexpr auto</type>
231+
<name>spy::literal::operator&quot;&quot;_vms</name>
232+
<anchorfile>group__api.html</anchorfile>
233+
<anchor>ga772746f665f6dd13b9a6c8bd19564dab</anchor>
234+
<arglist>()</arglist>
235+
</member>
236+
<member kind="function">
237+
<type>constexpr auto</type>
238+
<name>spy::literal::operator&quot;&quot;_zos</name>
239+
<anchorfile>group__api.html</anchorfile>
240+
<anchor>ga3c0e24636d16a543f4bf2ed64875eaeb</anchor>
241+
<arglist>()</arglist>
242+
</member>
243+
</compound>
244+
<compound kind="page">
245+
<name>changelog</name>
246+
<title>Change Log</title>
247+
<filename>changelog.html</filename>
248+
</compound>
249+
<compound kind="page">
250+
<name>licence</name>
251+
<title>Licence</title>
252+
<filename>licence.html</filename>
253+
</compound>
254+
<compound kind="page">
255+
<name>setup</name>
256+
<title>Setup</title>
257+
<filename>setup.html</filename>
258+
<docanchor file="setup.html" title="Install from the source">setup-source</docanchor>
259+
<docanchor file="setup.html" title="Standalone setup">setup-standalone</docanchor>
260+
<docanchor file="setup.html" title="CMake FetchContent">setup-fetchcontent</docanchor>
261+
<docanchor file="setup.html" title="Setup with CPM">setup-cpm</docanchor>
262+
</compound>
263+
<compound kind="page">
264+
<name>index</name>
265+
<title>The C++ Information Broker</title>
266+
<filename>index.html</filename>
267+
</compound>
268+
</tagfile>

include/spy/accelerator.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
*/
77
//==================================================================================================
88
#pragma once
9-
#include <ostream>
109

1110
namespace spy::supports
1211
{
1312
template<int M, int N, int P> struct sycl_t
1413
{
1514
explicit constexpr operator bool() const noexcept { return M>0 && N>0; }
1615

17-
friend std::ostream& operator<<(std::ostream& os, sycl_t)
16+
template<_::stream OS>
17+
friend OS& operator<<(OS& os, sycl_t)
1818
{
1919
os << "SYCL v" << M << '.' << N;
2020
if(P>0) os << '.' << P;
@@ -38,7 +38,8 @@ namespace spy::supports
3838
{
3939
explicit constexpr operator bool() const noexcept { return M>0 && N>0; }
4040

41-
friend std::ostream& operator<<(std::ostream& os, cuda_t)
41+
template<_::stream OS>
42+
friend OS& operator<<(OS& os, cuda_t)
4243
{
4344
os << "NVCC CUDA v" << M << '.' << N;
4445
if(P>0) os << '.' << P;

0 commit comments

Comments
 (0)