Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
TransformerEngine
Commits
ffbef335
Commit
ffbef335
authored
Jun 19, 2025
by
yuguo
Browse files
[DCU] fix TORCH_COMM_CU_NUMS conflicts in 2.5
parent
067c2b3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
transformer_engine/common/util/multi_stream.cpp
transformer_engine/common/util/multi_stream.cpp
+35
-0
No files found.
transformer_engine/common/util/multi_stream.cpp
View file @
ffbef335
...
...
@@ -27,8 +27,43 @@ cudaStream_t get_compute_stream(int idx) {
static
std
::
vector
<
cudaStream_t
>
streams
(
num_streams
);
static
std
::
once_flag
stream_init_flag
;
auto
init
=
[
&
]()
{
int
comm_cu_nums
=
getIntEnv
(
"TORCH_COMM_CU_NUMS"
,
8
,
4
);
unsigned
int
cuMask
[
4
];
unsigned
int
cuMaskSize
=
4
;
if
(
comm_cu_nums
==
4
)
{
cuMask
[
0
]
=
0xfffffff0
;
cuMask
[
1
]
=
0xffffffff
;
cuMask
[
2
]
=
0xffffffff
;
cuMask
[
3
]
=
0xffffffff
;
}
else
if
(
comm_cu_nums
==
8
)
{
cuMask
[
0
]
=
0xffffff00
;
cuMask
[
1
]
=
0xffffffff
;
cuMask
[
2
]
=
0xffffffff
;
cuMask
[
3
]
=
0xffffffff
;
}
else
if
(
comm_cu_nums
==
16
)
{
cuMask
[
0
]
=
0xffff0000
;
cuMask
[
1
]
=
0xffffffff
;
cuMask
[
2
]
=
0xffffffff
;
cuMask
[
3
]
=
0xffffffff
;
}
else
if
(
comm_cu_nums
==
32
)
{
cuMask
[
0
]
=
0x00000000
;
cuMask
[
1
]
=
0xffffffff
;
cuMask
[
2
]
=
0xffffffff
;
cuMask
[
3
]
=
0xffffffff
;
}
else
{
NVTE_CHECK
(
false
,
"comm_cu_nums must be 4,8,16,32"
);
}
const
char
*
TORCH_COMM_CU_NUMS
=
std
::
getenv
(
"TORCH_COMM_CU_NUMS"
);
for
(
size_t
i
=
0
;
i
<
num_streams
;
i
++
)
{
#ifdef __HIP_PLATFORM_AMD__
if
(
TORCH_COMM_CU_NUMS
!=
nullptr
&&
TORCH_COMM_CU_NUMS
[
0
]
!=
'\0'
)
{
NVTE_CHECK_CUDA
(
hipExtStreamCreateWithCUMask
(
&
streams
[
i
],
cuMaskSize
,
cuMask
));
}
else
{
NVTE_CHECK_CUDA
(
cudaStreamCreateWithPriority
(
&
streams
[
i
],
cudaStreamNonBlocking
,
-
1
));
}
#else
NVTE_CHECK_CUDA
(
cudaStreamCreateWithPriority
(
&
streams
[
i
],
cudaStreamNonBlocking
,
-
1
));
#endif
}
};
std
::
call_once
(
stream_init_flag
,
init
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment