hlsfactory.harp._programl_compat¶
Compatibility shims for the pinned programl release used by HARP.
programl 0.3.2 is the latest published release and predates several
dependency changes. Importing and using it on a modern stack needs four
adjustments, all applied by load_programl():
Its generated
*_pb2.pymodules were built with protoc < 3.19 and are rejected by modern protobuf unless the pure-Python implementation is used.programl.transform_opsimportsdglunconditionally to provideto_dgl, which HARP never calls. A realdgldrags intorchplus alibgraphboltbuilt for one exact torch version, so a stub is injected instead.programl.to_networkxcallsnode_link_graphwithout naming the edges key. networkx >= 3.4 changed that default fromlinkstoedgeswhile programl still emitslinks, soprogram_graph_to_networkx()does the conversion explicitly rather than pinning networkx.The bundled
llvm2graph-10binary needslibtinfo.so.5. That is an environment prerequisite and cannot be fixed from Python; seecheck_programl_runtime().
Module Contents¶
Functions¶
Import and return the programl module with all shims applied. |
|
Convert a ProGraML ProgramGraph to a networkx MultiDiGraph. |
|
Verify that the bundled ProGraML binary can actually run. |
Data¶
API¶
- hlsfactory.harp._programl_compat.PROTOBUF_IMPL_ENV_VAR = 'PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'¶
- hlsfactory.harp._programl_compat._INSTALL_HINT = <Multiline-String>¶
- hlsfactory.harp._programl_compat.load_programl() Any[source]¶
Import and return the programl module with all shims applied.
- Returns:
Any: The imported programl module.
- Raises:
ImportError: If programl or networkx is not installed.
- hlsfactory.harp._programl_compat.program_graph_to_networkx(program_graph: Any) Any[source]¶
Convert a ProGraML ProgramGraph to a networkx MultiDiGraph.
Replaces programl.to_networkx, which breaks on networkx >= 3.4.
- Args:
program_graph (Any): A ProGraML ProgramGraph.
- Returns:
Any: The graph as a networkx MultiDiGraph.
- hlsfactory.harp._programl_compat.check_programl_runtime() None[source]¶
Verify that the bundled ProGraML binary can actually run.
The llvm2graph binaries link against libtinfo.so.5, which modern distributions no longer ship. Failing here gives a clearer message than the GraphCreationError raised on first use.
- Raises:
RuntimeError: If the bundled binary cannot be executed.