Skip to content

Commit f3da691

Browse files
viv-ethviv-eth
andauthored
[NetworkDeployer] Node Mangling to avoid duplication (#93)
* [NetworkDeployer] Mangle these n...odes * [DeeployTypes] Only mangle on duplicates * Update changelog --------- Co-authored-by: viv-eth <[email protected]>
1 parent 9ef3217 commit f3da691

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ This file contains the changelog for the Deeploy project. The changelog is divid
33

44
## Unreleased (Planned Release Target: v0.2.1)
55
### List of Pull Requests
6+
- Node Mangling to avoid duplication [#93](https://github.com/pulp-platform/Deeploy/pull/93)
67
- Prepare Post v0.2.0 Release [#104](https://github.com/pulp-platform/Deeploy/pull/104)
78
- Use Docker digests instead of arch-specific tags [#106](https://github.com/pulp-platform/Deeploy/pull/106)
89

910
### Added
11+
- Added `_mangleNodeNames` function to avoid duplicate node mappings
1012
- Output Docker image digests per platform (`amd64`, `arm64`) after build, which is used to construct the multi-arch Docker manifest. This preventes registry clutter caused by unnecessary per-architecture Docker tags.
1113

1214
### Changed
1315
- Replaced platform-specific tags (`*-amd64`, `*-arm64`) with direct digest references in `Noelware/docker-manifest-action`.
1416

1517
### Fixed
18+
- Prevent node duplication for graphs generated via GraphSurgeon
1619
- Resolved issue with missing `id` in the `Build Cache for Docker` step, used in the `Inject build-cache` step.
1720

1821
### Removed

Deeploy/DeeployTypes.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3303,6 +3303,24 @@ def _mangleTensorNames(self):
33033303
for tensor in self.graph.tensors().values():
33043304
tensor.name = f"{tensor.name}_tensor"
33053305

3306+
# Don't override this
3307+
def _mangleNodeNames(self):
3308+
"""Mangle node names only if duplicates exist. Unique names are preserved."""
3309+
# Count occurrences of each original name
3310+
counts: Dict[str, int] = {}
3311+
for node in self.graph.nodes:
3312+
counts[node.name] = counts.get(node.name, 0) + 1
3313+
3314+
# For any name that appears more than once, append a counter suffix
3315+
seen: Dict[str, int] = {}
3316+
for node in self.graph.nodes:
3317+
orig = node.name
3318+
if counts[orig] > 1:
3319+
idx = seen.get(orig, 0)
3320+
node.name = f"{orig}_{idx}"
3321+
seen[orig] = idx + 1
3322+
# else: unique name, leave it unchanged
3323+
33063324
# Don't override this
33073325
def _removeIdentityNodes(self):
33083326
for node in filter(lambda x: x.op == "Identity", self.graph.nodes):
@@ -3316,6 +3334,8 @@ def frontEnd(self):
33163334

33173335
self._mangleTensorNames()
33183336

3337+
self._mangleNodeNames()
3338+
33193339
# Rename graph inputs and outputs:
33203340
for idx, inputNode in enumerate(self.graph.inputs):
33213341
inputNode.name = "input_" + str(idx)

0 commit comments

Comments
 (0)