Skip to content

Fix shadowing in ompi #8593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 23, 2021
Merged

Fix shadowing in ompi #8593

merged 3 commits into from
Mar 23, 2021

Conversation

awlauria
Copy link
Contributor

No description provided.

@awlauria
Copy link
Contributor Author

Opened as a result of discussion in #8591

More changes to come.

@ibm-ompi
Copy link

The IBM CI (GNU/Scale) build failed! Please review the log, linked below.

Gist: https://gist.github.com/368de65d3cf2ca397306a2802dc8afda

@ibm-ompi
Copy link

The IBM CI (XL) build failed! Please review the log, linked below.

Gist: https://gist.github.com/84a9668b9a0dc6fa9daa31447e82982e

@ibm-ompi
Copy link

The IBM CI (PGI) build failed! Please review the log, linked below.

Gist: https://gist.github.com/925db533557028ed50040dfc0ae20c02

@bosilca
Copy link
Member

bosilca commented Mar 11, 2021

This does not improve the readability of the code. Plus in all instances addressed in this patch the scoping was correct, so there was nothing to fix.

@awlauria
Copy link
Contributor Author

Thanks for the comments. There's more to be added before it's ready to be merged.

In general shadowing is a bad practice that can lead to unintended bugs, so I'd argue that it is a 'good' thing. But if the consensus is we don't want it I won't pursue it further.

@hjelmn
Copy link
Member

hjelmn commented Mar 11, 2021

Yeah. I think this is a good thing. I have in the past encountered issues where shadowing covered up a real bug in Open MPI. I think this is a good thing to get a consensus decision on.

@rhc54
Copy link
Contributor

rhc54 commented Mar 11, 2021

We've been burned multiple times this way - let's stop shadowing.

@@ -382,7 +382,6 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module,

/* Centralized Reordering */
if (0 == mca_topo_treematch_component.reorder_mode) {
int *k = NULL;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little unsure of this change. I think this is equivalent, but I'm not sure what k is supposed to be, and this function is huge.

@hjelmn
Copy link
Member

hjelmn commented Mar 12, 2021

Looks like this is already uncovering some bugs. @awlauria If you find a bug due to shadowing please open separate tickets for those issues and PR to v4.0.x, v4.1.x, and v5.0.x.

@awlauria awlauria force-pushed the fix_shadowing branch 3 times, most recently from 5871531 to 8827c18 Compare March 12, 2021 15:13
@@ -445,39 +443,35 @@ mca_btl_base_rdma_start (mca_btl_base_module_t *btl, struct mca_btl_base_endpoin
context->local_handle = local_handle;
context->total_size = size;

size_t send_size = 0;
size_t recv_size = 0;
Copy link
Contributor Author

@awlauria awlauria Mar 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hjelmn This was marked as unused, was this intended to get added to the packet_size or should this block be removed/refactored to not use it:

else if (MCA_BTL_BASE_AM_GET == type) {
        if (sizeof (mca_btl_base_rdma_response_hdr_t) + size <= btl->btl_eager_limit) {
            recv_size = size;
            packet_size += size;
        } else if (!mca_btl_base_rdma_use_rdma_put (btl)) {
            recv_size = size_t_min (size, btl->btl_max_send_size -
            packet_size += size_t_min (size, btl->btl_max_send_size -
                                              sizeof (mca_btl_base_rdma_response_hdr_t));
        } else {
            use_rdma = true;
        }
    } else {
        /* fetching atomic. always recv result via active message */
        recv_size = size;
        packet_size += size;
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hjelmn when you get a chance can you look at the above?

@awlauria
Copy link
Contributor Author

Removing the WIP label. All of the shadowing caught with gcc should be removed. There's some in treematch and romio that I didn't touch, and likely never will.

I also added a commit that addressed some low hanging misc. warnings.

@awlauria
Copy link
Contributor Author

Trying again...

bot:aws:retest

Copy link
Member

@gpaulsen gpaulsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's be nice to keep this assert in debug case to help pinpoint the error.

@awlauria awlauria force-pushed the fix_shadowing branch 2 times, most recently from 9f435a2 to 04dff2b Compare March 12, 2021 19:55
@awlauria awlauria requested a review from gpaulsen March 12, 2021 19:56
@awlauria
Copy link
Contributor Author

bot:ompi:retest

@awlauria
Copy link
Contributor Author

Rebased on top of master.

@awlauria awlauria dismissed gpaulsen’s stale review March 22, 2021 16:51

Changes made.

@awlauria
Copy link
Contributor Author

bot:aws:retest

@awlauria awlauria merged commit ef5bd1b into open-mpi:master Mar 23, 2021
@awlauria awlauria deleted the fix_shadowing branch March 23, 2021 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants