Skip to content

Commit 6f9aa3f

Browse files
committed
Fix clang-formatting issues from header changes
Changing from CL/sycl to sycl/sycl started forcing some header file reordering, which caused pre-commit failures in the CI. So I have changed the clang-format rules to better express what we want, which has then cause other formatting changes for files that were not already compliant to my dread will. * all "headers.hpp" * <third_party/includes.h> * <sycl/sycl.hpp> * <cppstdlibheaders> Other than that, changing the matmul header caused the `cl::` namespace to disappear, so was removed. Other formatting in the tuple_utils header started becoming a bit nasty so knowing that SYCL requires C++ 17, I changed to `decltype(auto)` for some of the function return types.
1 parent 0b60164 commit 6f9aa3f

File tree

12 files changed

+45
-52
lines changed

12 files changed

+45
-52
lines changed

.clang-format

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
BasedOnStyle: Google
2+
IncludeBlocks: Regroup
23
IncludeCategories:
3-
- Regex: '^<sycl/.*>$'
4-
Priority: 3
5-
SortPriority: 0
6-
CaseSensitive: false
7-
- Regex: '^<.*\.h>'
4+
- Regex: '^".*"'
85
Priority: 1
9-
SortPriority: 0
10-
CaseSensitive: false
11-
- Regex: '^<.*'
6+
- Regex: '^<sycl/'
127
Priority: 2
13-
SortPriority: 0
14-
CaseSensitive: false
15-
- Regex: '.*'
8+
SortPriority: 3
9+
- Regex: '<[[:alnum:]_/]+\.(h|hpp)>'
10+
Priority: 3
11+
SortPriority: 2
12+
- Regex: '<^[.]+>'
1613
Priority: 4
17-
SortPriority: 0
18-
CaseSensitive: false

src/fluid/fluid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020

2121
#pragma once
2222

23+
#include <sycl/sycl.hpp>
24+
2325
#include <algorithm> // std::fill
2426
#include <cmath> // std::round
2527
#include <cstdlib> // std::size_t
2628
#include <exception> // std::exception_ptr
2729
#include <iostream> // std::cout, std::endl
2830
#include <vector> // std::vector
2931

30-
#include <sycl/sycl.hpp>
31-
3232
// Kernel declarations.
3333
class fluid_boundary;
3434
class fluid_linear_solve;

src/fluid/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*
1919
**************************************************************************/
2020

21+
#include "fluid.h"
22+
2123
#include <Corrade/Containers/StringStlView.h>
2224
#include <Magnum/GL/DefaultFramebuffer.h>
2325
#include <Magnum/GL/Mesh.h>
@@ -33,8 +35,6 @@
3335

3436
#include <sycl/sycl.hpp>
3537

36-
#include "fluid.h"
37-
3838
constexpr Magnum::PixelFormat PIXELFORMAT{Magnum::PixelFormat::RGBA8Unorm};
3939

4040
// Title bar text

src/game_of_life/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*
1919
**************************************************************************/
2020

21+
#include "sim.hpp"
22+
2123
#include <Magnum/GL/DefaultFramebuffer.h>
2224
#include <Magnum/GL/Mesh.h>
2325
#include <Magnum/GL/Texture.h>
@@ -30,12 +32,10 @@
3032
#include <Magnum/Shaders/FlatGL.h>
3133
#include <Magnum/Trade/MeshData.h>
3234

33-
#include <chrono>
34-
#include <thread>
35-
3635
#include <sycl/sycl.hpp>
3736

38-
#include "sim.hpp"
37+
#include <chrono>
38+
#include <thread>
3939

4040
constexpr Magnum::PixelFormat PIXELFORMAT{Magnum::PixelFormat::RGBA8Unorm};
4141

src/game_of_life/sim.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020

2121
#pragma once
2222

23-
#include <random>
23+
#include "../include/double_buf.hpp"
2424

2525
#include <sycl/sycl.hpp>
2626

27-
#include "../include/double_buf.hpp"
27+
#include <random>
2828

