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

build: add [[maybe_unused]] on EXPORT macro #559

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/nccl-headers/neuron/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef NCCL_HEADERS_NEURON_ERROR_H_
#define NCCL_HEADERS_NEURON_ERROR_H_

#ifdef _cplusplus
#ifdef __cplusplus
extern "C" {
#endif

Expand All @@ -21,7 +21,7 @@ typedef enum {
ncclRemoteError = 6
} ncclResult_t;

#ifdef _cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions include/nccl-headers/neuron/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef NCCL_HEADERS_NEURON_NET_H_
#define NCCL_HEADERS_NEURON_NET_H_

#ifdef _cplusplus
#ifdef __cplusplus
extern "C" {
#endif

Expand Down Expand Up @@ -100,7 +100,7 @@ typedef struct {
ncclResult_t (*closeListen)(void* listenComm);
} ncclNet_v4_t;

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
9 changes: 4 additions & 5 deletions include/nccl_ofi.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#ifndef NCCL_OFI_H_
#define NCCL_OFI_H_

#ifdef _cplusplus

#ifdef __cplusplus
extern "C" {
#endif

Expand All @@ -23,7 +24,6 @@ extern "C" {
#include "nccl_ofi_idpool.h"
#include "nccl_ofi_mr.h"


/*
* NCCL_NET_HANDLE_MAXSIZE is a limited resource (and defined in NCCL).
* An endpoint address buffer of 56 bytes *should* be large enough to hold
Expand Down Expand Up @@ -192,8 +192,7 @@ typedef struct nccl_ofi_connection_info {
nccl_net_ofi_req_t* req;
} nccl_ofi_connection_info_t;
/* Since this is a message on the wire, check that it has the expected size */
_Static_assert(sizeof(nccl_ofi_connection_info_t) == 80,
"Wrong size for SENDRECV connect message");
static_assert(sizeof(nccl_ofi_connection_info_t) == 80, "Wrong size for SENDRECV connect message");

typedef struct nccl_net_ofi_conn_handle {
char ep_name[MAX_EP_ADDR];
Expand Down Expand Up @@ -590,7 +589,7 @@ int nccl_net_ofi_dealloc_mr_buffer(void *ptr, size_t size);
int nccl_net_ofi_query_provider_capabilities(const struct fi_info *selected_provider,
unsigned int num_providers);

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
9 changes: 5 additions & 4 deletions include/nccl_ofi_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
#ifndef NET_OFI_API_H_
#define NET_OFI_API_H_

#include "nccl-headers/net.h"
#include "nccl-headers/error.h"

#ifdef _cplusplus
#ifdef __cplusplus
extern "C" {
#endif

#include "nccl-headers/net.h"
#include "nccl-headers/error.h"

struct nccl_ofi_properties;

ncclResult_t nccl_net_ofi_init(ncclDebugLogger_t logFunction);
Expand Down Expand Up @@ -42,7 +43,7 @@ ncclResult_t nccl_net_ofi_closeSend(void *sendComm);
ncclResult_t nccl_net_ofi_closeRecv(void *recvComm);
ncclResult_t nccl_net_ofi_closeListen(void *listenComm);

#ifdef _cplusplus
#ifdef __cplusplus
}
#endif // End extern "C"

Expand Down
8 changes: 8 additions & 0 deletions include/nccl_ofi_config_bottom.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@
#define OFI_LIKELY(x) __builtin_expect((x), 1)
#define OFI_UNLIKELY(x) __builtin_expect((x), 0)

#ifdef __cplusplus
#define NCCL_OFI_EXPORT_SYMBOL __attribute__((visibility("default"))) [[maybe_unused]]
Copy link
Contributor

Choose a reason for hiding this comment

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

My comment from 19d4b38 remains; this shouldn't be necessary and I'd like to get to root cause before committing it.

#else
#define NCCL_OFI_EXPORT_SYMBOL __attribute__((visibility("default")))
#endif

#ifndef __cplusplus
#define static_assert _Static_assert
#endif

/* Maximum length of directory path */
#ifdef HAVE_LINUX_LIMITS_H
Expand Down
5 changes: 3 additions & 2 deletions include/nccl_ofi_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#ifndef NCCL_OFI_CUDA_H_
#define NCCL_OFI_CUDA_H_

#ifdef _cplusplus

#ifdef __cplusplus
extern "C" {
#endif

Expand Down Expand Up @@ -41,7 +42,7 @@ extern CUresult (*nccl_net_ofi_cuFlushGPUDirectRDMAWrites)(CUflushGPUDirectRDMAW
extern void *nccl_net_ofi_cuFlushGPUDirectRDMAWrites;
#endif

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
5 changes: 3 additions & 2 deletions include/nccl_ofi_deque.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#ifndef NCCL_OFI_DEQUE_H
#define NCCL_OFI_DEQUE_H

#ifdef _cplusplus

#ifdef __cplusplus
extern "C" {
#endif

Expand Down Expand Up @@ -162,7 +163,7 @@ static inline int nccl_ofi_deque_remove_front(nccl_ofi_deque_t *deque, nccl_ofi_
return 0;
}

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
8 changes: 8 additions & 0 deletions include/nccl_ofi_ep_addr_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#ifndef NCCL_OFI_EP_ADDR_LIST_H
#define NCCL_OFI_EP_ADDR_LIST_H

#ifdef __cplusplus
extern "C" {
#endif

struct nccl_ofi_ep_addr_list;
typedef struct nccl_ofi_ep_addr_list nccl_ofi_ep_addr_list_t;

Expand Down Expand Up @@ -76,4 +80,8 @@ int nccl_ofi_ep_addr_list_delete(nccl_ofi_ep_addr_list_t *ep_list, nccl_net_ofi_
*/
void nccl_ofi_ep_addr_list_fini(nccl_ofi_ep_addr_list_t *ep_list);

#ifdef __cplusplus
} // End extern "C"
#endif

#endif
9 changes: 5 additions & 4 deletions include/nccl_ofi_freelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#ifndef NCCL_OFI_FREELIST_H
#define NCCL_OFI_FREELIST_H

#ifdef _cplusplus

#ifdef __cplusplus
extern "C" {
#endif

Expand Down Expand Up @@ -94,9 +95,9 @@ struct nccl_ofi_freelist_reginfo_t {
};
typedef struct nccl_ofi_freelist_reginfo_t nccl_ofi_freelist_reginfo_t;

_Static_assert(offsetof(nccl_ofi_freelist_reginfo_t, elem) == 0,
static_assert(offsetof(nccl_ofi_freelist_reginfo_t, elem) == 0,
"elem is not the first member of the structure nccl_ofi_freelist_reginfo_t");
_Static_assert(sizeof(nccl_ofi_freelist_reginfo_t) - offsetof(nccl_ofi_freelist_reginfo_t, redzone) == MEMCHECK_REDZONE_SIZE,
static_assert(sizeof(nccl_ofi_freelist_reginfo_t) - offsetof(nccl_ofi_freelist_reginfo_t, redzone) == MEMCHECK_REDZONE_SIZE,
"redzone is not the last member of the structure nccl_ofi_freelist_reginfo_t");

/*
Expand Down Expand Up @@ -313,7 +314,7 @@ static inline void nccl_ofi_freelist_entry_free(nccl_ofi_freelist_t *freelist, v
nccl_net_ofi_mutex_unlock(&freelist->lock);
}

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
6 changes: 3 additions & 3 deletions include/nccl_ofi_idpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
#ifndef NCCL_OFI_IDPOOL_H_
#define NCCL_OFI_IDPOOL_H_

#ifdef _cplusplus

#ifdef __cplusplus
extern "C" {
#endif

#include <pthread.h>

#include <stdint.h>

/*
Expand Down Expand Up @@ -87,7 +87,7 @@ int nccl_ofi_idpool_free_id(nccl_ofi_idpool_t *idpool, int id);
*/
int nccl_ofi_idpool_fini(nccl_ofi_idpool_t *idpool);

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
4 changes: 2 additions & 2 deletions include/nccl_ofi_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef NCCL_OFI_LOG_H_
#define NCCL_OFI_LOG_H_

#ifdef _cplusplus
#ifdef __cplusplus
extern "C" {
#endif

Expand All @@ -33,7 +33,7 @@ extern ncclDebugLogger_t ofi_log_function;
#define NCCL_OFI_TRACE(flags, fmt, ...)
#endif

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
4 changes: 2 additions & 2 deletions include/nccl_ofi_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef NCCL_OFI_MATH_H_
#define NCCL_OFI_MATH_H_

#ifdef _cplusplus
#ifdef __cplusplus
extern "C" {
#endif

Expand Down Expand Up @@ -65,7 +65,7 @@ extern "C" {
*/
#define NCCL_OFI_ROUND_UP(x, y) NCCL_OFI_ROUND_DOWN((x) + ((y) - 1), (y))

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
6 changes: 3 additions & 3 deletions include/nccl_ofi_memcheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef NCCL_OFI_MEMCHECK_H
#define NCCL_OFI_MEMCHECK_H

#ifdef _cplusplus
#ifdef __cplusplus
extern "C" {
#endif

Expand All @@ -29,7 +29,7 @@ extern "C" {
* MEMCHECK_REDZONE_SIZE defines the size of redzones prefixing each
* entry. Redzones are required to be a multiple of 8 due to ASAN
* shadow-map granularity */
_Static_assert(MEMCHECK_REDZONE_SIZE % MEMCHECK_GRANULARITY == 0,
static_assert(MEMCHECK_REDZONE_SIZE % MEMCHECK_GRANULARITY == 0,
"Size of redzone is not a multiple of ASAN shadow-map granularity");

/**
Expand Down Expand Up @@ -169,7 +169,7 @@ static inline void nccl_net_ofi_mem_mempool_alloc(void *handle, void *data, size
*/
static inline void nccl_net_ofi_mem_mempool_free(void *handle, void *data, size_t size);

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
4 changes: 2 additions & 2 deletions include/nccl_ofi_memcheck_asan.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef NCCL_OFI_MEMCHECK_ASAN_H
#define NCCL_OFI_MEMCHECK_ASAN_H

#ifdef _cplusplus
#ifdef __cplusplus
extern "C" {
#endif

Expand Down Expand Up @@ -56,7 +56,7 @@ static inline void nccl_net_ofi_mem_mempool_free(void *handle, void *data, size_
nccl_net_ofi_mem_noaccess(data, size);
}

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
4 changes: 2 additions & 2 deletions include/nccl_ofi_memcheck_nop.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef NCCL_OFI_MEMCHECK_NOP_H
#define NCCL_OFI_MEMCHECK_NOP_H

#ifdef _cplusplus
#ifdef __cplusplus
extern "C" {
#endif

Expand Down Expand Up @@ -44,7 +44,7 @@ static inline void nccl_net_ofi_mem_mempool_free(void *handle, void *data, size_
{
}

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
4 changes: 2 additions & 2 deletions include/nccl_ofi_memcheck_valgrind.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef NCCL_OFI_MEMCHECK_VALGRIND_H
#define NCCL_OFI_MEMCHECK_VALGRIND_H

#ifdef _cplusplus
#ifdef __cplusplus
extern "C" {
#endif

Expand Down Expand Up @@ -48,7 +48,7 @@ static inline void nccl_net_ofi_mem_mempool_free(void *handle, void *data, size_
VALGRIND_MEMPOOL_FREE(handle, data);
}

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
4 changes: 2 additions & 2 deletions include/nccl_ofi_mr.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef NCCL_OFI_MR_H_
#define NCCL_OFI_MR_H_

#ifdef _cplusplus
#ifdef __cplusplus
extern "C" {
#endif

Expand Down Expand Up @@ -80,7 +80,7 @@ int nccl_ofi_mr_cache_insert_entry(nccl_ofi_mr_cache_t *cache,
*/
int nccl_ofi_mr_cache_del_entry(nccl_ofi_mr_cache_t *cache, void *handle);

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
5 changes: 2 additions & 3 deletions include/nccl_ofi_msgbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
#ifndef NCCL_OFI_MSGBUFF_H_
#define NCCL_OFI_MSGBUFF_H_

#ifdef _cplusplus
#ifdef __cplusplus
extern "C" {
#endif

#include <pthread.h>

#include <stdbool.h>
#include <stdint.h>

Expand Down Expand Up @@ -183,7 +182,7 @@ nccl_ofi_msgbuff_result_t nccl_ofi_msgbuff_retrieve(nccl_ofi_msgbuff_t *msgbuff,
nccl_ofi_msgbuff_result_t nccl_ofi_msgbuff_complete(nccl_ofi_msgbuff_t *msgbuff,
uint16_t msg_index, nccl_ofi_msgbuff_status_t *msg_idx_status);

#ifdef _cplusplus
#ifdef __cplusplus
} // End extern "C"
#endif

Expand Down
Loading
Loading