Skip to content

Commit 3ba2030

Browse files
generatedunixname915440834509264meta-codesync[bot]
authored andcommitted
Fix CQS signal readability-braces-around-statements in fbcode/vision/fair
Reviewed By: bottler Differential Revision: D94068738 fbshipit-source-id: cd47c67d4269ac7461acb73da6de9e4373da9d4c
1 parent 79a7fcf commit 3ba2030

5 files changed

Lines changed: 60 additions & 30 deletions

File tree

pytorch3d/csrc/pulsar/include/renderer.destruct.device.h

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,68 +18,89 @@ namespace Renderer {
1818

1919
template <bool DEV>
2020
HOST void destruct(Renderer* self) {
21-
if (self->result_d != NULL)
21+
if (self->result_d != NULL) {
2222
FREE(self->result_d);
23+
}
2324
self->result_d = NULL;
24-
if (self->min_depth_d != NULL)
25+
if (self->min_depth_d != NULL) {
2526
FREE(self->min_depth_d);
27+
}
2628
self->min_depth_d = NULL;
27-
if (self->min_depth_sorted_d != NULL)
29+
if (self->min_depth_sorted_d != NULL) {
2830
FREE(self->min_depth_sorted_d);
31+
}
2932
self->min_depth_sorted_d = NULL;
30-
if (self->ii_d != NULL)
33+
if (self->ii_d != NULL) {
3134
FREE(self->ii_d);
35+
}
3236
self->ii_d = NULL;
33-
if (self->ii_sorted_d != NULL)
37+
if (self->ii_sorted_d != NULL) {
3438
FREE(self->ii_sorted_d);
39+
}
3540
self->ii_sorted_d = NULL;
36-
if (self->ids_d != NULL)
41+
if (self->ids_d != NULL) {
3742
FREE(self->ids_d);
43+
}
3844
self->ids_d = NULL;
39-
if (self->ids_sorted_d != NULL)
45+
if (self->ids_sorted_d != NULL) {
4046
FREE(self->ids_sorted_d);
47+
}
4148
self->ids_sorted_d = NULL;
42-
if (self->workspace_d != NULL)
49+
if (self->workspace_d != NULL) {
4350
FREE(self->workspace_d);
51+
}
4452
self->workspace_d = NULL;
45-
if (self->di_d != NULL)
53+
if (self->di_d != NULL) {
4654
FREE(self->di_d);
55+
}
4756
self->di_d = NULL;
48-
if (self->di_sorted_d != NULL)
57+
if (self->di_sorted_d != NULL) {
4958
FREE(self->di_sorted_d);
59+
}
5060
self->di_sorted_d = NULL;
51-
if (self->region_flags_d != NULL)
61+
if (self->region_flags_d != NULL) {
5262
FREE(self->region_flags_d);
63+
}
5364
self->region_flags_d = NULL;
54-
if (self->num_selected_d != NULL)
65+
if (self->num_selected_d != NULL) {
5566
FREE(self->num_selected_d);
67+
}
5668
self->num_selected_d = NULL;
57-
if (self->forw_info_d != NULL)
69+
if (self->forw_info_d != NULL) {
5870
FREE(self->forw_info_d);
71+
}
5972
self->forw_info_d = NULL;
60-
if (self->min_max_pixels_d != NULL)
73+
if (self->min_max_pixels_d != NULL) {
6174
FREE(self->min_max_pixels_d);
75+
}
6276
self->min_max_pixels_d = NULL;
63-
if (self->grad_pos_d != NULL)
77+
if (self->grad_pos_d != NULL) {
6478
FREE(self->grad_pos_d);
79+
}
6580
self->grad_pos_d = NULL;
66-
if (self->grad_col_d != NULL)
81+
if (self->grad_col_d != NULL) {
6782
FREE(self->grad_col_d);
83+
}
6884
self->grad_col_d = NULL;
69-
if (self->grad_rad_d != NULL)
85+
if (self->grad_rad_d != NULL) {
7086
FREE(self->grad_rad_d);
87+
}
7188
self->grad_rad_d = NULL;
72-
if (self->grad_cam_d != NULL)
89+
if (self->grad_cam_d != NULL) {
7390
FREE(self->grad_cam_d);
91+
}
7492
self->grad_cam_d = NULL;
75-
if (self->grad_cam_buf_d != NULL)
93+
if (self->grad_cam_buf_d != NULL) {
7694
FREE(self->grad_cam_buf_d);
95+
}
7796
self->grad_cam_buf_d = NULL;
78-
if (self->grad_opy_d != NULL)
97+
if (self->grad_opy_d != NULL) {
7998
FREE(self->grad_opy_d);
99+
}
80100
self->grad_opy_d = NULL;
81-
if (self->n_grad_contributions_d != NULL)
101+
if (self->n_grad_contributions_d != NULL) {
82102
FREE(self->n_grad_contributions_d);
103+
}
83104
self->n_grad_contributions_d = NULL;
84105
}
85106

pytorch3d/csrc/pulsar/include/renderer.norm_sphere_gradients.device.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ GLOBAL void norm_sphere_gradients(Renderer renderer, const int num_balls) {
6464
// The sphere only contributes to the camera gradients if it is
6565
// large enough in screen space.
6666
if (renderer.ids_sorted_d[idx] > 0 && ii.max.x >= ii.min.x + 3 &&
67-
ii.max.y >= ii.min.y + 3)
67+
ii.max.y >= ii.min.y + 3) {
6868
renderer.ids_sorted_d[idx] = 1;
69+
}
6970
END_PARALLEL_NORET();
7071
};
7172

