|
| 1 | +# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES |
| 2 | +# Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 3 | +# SPDX-License-Identifier: Apache-2.0 |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +from typing import Literal, Optional |
| 18 | + |
| 19 | +from cloudai.core import DockerImage, Installable |
| 20 | +from cloudai.models.workload import CmdArgs, TestDefinition |
| 21 | + |
| 22 | + |
| 23 | +class DeepEPCmdArgs(CmdArgs): |
| 24 | + """DeepEP benchmark command arguments.""" |
| 25 | + |
| 26 | + docker_image_url: str |
| 27 | + mode: Literal["standard", "low_latency"] = "standard" |
| 28 | + tokens: int = 1024 |
| 29 | + num_experts: int = 256 |
| 30 | + num_topk: int = 8 |
| 31 | + hidden_size: int = 7168 |
| 32 | + data_type: Literal["bfloat16", "fp8"] = "bfloat16" |
| 33 | + allow_nvlink_for_low_latency: bool = False |
| 34 | + allow_mnnvl: bool = False |
| 35 | + round_scale: bool = False |
| 36 | + use_ue8m0: bool = False |
| 37 | + num_warmups: int = 20 |
| 38 | + num_iterations: int = 50 |
| 39 | + shuffle_columns: bool = False |
| 40 | + use_kineto_profiler: bool = False |
| 41 | + num_sms: int = 24 |
| 42 | + num_qps_per_rank: int = 12 |
| 43 | + config_file_path: str = "/tmp/config.yaml" |
| 44 | + results_dir: str = "/workspace/dp-benchmark/results" |
| 45 | + |
| 46 | + |
| 47 | +class DeepEPTestDefinition(TestDefinition): |
| 48 | + """Test object for DeepEP MoE benchmark.""" |
| 49 | + |
| 50 | + cmd_args: DeepEPCmdArgs |
| 51 | + _docker_image: Optional[DockerImage] = None |
| 52 | + |
| 53 | + @property |
| 54 | + def docker_image(self) -> DockerImage: |
| 55 | + if not self._docker_image: |
| 56 | + if not self.cmd_args.docker_image_url: |
| 57 | + raise ValueError("docker_image_url is required for DeepEP benchmark") |
| 58 | + self._docker_image = DockerImage(url=self.cmd_args.docker_image_url) |
| 59 | + return self._docker_image |
| 60 | + |
| 61 | + @property |
| 62 | + def installables(self) -> list[Installable]: |
| 63 | + return [self.docker_image] |
| 64 | + |
| 65 | + @property |
| 66 | + def cmd_args_dict(self) -> dict: |
| 67 | + """Return command arguments as dict, excluding CloudAI-specific fields.""" |
| 68 | + return self.cmd_args.model_dump( |
| 69 | + exclude={ |
| 70 | + "docker_image_url", |
| 71 | + "mode", |
| 72 | + "num_sms", |
| 73 | + "num_qps_per_rank", |
| 74 | + "config_file_path", |
| 75 | + "results_dir", |
| 76 | + } |
| 77 | + ) |
0 commit comments