-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
param: Temporarily hack around ODR problem
The param implementation stamped out accessor functions in each compilation unit, which created obvious problems with C++'s naming rules. We know we want to rewrite this in the future, so for now just stamp out one implementation in nccl_ofi_param.c that everyone can call, and do some ugly macro hacking to make that a minimum required change. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
- Loading branch information
Showing
3 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All rights reserved. | ||
*/ | ||
|
||
#include "config.h" | ||
|
||
/* | ||
* This is an ugly hack. The original implementation of | ||
* nccl_ofi_param created inline functions to access each environment | ||
* variable, using the macros found in nccl_ofi_param.h. However, | ||
* this creates something of an ODR problem, as multiple complication | ||
* units can call the same param lookup function, and that results in | ||
* naming conflicts. So instead, we have the header file act like a | ||
* normal header file most of the time, and when included from | ||
* nccl_ofi_param.c with OFI_NCCL_PARAM_DEFINE set to 1, stamps out | ||
* the original implementations of the functions. So now we have one | ||
* copy of each function that everyone can call. | ||
* | ||
* This is intended to be a transient state. We want to rewrite the | ||
* entire param system once we've finished moving to C++, but need to | ||
* solve the ODR problem before we move to C++. So here lies one of | ||
* the more terrible pieces of code I've ever written. | ||
*/ | ||
#define OFI_NCCL_PARAM_DEFINE 1 | ||
#include "nccl_ofi_param.h" |