-
Notifications
You must be signed in to change notification settings - Fork 74
Add ROCm support to plugin #1014
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
Open
thomas-huber
wants to merge
4
commits into
aws:master
Choose a base branch
from
thomas-huber:thomas/rccl-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+380
−56
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,50 @@ | ||
/* | ||
* Copyright (c) 2018-2023 Amazon.com, Inc. or its affiliates. All rights reserved. | ||
* Copyright (c) 2025, Hewlett Packard Enterprise Development LP. | ||
* Copyright (c) 2025, Advanced Micro Devices, Inc. All rights reserved | ||
*/ | ||
|
||
#ifndef NCCL_OFI_ROCM_H_ | ||
#define NCCL_OFI_ROCM_H_ | ||
|
||
/* Generic GPU init (ROCm variant) */ | ||
int nccl_net_ofi_gpu_init(void); | ||
|
||
/* | ||
* @brief Gets the device associated with the buffer | ||
* | ||
* @param data | ||
* Pointer to GPU buffer. | ||
* | ||
* @return Valid GPU device ID on success | ||
* -1 on error | ||
* @return 0 on success | ||
* -EINVAL on error | ||
*/ | ||
int nccl_net_ofi_get_cuda_device_for_addr(void *data, int *dev_id); | ||
|
||
/* | ||
* @brief wraps cudaFlushGPUDirectRDMAWrites() with default args. | ||
* @return 0 on success | ||
* -1 on error | ||
*/ | ||
int nccl_net_ofi_gpu_flush_gpudirect_rdma_writes(void); | ||
|
||
/* | ||
* @brief wraps cudaGetDevice() | ||
* @return 0 on success | ||
* -1 on error | ||
*/ | ||
int nccl_net_ofi_cuda_get_num_devices(void); | ||
|
||
/* | ||
* @brief query CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED | ||
* @return true if attr is fetched successfully and true. | ||
* false otherwise. | ||
*/ | ||
int nccl_net_ofi_cuda_get_active_device_idx(void); | ||
|
||
bool nccl_net_ofi_cuda_have_dma_buf_attr(void); | ||
bool nccl_net_ofi_cuda_have_gdr_support_attr(void); | ||
|
||
#endif /* NCCL_OFI_ROCM_H_ */ |
This file contains hidden or 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,53 @@ | ||
# -*- autoconf -*- | ||
# | ||
# Copyright (c) 2018-2023 Amazon.com, Inc. or its affiliates. All rights reserved. | ||
# Copyright (c) 2025, Hewlett Packard Enterprise Development LP. | ||
# Copyright (c) 2025, Advanced Micro Devices, Inc. All rights reserved | ||
# | ||
# | ||
# See LICENSE.txt for license information | ||
# | ||
|
||
AC_DEFUN([CHECK_PKG_ROCM], [ | ||
check_pkg_found="yes" | ||
check_pkg_CPPFLAGS_save="${CPPFLAGS}" | ||
check_pkg_LDFLAGS_save="${LDFLAGS}" | ||
check_pkg_LIBS_save="${LIBS}" | ||
AC_ARG_WITH([rocm], | ||
[AS_HELP_STRING([--with-rocm=PATH], [Path to non-standard ROCm installation])]) | ||
AS_IF([test -z "${with-rocm}" -o "{with_rocm}" = "yes"], | ||
[], | ||
[test "${with_rocm}" = "no"], | ||
[check_pkg_found=no], | ||
[AS_IF([test -d ${with_rocm}/lib64], [check_pkg_libdir="lib64"], [check_pkg_libdir="lib"]) | ||
CPPFLAGS="-I${with_rocm}/include ${CPPFLAGS}" | ||
LDFLAGS="-L${with_rocm}/${check_pkg_libdir} ${LDFLAGS}"]) | ||
AS_IF([test "${check_pkg_found}" = "yes"], | ||
[AC_CHECK_LIB([amdhip64], [hipMemAllocHost], [], [check_pkg_found=no])]) | ||
AS_IF([test "${check_pkg_found}" = "yes"], | ||
[AC_CHECK_HEADERS([hip/hip_runtime_api.h], [], [check_pkg_found=no], [#define __HIP_PLATFORM_AMD__])]) | ||
AS_IF([test "${check_pkg_found}" = "yes"], | ||
[check_pkg_define="yes"], | ||
[check_pkg_define="no" | ||
CPPFLAGS="${check_pkg_CPPFLAGS_save}" | ||
LDFLAGS="${check_pkg_LDFLAGS_save}" | ||
LIBS="${check_pkg_LIBS_save}" | ||
]) | ||
AS_IF([test -n "${with_rocm}"], | ||
[AS_IF([test "${check_pkg_define}" = "yes"], | ||
[$1], [$2] ) | ||
], [$2] | ||
) | ||
AS_UNSET([check_pkg_found]) | ||
AS_UNSET([check_pkg_define]) | ||
AS_UNSET([check_pkg_CPPFLAGS_save]) | ||
AS_UNSET([check_pkg_LDFLAGS_save]) | ||
AS_UNSET([check_pkg_LIBS_save]) | ||
]) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of renaming some, but not all, of the functions. We should figure out a plan and keep one or the other pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Leaving everything as "cuda" would surely eliminate having to have tons of shims everywhere, but I also see the benefit in having a generic "gpu" layer. Do you have any preference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd just make them all nccl_net_ofi_gpu_*() for now, in both the cuda and rocm interfaces. THis is a place we should clean up later, but not now.