Skip to content

Commit 83fb1d4

Browse files
committed
issue/1021 - feat: support bf16 in infiniccl with mccl
1 parent 718b18c commit 83fb1d4

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/infiniccl/moore/infiniccl_moore.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ inline mcclDataType_t getMcclDtype(infiniDtype_t datatype) {
2323
return mcclFloat;
2424
case INFINI_DTYPE_F16:
2525
return mcclHalf;
26+
case INFINI_DTYPE_BF16:
27+
return mcclBfloat16;
2628
default:
2729
std::abort();
2830
return mcclHalf;
@@ -83,9 +85,7 @@ infiniStatus_t allReduce(
8385
infinicclComm_t comm,
8486
infinirtStream_t stream) {
8587

86-
if (datatype != INFINI_DTYPE_F32 && datatype != INFINI_DTYPE_F16) {
87-
return INFINI_STATUS_BAD_PARAM;
88-
}
88+
CHECK_DTYPE(datatype, INFINI_DTYPE_F32, INFINI_DTYPE_F16, INFINI_DTYPE_BF16);
8989

9090
CHECK_MCCL(mcclAllReduce(sendbuf, recvbuf, count, getMcclDtype(datatype),
9191
getMcclRedOp(op), getMcclComm(comm), getMusaStream(stream)));

xmake/moore.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ rule("mu")
1616
local mcc = MUSA_ROOT .. "/bin/mcc"
1717
local includedirs = table.concat(target:get("includedirs"), " ")
1818

19-
local args = {"-c", sourcefile, "-o", objectfile, "-I" .. MUSA_ROOT .. "/include", "-O3", "-fPIC", "-Wall", "-std=c++17", "-pthread"}
19+
local args = {"--cuda-gpu-arch=mp_31", "-c", sourcefile, "-o", objectfile, "-I" .. MUSA_ROOT .. "/include", "-O3", "-fPIC", "-Wall", "-std=c++17", "-pthread"}
2020
for _, includedir in ipairs(target:get("includedirs")) do
2121
table.insert(args, "-I" .. includedir)
2222
end
@@ -76,6 +76,8 @@ target("infiniccl-moore")
7676
if has_config("ccl") then
7777
add_links("libmccl.so")
7878
add_files("../src/infiniccl/moore/*.cc")
79+
add_defines("MARCH_TYPE=310")
80+
add_cxxflags("-Wno-unused-function")
7981
end
8082
set_languages("cxx17")
8183

0 commit comments

Comments
 (0)