Skip to content

[NR UE] PDSCH Rx: Replace per slot heap allocation of memory buffers with one-time allocation at init and other memory optimizations#234

Open
rupanjali-ux wants to merge 3 commits into
developfrom
oai_ue_mem_opt_v1
Open

[NR UE] PDSCH Rx: Replace per slot heap allocation of memory buffers with one-time allocation at init and other memory optimizations#234
rupanjali-ux wants to merge 3 commits into
developfrom
oai_ue_mem_opt_v1

Conversation

@rupanjali-ux

Copy link
Copy Markdown
Collaborator

Performs memory optimization to speed up OAI UE.

  1. Replace per slot memory allocation and free of buffers dl_ch_mag/b/r, rho_dl, rxdataF_comp and pdsch_dl_ch_estimates with one-time allocation at init and free at teardown.
  2. Reduce layer_llr buffer from NR_SYMBOLS_PER_SLOT to single symbol. By moving nr_dlsch_layer_demapping() inside the symbol loop immediately after nr_dlsch_llr(), the buffer is reduced to a single symbol at a time.
  3. Remove unnecessary memset on buffers as they are immediately written afterwards before being read.

Move six PDSCH RX buffers (rxdataF, rxdataF_comp, dl_ch_estimates, dl_ch_mag/magb/magr, rho_dl) from per-slot heap allocations (allocCast*) and a large stack VLA to single worst-case allocations in PHY_VARS_NR_UE, initialized at UE init and freed at teardown.

This eliminates 6 malloc/free pairs per PDSCH slot.

Signed-off-by: Rupanjali <rupanjali.srivastava@openairinterface.org>
…moving the layer demapping function within the symbol loop immediately after LLR function, thus removing the symbol loop within the demapping function

Signed-off-by: Rupanjali <rupanjali.srivastava@openairinterface.org>
Signed-off-by: Rupanjali <rupanjali.srivastava@openairinterface.org>
@durantabot

Copy link
Copy Markdown
Collaborator

CI Build: #468 | Not performing CI due to the absence of one of the following mandatory labels:

  • documentation Documentation-related changes or updates. (don't perform any stages)
  • BUILD-ONLY Execute build stages only for code improvements with no impact on 4G/5G functionality. (execute only build stages)
  • 4G-LTE Perform 4G Tests (perform 4G tests)
  • 5G-NR Perform 5G Tests (perform 5G tests)
  • nrUE Run only 5G UE tests (physims included, LDPC tests excluded). (perform only 5G-UE related tests including physims excluding LDPC tests)
  • CI Perform both 4G and 5G tests (perform both 4G and 5G tests)

@rupanjali-ux rupanjali-ux added the 5G-NR Perform 5G Tests label Jun 26, 2026
@rorsc rorsc added nrUE Run only 5G UE tests (physims included, LDPC tests excluded). retrigger-ci Re-run CI and removed 5G-NR Perform 5G Tests labels Jun 26, 2026
@github-actions github-actions Bot removed the retrigger-ci Re-run CI label Jun 26, 2026
@durantabot

Copy link
Copy Markdown
Collaborator

@rorsc

rorsc commented Jun 26, 2026

Copy link
Copy Markdown
Member

I tested this manually (with address sanitizer)

  • I see many of the below error messages, which are not present in develop. They appear when you push a lot of traffic. Please check

    [PHY]    received all 0 pdu (TBS 1480, mcs 0, C 1, nb_rb 43, decodedSegments 1) consider it false reception, even if the TS 38.212 7.2.1 says only we should attach the corresponding CRC, and nothing prevents to have a all 0 packet
    

    that might also be the reason for the instabilities I reported earlier privately, because this limits the throughput

  • you should give a proper PR title

  • your commit messages are not well formatted

    • title ideally not longer than 50 characters. A bit more is ok, but not too much
    • rest should be wrapped at 80 characters
      please fix this.

See also man git commit:

DISCUSSION

Though not required, it’s a good idea to begin the commit message with a single short (no more than 50 characters) line summarizing the change, followed by a blank line and then a more thorough description. The text up to the first blank line in a commit message is treated as the commit title, and that title is used throughout Git. For example, git-format-patch(1) turns a commit into email, and it uses the title on the Subject line and the rest of the commit in the body.

@rupanjali-ux rupanjali-ux changed the title Oai ue mem opt v1 [NR UE] PDSCH Rx: Replace per slot heap allocation of memory buffers with one-time allocation at init and other memory optimizations Jun 26, 2026
@bpodrygajlo

Copy link
Copy Markdown
Collaborator

The fundamental flaw in this MR is that it assumes only one slot is being decoded at a time - this is not true - each of the UE DL actors (4 default) can run in parallel and with this change will write in parallel to the same memory. In current design, you would have to allocate one such array per DL actor. In general I think the actor idea is flawed and the DL decoding should execute on the threadpool (it is faster and scales better). Regardless of that if you want to continue with your idea, whether the final shape of the threading model in UE will change or stay like it is now, you need to provide a "context" structure to main DL function that will pick out the correct pre-allocated structure. Right now you would pick based on actor index, but maybe in the future if the DL decoding executes on threadpool it will be something else. You can see the DL Actor usage if you search for get_nrUE_params()->num_dl_actors

@rupanjali-ux

Copy link
Copy Markdown
Collaborator Author

@bpodrygajlo Thanks for the detailed feedback and for explaining the design context. This provides valuable insight. I will go through the code in more detail to better understand the current implementation and evaluate how memory pre-allocation can be structured in the context of the DL actor/thread pool architecture.

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

Labels

nrUE Run only 5G UE tests (physims included, LDPC tests excluded).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants