Skip to content

Commit 6a75234

Browse files
committed
clang-format fix
1 parent 9e30ff3 commit 6a75234

File tree

5 files changed

+72
-25
lines changed

5 files changed

+72
-25
lines changed

cpp/oneapi/dal/backend/primitives/frontier/advance.hpp

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ struct frontier_context_state {
4444
template <typename InFrontierDevT, typename OutFrontierDevT>
4545
class frontier_context {
4646
public:
47-
frontier_context(std::uint64_t limit, InFrontierDevT in_dev_frontier, OutFrontierDevT out_dev_frontier)
47+
frontier_context(std::uint64_t limit,
48+
InFrontierDevT in_dev_frontier,
49+
OutFrontierDevT out_dev_frontier)
4850
: limit(limit),
4951
in_dev_frontier(in_dev_frontier),
5052
out_dev_frontier(out_dev_frontier) {}
@@ -327,17 +329,50 @@ sycl::event advance(const GraphT& graph,
327329

328330
auto e = q.submit([&](sycl::handler& cgh) {
329331
cgh.depends_on(to_wait);
330-
sycl::local_accessor<uint32_t, 1> n_edges_wg{local_range, cgh}; // number of edges of vertices to process at work-group granularity
331-
sycl::local_accessor<uint32_t, 1> n_edges_sg{local_range, cgh}; // number of edges of vertices to process at sub-group granularity
332-
sycl::local_accessor<bool, 1> visited{local_range, cgh}; // tracks the vertices already visited at work-group and sub-group granularity
333-
sycl::local_accessor<element_t, 1> subgroup_reduce{local_range, cgh}; // stores the vertices to process at sub-group granularity
334-
sycl::local_accessor<uint32_t, 1> subgroup_reduce_tail{max_num_subgroups, cgh}; // stores the tail of the subgroup reduction
335-
sycl::local_accessor<uint32_t, 1> subgroup_ids{local_range, cgh}; // stores the thread id that found the vertex to process at sub-group level
336-
sycl::local_accessor<element_t, 1> workgroup_reduce{local_range, cgh}; // stores the vertices to process at work-group granularity
337-
sycl::local_accessor<uint32_t, 1> workgroup_reduce_tail{1, cgh}; // stores the tail of the work-group reduction
338-
sycl::local_accessor<uint32_t, 1> workgroup_ids{local_range, cgh}; // stores the thread id that found the vertex to process at work-group level
339-
sycl::local_accessor<element_t, 1> individual_reduce{local_range, cgh}; // stores the vertices to process at individual thread granularity
340-
sycl::local_accessor<uint32_t, 1> individual_reduce_tail{1, cgh}; // stores the tail of the individual thread reduction
332+
sycl::local_accessor<uint32_t, 1> n_edges_wg{
333+
local_range,
334+
cgh
335+
}; // number of edges of vertices to process at work-group granularity
336+
sycl::local_accessor<uint32_t, 1> n_edges_sg{
337+
local_range,
338+
cgh
339+
}; // number of edges of vertices to process at sub-group granularity
340+
sycl::local_accessor<bool, 1> visited{
341+
local_range,
342+
cgh
343+
}; // tracks the vertices already visited at work-group and sub-group granularity
344+
sycl::local_accessor<element_t, 1> subgroup_reduce{
345+
local_range,
346+
cgh
347+
}; // stores the vertices to process at sub-group granularity
348+
sycl::local_accessor<uint32_t, 1> subgroup_reduce_tail{
349+
max_num_subgroups,
350+
cgh
351+
}; // stores the tail of the subgroup reduction
352+
sycl::local_accessor<uint32_t, 1> subgroup_ids{
353+
local_range,
354+
cgh
355+
}; // stores the thread id that found the vertex to process at sub-group level
356+
sycl::local_accessor<element_t, 1> workgroup_reduce{
357+
local_range,
358+
cgh
359+
}; // stores the vertices to process at work-group granularity
360+
sycl::local_accessor<uint32_t, 1> workgroup_reduce_tail{
361+
1,
362+
cgh
363+
}; // stores the tail of the work-group reduction
364+
sycl::local_accessor<uint32_t, 1> workgroup_ids{
365+
local_range,
366+
cgh
367+
}; // stores the thread id that found the vertex to process at work-group level
368+
sycl::local_accessor<element_t, 1> individual_reduce{
369+
local_range,
370+
cgh
371+
}; // stores the vertices to process at individual thread granularity
372+
sycl::local_accessor<uint32_t, 1> individual_reduce_tail{
373+
1,
374+
cgh
375+
}; // stores the tail of the individual thread reduction
341376

342377
cgh.parallel_for(sycl::nd_range<1>{ global_range, local_range },
343378
bitmap_kernel_t{ context,

cpp/oneapi/dal/backend/primitives/frontier/bitset.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@ template <typename ElementType = std::uint32_t>
2727
class bitset {
2828
public:
2929
using element_t = ElementType;
30-
static constexpr std::uint64_t element_bitsize = sizeof(element_t) * 8; // Number of bits in an element
30+
static constexpr std::uint64_t element_bitsize =
31+
sizeof(element_t) * 8; // Number of bits in an element
3132

3233
/// Constructs a bitset with the given data pointer and number of items.
3334
/// \param data pointer to the underlying data.
3435
/// \param num_items number of items in the bitset.
35-
bitset(element_t* data, const size_t num_items) : _data(data), _num_items((num_items + element_bitsize - 1) / element_bitsize) {}
36+
bitset(element_t* data, const size_t num_items)
37+
: _data(data),
38+
_num_items((num_items + element_bitsize - 1) / element_bitsize) {}
3639

3740
/// Sets the bit at the specified index to 1.
3841
inline void set(std::uint32_t index) const {

cpp/oneapi/dal/backend/primitives/frontier/frontier.hpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,19 @@ class frontier_view {
3333
static constexpr std::uint64_t divide_factor = bitset<bitmap_t>::element_bitsize;
3434

3535
frontier_view() = default;
36-
frontier_view(bitmap_t* data_layer, // First layer (tracks vertices in the frontier)
37-
bitmap_t* mlb_layer, // Second layer (to track non-zero elements in the first layer)
38-
std::uint32_t* offsets, // Array to store the indices of the non-zero elements
39-
std::uint32_t* offsets_size, // Pointer to store the size of the offsets array
40-
std::uint64_t num_items) // Maximum number of items that can be stored in the frontier
36+
frontier_view(
37+
bitmap_t* data_layer, // First layer (tracks vertices in the frontier)
38+
bitmap_t* mlb_layer, // Second layer (to track non-zero elements in the first layer)
39+
std::uint32_t* offsets, // Array to store the indices of the non-zero elements
40+
std::uint32_t* offsets_size, // Pointer to store the size of the offsets array
41+
std::uint64_t num_items) // Maximum number of items that can be stored in the frontier
4142
: _num_items(num_items),
42-
_data_layer(bitset<bitmap_t>{ data_layer, num_items }), // first layer size is num_items
43-
_mlb_layer(bitset<bitmap_t>{ mlb_layer, (num_items + divide_factor - 1) / divide_factor }), // second layer size is ceil(num_items / divide_factor) because each bit in the second layer represents an element in the first layer
43+
_data_layer(
44+
bitset<bitmap_t>{ data_layer, num_items }), // first layer size is num_items
45+
_mlb_layer(bitset<bitmap_t>{
46+
mlb_layer,
47+
(num_items + divide_factor - 1) /
48+
divide_factor }), // second layer size is ceil(num_items / divide_factor) because each bit in the second layer represents an element in the first layer
4449
_offsets(offsets),
4550
_offsets_size(offsets_size) {}
4651

@@ -153,7 +158,8 @@ class frontier {
153158
ndarray<std::uint32_t, 1> _offsets;
154159
ndarray<buffer_t, 1> _buffer;
155160
const std::uint64_t _TMP_VAR = 0;
156-
const std::uint64_t _CAF_FLAG = 1; // Compute Active Frontier Flag (1 if already computed, 0 otherwise)
161+
const std::uint64_t _CAF_FLAG =
162+
1; // Compute Active Frontier Flag (1 if already computed, 0 otherwise)
157163
};
158164

159165
/// Swaps the contents of two frontiers.

cpp/oneapi/dal/backend/primitives/frontier/frontier_dpc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ inline sycl::event frontier<ElementType>::compute_active_frontier() {
108108
const std::uint64_t local_range = 256; // propose_wg_size(this->_queue);
109109
const std::uint64_t mlb_count = _mlb_layer.get_count();
110110
const std::uint64_t global_range = (mlb_count % local_range == 0)
111-
? mlb_count
112-
: (mlb_count + local_range - (mlb_count % local_range));
111+
? mlb_count
112+
: (mlb_count + local_range - (mlb_count % local_range));
113113

114114
// check if local memory is enough
115115
bool use_local_mem =

cpp/oneapi/dal/backend/primitives/frontier/graph.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ class csr_graph_view {
6969
};
7070

7171
public:
72-
csr_graph_view(std::uint64_t num_nodes, vertex_t* row_ptr, edge_t* col_indices, weight_t* weights)
72+
csr_graph_view(std::uint64_t num_nodes,
73+
vertex_t* row_ptr,
74+
edge_t* col_indices,
75+
weight_t* weights)
7376
: _num_nodes(num_nodes),
7477
_row_ptr(row_ptr),
7578
_col_indices(col_indices),

0 commit comments

Comments
 (0)