Skip to content
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

fix(tree): move declarations to top of function #563

Closed
wants to merge 0 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Sep 4, 2024

Stacked PRs:


fix(tree): move declarations to top of function

c++ suppoorts initializers anywhere in the function, but one must not
jump over an initializer with any goto usage. Given the lack of RAII in
C, this becomes a significant painpoint.

In large to-be-eventually-refactored functions contain gotos or use
switch statements, split declaration and initialization, and move all
declarations to the top of the function. This makes switch statements
and gotos safe in both languages.
Signed-off-by: Nicholas Sielicki nslick@amazon.com

@ghost ghost self-requested a review as a code owner September 4, 2024 16:44
@ghost ghost force-pushed the aws-nslick/stack/9 branch from ddc2dc3 to a72658c Compare September 4, 2024 16:45
@ghost ghost force-pushed the aws-nslick/stack/10 branch from 6c0e684 to 87d7aa4 Compare September 4, 2024 16:45
@ghost ghost changed the base branch from aws-nslick/stack/9 to master September 4, 2024 19:07
@ghost ghost requested review from rauteric and bwbarrett as code owners September 4, 2024 19:07
@ghost ghost force-pushed the aws-nslick/stack/10 branch from 87d7aa4 to 2010737 Compare September 4, 2024 19:07
@ghost ghost changed the base branch from master to aws-nslick/stack/9 September 4, 2024 19:08
@ghost ghost changed the base branch from aws-nslick/stack/9 to master September 4, 2024 19:16
@ghost ghost force-pushed the aws-nslick/stack/10 branch from 2010737 to d190daf Compare September 4, 2024 19:16
@ghost ghost changed the base branch from master to aws-nslick/stack/7 September 4, 2024 19:17
@ghost ghost changed the base branch from aws-nslick/stack/7 to master September 4, 2024 20:25
@ghost ghost force-pushed the aws-nslick/stack/10 branch from d190daf to 7742bd5 Compare September 4, 2024 20:25
@ghost ghost changed the title tree: move declarations to top of function fix(tree): move declarations to top of function Sep 4, 2024
@ghost ghost changed the base branch from master to aws-nslick/stack/7 September 4, 2024 20:25
@ghost ghost mentioned this pull request Sep 4, 2024
@ghost ghost changed the base branch from aws-nslick/stack/7 to master September 12, 2024 01:09
@ghost ghost changed the base branch from master to aws-nslick/stack/7 September 12, 2024 01:10
@ghost ghost changed the base branch from aws-nslick/stack/7 to master September 12, 2024 01:50
@ghost ghost changed the base branch from master to aws-nslick/stack/7 September 12, 2024 01:52
@ghost ghost changed the base branch from aws-nslick/stack/7 to master September 13, 2024 17:48
@ghost ghost force-pushed the aws-nslick/stack/10 branch from f0a0d45 to 742e8d5 Compare September 13, 2024 17:49
@ghost ghost changed the base branch from master to aws-nslick/stack/7 September 13, 2024 17:50
@ghost
Copy link
Author

ghost commented Sep 14, 2024

aws:bot:retest

@ghost ghost changed the base branch from aws-nslick/stack/7 to master September 14, 2024 22:36
@ghost ghost force-pushed the aws-nslick/stack/10 branch 2 times, most recently from d769709 to 34c8a09 Compare September 17, 2024 20:25
bwbarrett
bwbarrett previously approved these changes Sep 24, 2024
Copy link
Contributor

@bwbarrett bwbarrett left a comment

Choose a reason for hiding this comment

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

My old school C99 brain is happy now.

@ghost ghost mentioned this pull request Sep 27, 2024
@ghost ghost force-pushed the aws-nslick/stack/10 branch from 61a29ab to 2dae7eb Compare September 27, 2024 00:31
@ghost ghost requested review from bwbarrett and rauteric September 27, 2024 01:44
ghost pushed a commit that referenced this pull request Sep 27, 2024
c++ suppoorts initializers anywhere in the function, but one must not
jump over an initializer with any goto usage. Given the lack of RAII in
C, this becomes a significant painpoint.

In large to-be-eventually-refactored functions contain gotos or use
switch statements, split declaration and initialization, and move all
declarations to the top of the function. This makes switch statements
and gotos safe in both languages.

Signed-off-by: Nicholas Sielicki <nslick@amazon.com>
@ghost ghost force-pushed the aws-nslick/stack/10 branch 3 times, most recently from 7915503 to 30efcbf Compare September 28, 2024 04:28
@ghost
Copy link
Author

ghost commented Sep 28, 2024

There was a bug on rebase:

diff --git a/src/nccl_ofi_net.c b/src/nccl_ofi_net.c
index 17e6ae2e..bcd27566 100644
--- a/src/nccl_ofi_net.c
+++ b/src/nccl_ofi_net.c
@@ -277,7 +277,7 @@ int nccl_net_ofi_create_plugin(nccl_net_ofi_plugin_t **plugin_p)
         * resources. This initialization happens once per process, and thus it
         * does not matter which device is used to create the endpoint.
         */
-       device = plugin->get_device(*plugin_p, 0);
+       device = plugin->get_device(plugin, 0);
 
        ret = device->get_ep(device, &base_ep);
        if (ret != 0) {

Prior to plugin_p being written to plugin a few lines down. Fixed.

@ghost
Copy link
Author

ghost commented Sep 28, 2024

bot:aws:retest

ghost pushed a commit that referenced this pull request Oct 1, 2024
c++ suppoorts initializers anywhere in the function, but one must not
jump over an initializer with any goto usage. Given the lack of RAII in
C, this becomes a significant painpoint.

In large to-be-eventually-refactored functions contain gotos or use
switch statements, split declaration and initialization, and move all
declarations to the top of the function. This makes switch statements
and gotos safe in both languages.

Signed-off-by: Nicholas Sielicki <nslick@amazon.com>
@ghost ghost closed this Oct 1, 2024
@ghost ghost force-pushed the aws-nslick/stack/10 branch from 30efcbf to e27abab Compare October 1, 2024 19:55
@ghost ghost deleted the aws-nslick/stack/10 branch October 1, 2024 19:55
aws-ofiwg-bot pushed a commit to aws-ofiwg-bot/aws-ofi-nccl that referenced this pull request Oct 4, 2024
c++ suppoorts initializers anywhere in the function, but one must not
jump over an initializer with any goto usage. Given the lack of RAII in
C, this becomes a significant painpoint.

In large to-be-eventually-refactored functions contain gotos or use
switch statements, split declaration and initialization, and move all
declarations to the top of the function. This makes switch statements
and gotos safe in both languages.

Signed-off-by: Nicholas Sielicki <nslick@amazon.com>
This pull request was closed.
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.

2 participants