Skip to content

Commit 2aac1f5

Browse files
authored
[executorch][native] Derive method names from the packaged graph
Differential Revision: D116838284 Pull Request resolved: pytorch#22006
1 parent 549ba1c commit 2aac1f5

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎exir/native/README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ deliberately, so the two pipelines read alike.
7979
| `methods` | Names of the methods in the program. |
8080
| `save(path)` | Write the program and its constants to `path` as a `.ptn`. |
8181

82+
The constructor takes the graph blob and the constants, and nothing else. Method
83+
names and the package's mutable-buffer set are read back out of the blob on demand
84+
rather than passed alongside it, so a manager cannot describe a package it does not
85+
hold.
86+
8287
The surface is intentionally small. TODO: add `buffer`, `exported_program`,
8388
`write_to_file`, and debug-map access only when concrete callers establish the
8489
required contracts; these additions can remain additive.

‎exir/native/native.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class NativeProgramManager:
3030
deliberately, so the two pipelines read alike. The surface is intentionally
3131
small, we will expand this later.
3232
33+
The graph blob is the only source of truth: method names and package-wide
34+
mutability are read back out of it on demand rather than carried alongside,
35+
so a manager cannot describe a package it does not hold.
36+
3337
Constants are held as tensor references returned by lowering. ``save`` may
3438
normalize device or layout before writing them.
3539
"""
@@ -38,7 +42,6 @@ def __init__(
3842
self,
3943
ptg: bytes,
4044
constants: dict[str, torch.Tensor],
41-
methods: set[str],
4245
) -> None:
4346
# TODO add args help
4447
raise NotImplementedError

0 commit comments

Comments
 (0)