Diff Coverage

Diff: origin/master...HEAD, staged and unstaged changes

Source File Diff Coverage (%) Missing Lines
hyper_parallel/auto_parallel/sapp_nd/memory_estimation/_context.py 100%  
hyper_parallel/auto_parallel/sapp_nd/memory_estimation/_hook_manager.py 40.0% 163-164,166
hyper_parallel/auto_parallel/sapp_nd/memory_estimation/evaluators/body.py 100%  
hyper_parallel/auto_parallel/sapp_nd/memory_estimation/evaluators/comm.py 100%  
hyper_parallel/auto_parallel/sapp_nd/memory_estimation/evaluators/head.py 100%  
hyper_parallel/auto_parallel/sapp_nd/memory_estimation/evaluators/tail.py 88.6% 172,174-176
hyper_parallel/auto_parallel/sapp_nd/nd/common/_cost_model_variables.py 100%  
hyper_parallel/auto_parallel/sapp_nd/nd/common/cost_model_preprocess.py 98.2% 227
hyper_parallel/auto_parallel/sapp_nd/nd/common/framework_parsers/_cost_model_parser.py 100%  
hyper_parallel/auto_parallel/sapp_nd/nd/common/framework_parsers/cost_model_parser_hyperparallel.py 87.5% 152
hyper_parallel/auto_parallel/sapp_nd/nd/common/framework_parsers/cost_model_parser_mindformers.py 77.8% 281-282
hyper_parallel/auto_parallel/sapp_nd/nd/common/framework_parsers/cost_model_parser_mindspeed.py 80.0% 272-273
hyper_parallel/auto_parallel/sapp_nd/nd/common/hardware.py 100%  
hyper_parallel/auto_parallel/sapp_nd/nd/debug.py 100%  
hyper_parallel/auto_parallel/sapp_nd/nd/dimensions.py 92.9% 321-322,324-325
hyper_parallel/auto_parallel/sapp_nd/nd/global_config.py 100%  
hyper_parallel/auto_parallel/sapp_nd/nd/parallelize.py 100%  
hyper_parallel/auto_parallel/sapp_nd/perf_estimation/comm_time.py 92.3% 369
hyper_parallel/auto_parallel/sapp_nd/perf_estimation/estimate.py 100%  
hyper_parallel/auto_parallel/sapp_nd/memory_estimation/_hook_manager.py
159
160
161
162
163
164
165
166
167
168
169
170
            dyn_cp_comm = self._ctx.node_eval[target_node].dyn.comm.cp
        if not self.__is_valid_eval_func(dyn_ep_comm):
            dyn_ep_comm = self._ctx.node_eval[target_node].dyn.comm.ep
        if not self.__is_valid_eval_func(dyn_fsdp_comm):
            if target_node in self._ctx.node_eval:
                dyn_fsdp_comm = self._ctx.node_eval[target_node].dyn.comm.fsdp
            else:
                dyn_fsdp_comm = 0
        comm_cls_obj = cls_obj
        if self.is_regular_layer(target_node):
            comm_cls_obj = EvalLayerComm
        return NodeCommEval(
hyper_parallel/auto_parallel/sapp_nd/memory_estimation/evaluators/tail.py
168
169
170
171
172
173
174
175
176
177
178
179
180
            ccfg, ctx
        )
        # HSDP inter-node all-reduce
        if getattr(ccfg, "comm_hsdp", 0) > 0:
            d_replicate = ccfg.d // d_shard
            # Extra MTP params
            param_size = EvalMTP.num_params_mtp(ccfg, ctx)
            sharded = param_size / (d_shard * ccfg.cp * ccfg.t)
            mtp_fsdp_comm += (
                ccfg.comm_hsdp
                / d_replicate
                * ccfg.n_mtp * sharded
            )
hyper_parallel/auto_parallel/sapp_nd/nd/common/cost_model_preprocess.py
223
224
225
226
227
228
229
230
231
            target_ccfg.fsdp = False
            if op and isinstance(op, int) and op <= 1:
                target_ccfg.has_op = False
            elif not op:
                target_ccfg.has_op = False

    def __apply_d_shard_strategy(self, target_ccfg, d_shard_kw):
        """Apply the HSDP d_shard value, defaulting from dp/fsdp."""
        if d_shard_kw is not None and isinstance(d_shard_kw, int):
hyper_parallel/auto_parallel/sapp_nd/nd/common/framework_parsers/cost_model_parser_hyperparallel.py
148
149
150
151
152
153
154
155
156
        self.ccfg.d_shard = d_shard if self.ccfg.fsdp else 1
        if self.ccfg.fsdp:
            self.config_fsdp_shard(self.ccfg)
        else:
            self.config_optimizer_shard(self.ccfg)
        self.config_comm_flag(self.ccfg)
        self.__parse_batch()
        self.__init_shard()
        self.__init_bytes()
hyper_parallel/auto_parallel/sapp_nd/nd/common/framework_parsers/cost_model_parser_mindformers.py
277
278
279
280
281
282
283
284
285
            self.ccfg.op_weight_shard if self.ccfg.op_weight_shard else (self.ccfg.d * self.ccfg.t)
        )
        self.ccfg.fsdp = self.is_fsdp(self.ccfg)
        if self.ccfg.fsdp:
            self.ccfg.d_shard = self.ccfg.d
            self.config_fsdp_shard(self.ccfg)
        else:
            self.ccfg.d_shard = 1
            self.config_optimizer_shard(self.ccfg)
hyper_parallel/auto_parallel/sapp_nd/nd/common/framework_parsers/cost_model_parser_mindspeed.py
268
269
270
271
272
273
274
275
276
        cc.os_max_shard = cc.d * cc.t
        cc.op_weight_shard = cc.os_max_shard if cc.has_op else 0
        cc.fsdp = self.is_fsdp(cc)
        if cc.fsdp:
            cc.d_shard = cc.d
            self.config_fsdp_shard(cc)
        else:
            cc.d_shard = 1
            self.config_optimizer_shard(cc)
hyper_parallel/auto_parallel/sapp_nd/nd/dimensions.py
317
318
319
320
321
322
323
324
325
326
327
328
329
        if d_shard > 1 and not self.dims_val[FSDP]:
            logger.warning("HSDP d_shard > 1 requires FSDP enabled")
            return False
        if d_shard > 1 and self.dims_val[EP] > 1:
            logger.warning("HSDP and EP cannot coexist")
            return False
        if d_shard > 1 and self.dims_val[OP] > 1:
            logger.warning("HSDP and OP cannot coexist (OP > 1)")
            return False
        return True

    def _validate_hsdp_constraints(self):
        """Validate HSDP-related dimension constraints."""
hyper_parallel/auto_parallel/sapp_nd/perf_estimation/comm_time.py
365
366
367
368
369
370
371
372
373



        if param["ccfg"].ttype == PerformanceType.TIME:
            for dim, ov in zip([Dim.DP, Dim.TP, Dim.EP, Dim.CP, Dim.FSDP], [0.9, 0, 0, 0, 0.5]):
                comm[dim] = estimate_comm_score(
                    param["cfg"],
                    comm[dim],
                    dim,