NVIDIA / NVIDIA/TransformerEngine

Increase MAX_TENSOR_NUM

Open Beginner friendly
#2,189 7 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
3.5k
Forks
831
Avg merge
3d 11h
Merged PRs (30d)
65

Description

The original setting in transformer_engine/common/transformer_engine.cpp is:

const size_t MAX_TENSOR_NUM = 20 * 1024 * 1024 / sizeof(Tensor);

When I used TransformerEngine for LoRA fine-tuning Qwen3-Next, which has many experts (512+1), I encountered this error:

transformer_engine.cpp:249 in function Allocate: Cannot allocate a new NVTETensor. Maximum number of tensors reached: 81920. There is probably a memory leak in your application.

We may need to increase this hard-coded limit.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in transformer_engine/common/transformer_engine.cpp and inspect the MAX_TENSOR_NUM constant and the Allocate path that reports the limit. Reproduce or validate against the reported LoRA fine-tuning workload for Qwen3-Next, then confirm that the new limit avoids the maximum-tensor error without introducing a new allocation failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.