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 90.9% 41,65,69,135
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)
61
62
63
64
65
66
67
68
69
70
71
72
73
            module = None
            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, OSError, RuntimeError) as error:
                if module is not None and sys.modules.get(_MS_EXTENSION_NAME) is module:
                    sys.modules.pop(_MS_EXTENSION_NAME, None)
                load_errors.append(f"{library_path}: {error}")
131
132
133
134
135
136
137
138
        "No compatible prebuilt extension could be loaded. For a source/PYTHONPATH checkout, run "
        "`./build.sh --multicore off --shmem off --custom-ops on`."
    ) 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."
    )