Skip to content

[BUG][fusion] Fused ExLlamaV2 projections keep the unfused packed weights alive via _q_fast #4240

Closed

Description

@Qubitium

Severity: medium–low (duplicate packed memory for every fused qkv / gate_up group)
Status: likely. The repo test fails and the retaining reference has been identified.
Version: 7.11.0 @ 9dad249

Summary

  • nn_modules/qlinear/exllamav2.py:~282 sets self._q_fast = (tensors, signatures), holding strong references to qweight / qzeros / scales / g_idx / q_perm / q_invperm.
  • _FusionGroup.install (models/fusion.py:~600-640) keeps the original modules in self.modules but never clears their _q_fast / q_tensors, so the original allocations survive fusion.

Evidence:

  • tests/module_tree/test_fusion_kernel_backends.py::test_native_fusion_shapes_oracle_ownership_and_invalidation[{gate_up,qkv_gqa}-cuda-ExllamaV2Linear-*] fails with "Original native weight allocations were retained".
  • gc.get_referrers on the surviving qweight shows the _q_fast 6-tuple.

Expected

Drop _q_fast (and stale q_tensors entries) when a module becomes a fusion view.

Related: #3983 (introduced _q_fast).


Found during an AI-assisted review (Claude Code) of 9dad249; repros were run on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions