allow all three backends to co-exist in a single build (#270)

* add support for compiling all backends

also include the logic to select backends either based on user requests
or through some heuristics

* checkpoint for compiling all backends

* final checkpoint

all tests seem to pass when compiling all three backends simultaneasly
and forcing to use any of the three Backends.

* update PR to new envvar system

[ROCm/rocshmem commit: a1269e3db5]
This commit is contained in:
Edgar Gabriel
2025-10-07 10:49:20 -05:00
committad av GitHub
förälder 4b80581422
incheckning 192c549d40
22 ändrade filer med 353 tillägg och 47 borttagningar
+34 -1
Visa fil
@@ -50,7 +50,7 @@ rocshmem_team_t get_external_team(GDATeam *team) {
return reinterpret_cast<rocshmem_team_t>(team);
}
int get_ls_non_zero_bit(char *bitmask, int mask_length) {
static int get_ls_non_zero_bit(char *bitmask, int mask_length) {
int position{-1};
for (int bit_i = 0; bit_i < mask_length; bit_i++) {
int byte_i = bit_i / CHAR_BIT;
@@ -543,6 +543,39 @@ int GDABackend::mlx5_dv_dl_init () {
return ROCSHMEM_SUCCESS;
}
/* Currently we only check whether we can dlopen a Direct Verbs library.
** We might need to extend this logic to check whether we have interfaces that
** can use those DV libraries
*/
int GDABackend::backend_can_run() {
void *handle{nullptr};
/* Try opening bnxt DV libraries */
handle = dlopen("libbnxt_re.so", RTLD_NOW);
if (handle) {
dlclose(handle);
return ROCSHMEM_SUCCESS;
} else {
/* Try hard-coded PATH */
handle = dlopen("/usr/local/lib/libbnxt_re.so", RTLD_NOW);
if (handle) {
dlclose(handle);
return ROCSHMEM_SUCCESS;
}
}
/* Try opening mlx5 DV libraries */
handle = dlopen("libmlx5.so", RTLD_NOW);
if (handle) {
dlclose(handle);
return ROCSHMEM_SUCCESS;
}
/* ToDo: opening ionic DV libraries */
return ROCSHMEM_ERROR;
}
void GDABackend::setup_ibv() {
autodetect_dv_libs();