Skip to content

Commit bc70782

Browse files
committed
upadte
1 parent cf35099 commit bc70782

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

python/mscclpp_benchmark/bench_collective.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ class DTypeSpec:
6969
cupy_dtype: Any
7070
mscclpp_dtype: Any
7171
accum_dtype: Any | None = None
72-
accum_name: str | None = None
7372
fp8_format: str | None = None
7473

7574

@@ -126,7 +125,6 @@ def _parse_dtype(dtype_name: str) -> DTypeSpec:
126125
cp.uint8,
127126
mscclpp.DataType.float8_e4m3fn,
128127
accum_dtype=mscclpp.DataType.float16,
129-
accum_name="float16",
130128
fp8_format="e4m3fn",
131129
)
132130
if normalized in {"float8_e4m3fnuz", "fp8_e4m3fnuz"}:
@@ -135,7 +133,6 @@ def _parse_dtype(dtype_name: str) -> DTypeSpec:
135133
cp.uint8,
136134
mscclpp.DataType.float8_e4m3fnuz,
137135
accum_dtype=mscclpp.DataType.float16,
138-
accum_name="float16",
139136
fp8_format="e4m3fnuz",
140137
)
141138
if normalized in {"float8_e4m3b15", "fp8_e4m3b15"}:
@@ -144,7 +141,6 @@ def _parse_dtype(dtype_name: str) -> DTypeSpec:
144141
cp.uint8,
145142
mscclpp.DataType.float8_e4m3b15,
146143
accum_dtype=mscclpp.DataType.float32,
147-
accum_name="float32",
148144
fp8_format="e4m3b15",
149145
)
150146
raise ValueError(
@@ -161,13 +157,10 @@ def _with_accum_type(dtype_spec: DTypeSpec, accum_type: str | None) -> DTypeSpec
161157
normalized = accum_type.strip().lower().replace("-", "_")
162158
if normalized in {"native", "same", "auto"}:
163159
accum_dtype = dtype_spec.mscclpp_dtype
164-
accum_name = dtype_spec.name
165160
elif normalized in {"float16", "fp16", "half"}:
166161
accum_dtype = mscclpp.DataType.float16
167-
accum_name = "float16"
168162
elif normalized in {"float32", "fp32", "float"}:
169163
accum_dtype = mscclpp.DataType.float32
170-
accum_name = "float32"
171164
else:
172165
raise ValueError(f"Unsupported accum type {accum_type!r}; use native, float16, or float32")
173166

@@ -176,11 +169,21 @@ def _with_accum_type(dtype_spec: DTypeSpec, accum_type: str | None) -> DTypeSpec
176169
cupy_dtype=dtype_spec.cupy_dtype,
177170
mscclpp_dtype=dtype_spec.mscclpp_dtype,
178171
accum_dtype=accum_dtype,
179-
accum_name=accum_name,
180172
fp8_format=dtype_spec.fp8_format,
181173
)
182174

183175

176+
def _accum_dtype_name(dtype_spec: DTypeSpec) -> str:
177+
accum_dtype = dtype_spec.accum_dtype
178+
if accum_dtype is None or accum_dtype == dtype_spec.mscclpp_dtype:
179+
return dtype_spec.name
180+
if accum_dtype == _mscclpp().DataType.float16:
181+
return "float16"
182+
if accum_dtype == _mscclpp().DataType.float32:
183+
return "float32"
184+
raise ValueError(f"Unsupported accumulation data type: {accum_dtype}")
185+
186+
184187
def _human_size(size: int) -> str:
185188
value = float(size)
186189
for unit in ("B", "KiB", "MiB", "GiB", "TiB"):
@@ -590,7 +593,7 @@ def main(argv: list[str] | None = None) -> None:
590593
continue
591594
if args.autotune:
592595
dtype = dtype_spec.name if args.collective == _ALLREDUCE else None
593-
accum = (dtype_spec.accum_name or dtype_spec.name) if dtype is not None else None
596+
accum = _accum_dtype_name(dtype_spec) if dtype is not None else None
594597
config_store.upsert(
595598
hardware_profile,
596599
args.collective,

0 commit comments

Comments
 (0)