pytorch3d/csrc/pulsar/include/renderer.render.device.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ GLOBAL void render(
139139
coord_y < cam_norm.film_border_top + cam_norm.film_height) {
140140
// Initialize the result.
141141
if (mode == 0u) {
142-
for (uint c_id = 0; c_id < cam_norm.n_channels; ++c_id)
142+
for (uint c_id = 0; c_id < cam_norm.n_channels; ++c_id) {
143143
result[c_id] = bg_col[c_id];
144+
}
144145
} else {
145146
result[0] = 0.f;
146147
}
@@ -190,20 +191,22 @@ GLOBAL void render(
190191
"render|found intersection with sphere %u.\n",
191192
sphere_id_l[write_idx]);
192193
}
193-
if (ii.min.x == MAX_USHORT)
194+
if (ii.min.x == MAX_USHORT) {
194195
// This is an invalid sphere (out of image). These spheres have
195196
// maximum depth. Since we ordered the spheres by earliest possible
196197
// intersection depth we re certain that there will no other sphere
197198
// that is relevant after this one.
198199
loading_done = true;
200+
}
199201
}
200202
// Reset n_pixels_done.
201203
n_pixels_done = 0;
202204
thread_block.sync(); // Make sure n_loaded is updated.
203205
if (n_loaded > RENDER_BUFFER_LOAD_THRESH) {
204206
// The load buffer is full enough. Draw.
205-
if (thread_block.thread_rank() == 0)
207+
if (thread_block.thread_rank() == 0) {
206208
n_balls_loaded += n_loaded;
209+
}
207210
max_closest_possible_intersection = 0.f;
208211
// This excludes threads outside of the image boundary. Also, it reduces
209212
// block artifacts.
@@ -290,17 +293,19 @@ GLOBAL void render(
290293
uint warp_done = thread_warp.ballot(done);
291294
int warp_done_bit_cnt = POPC(warp_done);
292295
#endif //__CUDACC__ && __HIP_PLATFORM_AMD__
293-
if (thread_warp.thread_rank() == 0)
296+
if (thread_warp.thread_rank() == 0) {
294297
ATOMICADD_B(&n_pixels_done, warp_done_bit_cnt);
298+
}
295299
// This sync is necessary to keep n_loaded until all threads are done with
296300
// painting.
297301
thread_block.sync();
298302
n_loaded = 0;
299303
}
300304
thread_block.sync();
301305
}
302-
if (thread_block.thread_rank() == 0)
306+
if (thread_block.thread_rank() == 0) {
303307
n_balls_loaded += n_loaded;
308+
}
304309
PULSAR_LOG_DEV_PIX(
305310
PULSAR_LOG_RENDER_PIX,
306311
"render|loaded %d balls in total.\n",
@@ -386,8 +391,9 @@ GLOBAL void render(
386391
static_cast<float>(tracker.get_n_hits());
387392
} else {
388393
float sm_d_normfac = FRCP(FMAX(sm_d, FEPS));
389-
for (uint c_id = 0; c_id < cam_norm.n_channels; ++c_id)
394+
for (uint c_id = 0; c_id < cam_norm.n_channels; ++c_id) {
390395
result[c_id] *= sm_d_normfac;
396+
}
391397
int write_loc = (coord_y - cam_norm.film_border_top) * cam_norm.film_width *
392398
(3 + 2 * n_track) +
393399
(coord_x - cam_norm.film_border_left) * (3 + 2 * n_track);

pytorch3d/csrc/pulsar/pytorch/renderer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,9 @@ std::tuple<torch::Tensor, torch::Tensor> Renderer::forward(
860860
? (cudaStream_t) nullptr
861861
#endif
862862
: (cudaStream_t) nullptr);
863-
if (mode == 1)
863+
if (mode == 1) {
864864
results[batch_i] = results[batch_i].slice(2, 0, 1, 1);
865+
}
865866
forw_infos[batch_i] = from_blob(
866867
this->renderer_vec[batch_i].forw_info_d,
867868
{this->renderer_vec[0].cam.film_height,

pytorch3d/csrc/pulsar/pytorch/renderer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ struct Renderer {
128128
stream << "pulsar::Renderer[";
129129
// Device info.
130130
stream << self.device_type;
131-
if (self.device_index != -1)
131+
if (self.device_index != -1) {
132132
stream << ", ID " << self.device_index;
133+
}
133134
stream << "]";
134135
return stream;
135136
}

0 commit comments

Comments
 (0)