Skip to content

Commit 7b884b9

Browse files
authored
Fix warp divergence (#681)
This PR fixes a crash observe while running benchmarks. ## Summary by CodeRabbit * **Refactor** * Enhanced GPU kernel synchronization to improve performance and reliability in feasibility checking operations. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> Authors: - Hugo Linsenmaier (https://github.com/hlinsen) - Alice Boucher (https://github.com/aliceb-nv) Approvers: - Chris Maes (https://github.com/chris-maes) - Alice Boucher (https://github.com/aliceb-nv) URL: #681
1 parent 675f902 commit 7b884b9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cpp/src/mip/feasibility_jump/feasibility_jump_kernels.cu

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@ __device__ void compute_mtm_moves(typename fj_t<i_t, f_t>::climber_data_t::view_
975975
// related variable table couldn't be computed ahead of time, get related variables dynamically
976976
else if (fj.pb.related_variables.size() == 0) {
977977
compute_iteration_related_variables<i_t, f_t>(fj);
978+
__syncwarp();
978979
cg::this_grid().sync();
979980
split_begin = 0;
980981
split_end = fj.pb.n_variables;
@@ -1195,6 +1196,7 @@ DI thrust::tuple<i_t, f_t, typename fj_t<i_t, f_t>::move_score_t> gridwide_reduc
11951196

11961197
// grid-wide reduce
11971198
// will be replaced by a proper load balancing scheme
1199+
__syncwarp();
11981200
cg::this_grid().sync();
11991201

12001202
if (blockIdx.x == 0) {
@@ -1365,6 +1367,7 @@ __global__ void handle_local_minimum_kernel(typename fj_t<i_t, f_t>::climber_dat
13651367

13661368
// Pick the best move among the variables involved in a random violated constraint.
13671369
if (!fj.violated_constraints.empty()) {
1370+
__syncwarp();
13681371
cg::this_grid().sync();
13691372
thrust::tie(best_var, best_delta, best_score) =
13701373
best_random_mtm_move<i_t, f_t, TPB_localmin>(fj);
@@ -1377,6 +1380,7 @@ __global__ void handle_local_minimum_kernel(typename fj_t<i_t, f_t>::climber_dat
13771380
// also consider breakthrough moves
13781381
if (*fj.best_objective < std::numeric_limits<f_t>::infinity() &&
13791382
*fj.incumbent_objective > *fj.best_objective) {
1383+
__syncwarp();
13801384
cg::this_grid().sync();
13811385
auto [bm_best_var, bm_best_delta, bm_best_score] =
13821386
best_breakthrough_move_at_local_min<i_t, f_t, TPB_localmin>(fj);
@@ -1392,6 +1396,7 @@ __global__ void handle_local_minimum_kernel(typename fj_t<i_t, f_t>::climber_dat
13921396
}
13931397

13941398
if (FIRST_THREAD) *fj.selected_var = best_var;
1399+
__syncwarp();
13951400
cg::this_grid().sync();
13961401
// still nothing? try sat MTM moves if we are in the feasible region
13971402
// Attempt to find a valid move by going over MTM moves in valid constraints

0 commit comments

Comments
 (0)