Diff Coverage

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

Source File Diff Coverage (%) Missing Lines
hyper_parallel/platform/mindspore/custom_ops/custom_op_impl.py 85.7% 41,64,66-68,133
hyper_parallel/platform/mindspore/custom_ops/custom_op_impl.py
37
38
39
40
41
42
43
44
45
    module_path = Path(__file__).resolve()
    repository_root = module_path.parents[4]
    search_paths = []
    if (repository_root / "setup.py").is_file():
        search_paths.append(str(
            repository_root / "build" / "native" / "payload" / "hyper_parallel"
            / "platform" / "mindspore" / "custom_ops" / "lib"
        ))
    search_paths.append(_BUILD_LIB)
60
61
62
63
64
65
66
67
68
69
70
71
72
                continue
            try:
                spec = util.spec_from_file_location(_MS_EXTENSION_NAME, library_path)
                if spec is None or spec.loader is None:
                    raise ImportError(f"Cannot create an extension loader for {library_path}")
                module = util.module_from_spec(spec)
                sys.modules[_MS_EXTENSION_NAME] = module
                spec.loader.exec_module(module)
                return module
            except ImportError as error:
                sys.modules.pop(_MS_EXTENSION_NAME, None)
                load_errors.append(f"{library_path}: {error}")
    details = "; ".join(load_errors) if load_errors else "no prebuilt extension file was found"
129
130
131
132
133
134
135
136
        "No compatible prebuilt extension could be loaded. For a source/PYTHONPATH checkout, run "
        "`./build.sh --multicore off --shmem off --custom-ops mindspore`."
    ) from error
if not hasattr(_custom_ops, "npu_mhc_pre_clamp_sinkhorn"):
    raise ImportError(
        "[HP-NATIVE-INCOMPATIBLE] component=custom_ops framework=mindspore. "
        "The prebuilt extension is stale or was built for a different HyperParallel source revision."
    )