2929
enum class CellState : unsigned int {
3030
LIVE = 1,

src/mandelbrot/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*
1919
**************************************************************************/
2020

21+
#include "mandel.hpp"
22+
2123
#include <Magnum/GL/DefaultFramebuffer.h>
2224
#include <Magnum/GL/Mesh.h>
2325
#include <Magnum/GL/Texture.h>
@@ -32,8 +34,6 @@
3234

3335
#include <sycl/sycl.hpp>
3436

35-
#include "mandel.hpp"
36-
3737
constexpr size_t WIDTH = 800;
3838
constexpr size_t HEIGHT = 600;
3939
constexpr Magnum::PixelFormat PIXELFORMAT{Magnum::PixelFormat::RGBA8Unorm};

src/matrix_multiply_omp_compare/matrix-multiply.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <ctime>
3232
#include <iostream>
3333

34-
using namespace cl::sycl;
34+
using namespace sycl;
3535

3636
class mxm_kernel;
3737

@@ -112,7 +112,7 @@ inline bool isPowerOfTwo(int x) { return (x & (x - 1)) == 0; }
112112
* Note that this example only works for powers of two.
113113
* */
114114
template <typename T>
115-
bool local_mxm(cl::sycl::queue& q, T* MA, T* MB, T* MC, int matSize) {
115+
bool local_mxm(sycl::queue& q, T* MA, T* MB, T* MC, int matSize) {
116116
// Make sure it is power of two before running
117117
if (!isPowerOfTwo(matSize)) {
118118
std::cout << " This example only works with power of two sizes "
@@ -122,7 +122,7 @@ bool local_mxm(cl::sycl::queue& q, T* MA, T* MB, T* MC, int matSize) {
122122

123123
auto device = q.get_device();
124124
auto maxBlockSize =
125-
device.get_info<cl::sycl::info::device::max_work_group_size>();
125+
device.get_info<sycl::info::device::max_work_group_size>();
126126
auto blockSize = prevPowerOfTwo(std::sqrt(maxBlockSize));
127127
std::cout << " The Device Max Work Group Size is : " << maxBlockSize
128128
<< std::endl;
@@ -325,14 +325,13 @@ int main(int argc, char* argv[]) {
325325
* to capture potential asynchronous errors. This function will be
326326
* called every time there is an asynchronous error on the queue (i.e.
327327
* some error occurs while the queue is executing kernels) and one of
328-
* cl::sycl::queue::throw() or cl::sycl::queue::wait_and_throw() is
329-
* called. */
328+
* sycl::queue::throw() or sycl::queue::wait_and_throw() is called. */
330329
queue q([&](exception_list eL) {
331330
try {
332331
for (auto& e : eL) {
333332
std::rethrow_exception(e);
334333
}
335-
} catch (cl::sycl::exception e) {
334+
} catch (sycl::exception e) {
336335
std::cout << " An exception has been thrown: " << e.what()
337336
<< std::endl;
338337
}

src/nbody/InteropGLBuffer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#define CUDA_GL_INTEROP_API_AVAILABLE 0
1111
#endif
1212

13+
#include <iostream>
14+
1315
/// @brief Magnum GL Buffer wrapper implementing backend-specific interop to
1416
/// work directly on OpenGL device buffers instead of using host memory.
1517
///

src/nbody/main.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
*
1919
**************************************************************************/
2020

21+
#include "InteropGLBuffer.hpp"
22+
#include "sim.hpp"
23+
2124
#include <Corrade/PluginManager/Manager.h>
2225
#include <Corrade/Utility/Resource.h>
2326
#include <Magnum/GL/AbstractShaderProgram.h>
@@ -28,6 +31,7 @@
2831
#include <Magnum/GL/Texture.h>
2932
#include <Magnum/GL/TextureFormat.h>
3033
#include <Magnum/GL/Version.h>
34+
#include <Magnum/ImGuiIntegration/Context.hpp>
3135
#include <Magnum/ImageView.h>
3236
#include <Magnum/Magnum.h>
3337
#include <Magnum/Math/Angle.h>
@@ -40,14 +44,10 @@
4044
#include <Magnum/Trade/ImageData.h>
4145
#include <Magnum/Trade/MeshData.h>
4246

43-
#include <Magnum/ImGuiIntegration/Context.hpp>
44-
#include <chrono>
45-
#include <fstream>
46-
4747
#include <sycl/sycl.hpp>
4848

49-
#include "InteropGLBuffer.hpp"
50-
#include "sim.hpp"
49+
#include <chrono>
50+
#include <fstream>
5151

5252
using num_t = float;
5353
constexpr num_t PI{3.141592653589793238462643383279502884197169399};

src/nbody/sim.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020

2121
#pragma once
2222

23-
#include <iostream>
24-
#include <memory>
25-
#include <random>
26-
27-
#include <sycl/sycl.hpp>
28-
2923
#include "../include/double_buf.hpp"
3024
#include "integrator.hpp"
3125
#include "sycl_bufs.hpp"
3226
#include "tuple_utils.hpp"
3327

28+
#include <sycl/sycl.hpp>
29+
30+
#include <iostream>
31+
#include <memory>
32+
#include <random>
33+
3434
// Convenience types
3535
template <typename num_t>
3636
using vec3 = sycl::vec<num_t, 3>;

0 commit comments

Comments
 (0)