Diff Coverage

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

Source File Diff Coverage (%) Missing Lines
hyper_parallel/compile/pass_config.py 90.6% 446-447,449,750,797
hyper_parallel/compile/passes/activation_checkpoint.py 95.0% 407,412
hyper_parallel/compile/pass_config.py
442
443
444
445
446
447
448
449
450
451
452
453
        if not save_regions:
            return
        if self.ac_layer_indices is not None:
            allowed = set(self.ac_layer_indices)
        elif self.ac_layer_count is not None:
            allowed = set(range(self.ac_layer_count))
        else:
            return
        for module_path, layer_indices in save_regions:
            outside = sorted(set(layer_indices) - allowed)
            if outside:
                raise ValueError(
746
747
748
749
750
751
752
753
754
        else:
            ac_layer_indices = _full_recompute_layer_indices(full_config)
            ac_save_regions = _full_save_regions(full_config)
            if getattr(full_config, "swap_regions", ()):
                _LOG.warning(
                    "activation_checkpoint.full.exclude_region.swap is not "
                    "supported in graph mode yet; swap targets will be ignored."
                )
    if ac_mode in ("selective", "hybrid"):
793
794
795
796
797
798
799
800
801
    full_config: Any,
) -> Optional[List[Tuple[str, List[int]]]]:
    """Read ``full.exclude_region.save`` as graph-mode save-exclusion regions."""
    if full_config is None:
        return None
    save_regions = [
        (region.module_path, list(region.layers))
        for region in getattr(full_config, "save_regions", ())
    ]
hyper_parallel/compile/passes/activation_checkpoint.py
403
404
405
406
407
408
409
410
411
412
413
414
415
416
        return frozenset()
    for module_path, layer_indices in pass_config.ac_save_regions:
        for layer_index in layer_indices:
            if layer_index >= len(blocks):
                raise ValueError(
                    "activation checkpoint save-exclusion layer index "
                    f"{layer_index} exceeds the maximum index {len(blocks) - 1}"
                )
            if blocks[layer_index].fqn not in full_region:
                raise ValueError(
                    "activation checkpoint save-exclusion module "
                    f"{module_path!r} on layer {layer_index} is outside the "
                    "full recompute layer selection"
                )