Skip to content

fix(module): preserve tied parameters during conversion - #268

Open
superme1one wants to merge 2 commits into
InfiniTensor:masterfrom
superme1one:fix/preserve-shared-module-storage
Open

superme1one wants to merge 2 commits into
InfiniTensor:masterfrom
superme1one:fix/preserve-shared-module-storage

Conversation

@superme1one

@superme1one superme1one commented Nov 16, 2026 •

Copy link
Copy Markdown

Summary

Preserve shared parameter and buffer identity during device or dtype conversion using one memo and visited-module set per conversion.

Motivation

Converting submodules independently breaks tied parameters and can update one logical weight twice. Closes #236.

Type of Change

fix; no public API removal.

Platforms Affected

CPU and CUDA module conversion.

Smoke Test Result

Device/dtype conversion, no-op conversion, repeated child modules, null registrations, gradient accumulation, deduplicated parameters, an SGD update, and disk checkpoint/Adam resume passed. Shared embedding/head identity remained intact in the 10,240-step GPT-2 runs.

The combined candidate stack passed 228 CPU tests (3 skips) and 229 Iluvatar GPU tests (2 CPU-only death checks skipped), with no failures. Coverage includes optimizer state, shared parameters, autograd and checkpoint round trips. The GPU build uses CoreX 4.3.0.20250624 with a separately recorded compatibility layer. NVIDIA execution and hosted CI are pending.

Test Results on Supported Platforms

Validated on the platforms listed above. Local formatting and patch-application checks passed. Hosted CI is tracked separately from the recorded target-platform tests. Affected backends not available in this session require their normal CI/owner checks.

Benchmark / Performance Impact

Correctness fix; no performance gain claimed.

Notes for Reviewers

Base: InfiniTensor/InfiniTrain@e19a56dcb56bec11f1af63c089a1e8ae03ff24c7. Verification date: 2026-11-16. Detailed test inputs, source hashes and logs are retained in the separate validation package; performance reports are excluded from the source patch.

Closes #236.

CI approval status at submission

The upstream pull-request workflows are action_required and have not scheduled jobs. A repository maintainer needs to approve the runs. Target-platform tests are recorded above. This repository did not automatically run checks for the feature-branch push. Local formatting and target-platform results are recorded above. Backend tests requiring upstream infrastructure remain pending.

Validation after include cleanup

Added the direct standard-library and tensor/device/type includes used by the shared-migration regression. Calculation behavior is unchanged.

  • Commit: 09a80ef8255e3d2a3e6fa01099de5013c50011ec.
  • Clean CPU Release build on the Iluvatar server: 48 passed (module and checkpoint suites).
  • Full, unchanged fork workflows passed: Format Check, IWYU, clang-tidy.
  • The new upstream workflows are awaiting maintainer approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Module::To 在设备或数据类型转换时破坏跨子模块的共享参数关系

1 participant