Skip to content

Conversation

@bisingha-xilinx
Copy link
Contributor

@bisingha-xilinx bisingha-xilinx commented Jan 7, 2026

Problem and Fix for https://jira.xilinx.com/browse/AIESW-21501:

Buffer Object (BO) import time was scaling linearly O(n) with buffer size,
causing significant latency in VART applications. Import time increased
from ~250μs for 1.5MB buffers to ~2900μs for 24MB buffers.

Root Cause:

In amdxdna_gem_shmem_insert_pages(), after calling dma_buf_mmap() for
imported buffers, a per-page handle_mm_fault() loop was executed to fault
in each page. For CMA buffers, this is redundant because dma_buf_mmap()
already establishes the complete mapping efficiently.

Solution:

Add a check to detect CMA buffers and skip the
per-page fault loop for them. Non-CMA buffer types retain the existing
behavior for backward compatibility with other platforms.

Results (24MB buffer import):

  • Before: 2908 μs (O(n) - ~0.48 μs/page)
  • After: 24 μs (O(1))
  • Speedup: 121x

Tested:

  1. all the basic XRT hw tests on ve2
  2. bo import latency test. giving expected constant latency O(1) by increasing the bo size. earlier it was O(n).
  3. Also tested the given VART application from https://jira.xilinx.com/browse/AIESW-21501 (I ran the ./x_plus_ml_vart_old). With this fix, there is an overall latency improvement from "Inference thread 0 average time : 7.35578 ms" to "Inference thread 0 average time : 5.86632 ms".

Copilot AI review requested due to automatic review settings January 7, 2026 10:29

This comment was marked as resolved.

This comment was marked as resolved.

Bikash Singha added 3 commits January 8, 2026 10:51
Signed-off-by: Bikash Singha <bisingha@xcobisingha50x.amd.com>
Signed-off-by: Bikash Singha <bisingha@xcobisingha50x.amd.com>
Signed-off-by: Bikash Singha <bisingha@xcobisingha50x.amd.com>

This comment was marked as resolved.

This comment was marked as resolved.

@chvamshi-xilinx chvamshi-xilinx merged commit 1db16e4 into amd:main Jan 8, 2026
1 check passed
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.

3 participants