From 05b88927add638a91f6d4e7359899ad041156150 Mon Sep 17 00:00:00 2001 From: Akshay Khalatkar Date: Wed, 6 May 2026 14:44:45 +0530 Subject: [PATCH] fix: redirect cdsprpc stub .so out of deliverable output directory Signed-off-by: Akshay Khalatkar --- DEVELOPMENT-GUIDE.md | 23 +++++++++++++++++++++++ qcperf/backends/qcom-dsp/CMakeLists.txt | 14 +++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/DEVELOPMENT-GUIDE.md b/DEVELOPMENT-GUIDE.md index 4c0bd03..912f6a7 100644 --- a/DEVELOPMENT-GUIDE.md +++ b/DEVELOPMENT-GUIDE.md @@ -187,6 +187,29 @@ The library includes several specialized backend implementations: - All power metrics measured in milliwatts (mW) - Provides average power consumption over sampling period +#### DSP NPU Backend (Linux ARM64) +- Collects performance metrics from the Qualcomm CDSP/NPU hardware via FastRPC +- Provides Q6 utilization, Q6 clock, HVX utilization, and HMX utilization metrics +- Communicates with the DSP using the `sysmonquery` interface over FastRPC + +##### Runtime Dependency: `libcdsprpc.so` + +The DSP NPU backend requires `libcdsprpc.so` to be present on the target device at runtime. This library is part of the Qualcomm BSP (Board Support Package) and provides the FastRPC transport used to communicate with the CDSP. + +> **Note:** `libcdsprpc.so` is **not** built from source — the build system compiles a stub (`cdsprpc_stub.c`) that satisfies the linker at compile time. The real `libcdsprpc.so` must be present on the device at runtime, typically at `/usr/lib/libcdsprpc.so`. + +**What happens if `libcdsprpc.so` is missing:** + +| Scenario | Behavior | +|----------|----------| +| `libcdsprpc.so` absent from device | Dynamic linker fails to load the application — process does not start. No graceful fallback. | +| `libcdsprpc.so` present, but CDSP inaccessible | `qcom_dsp_init()` returns a non-success error code. `dsp_npu_init()` reports the failure via the message callback at `QC_PERF_MESSAGE_LEVEL_ERROR` and returns `QC_PERF_RETURN_CODE_FAILED`. | + +**Recommendation:** Before running an application that uses the DSP NPU backend, verify the library is present on the device: +```bash +ls /usr/lib/libcdsprpc.so +``` + --- ## Adding New Backends diff --git a/qcperf/backends/qcom-dsp/CMakeLists.txt b/qcperf/backends/qcom-dsp/CMakeLists.txt index d8f0860..78f5e13 100644 --- a/qcperf/backends/qcom-dsp/CMakeLists.txt +++ b/qcperf/backends/qcom-dsp/CMakeLists.txt @@ -6,14 +6,22 @@ add_library(QcPerfQcomDsp STATIC add_library(cdsprpc SHARED src/cdsprpc_stub.c - + +) + +# libcdsprpc.so is a BSP runtime dependency on the target device. +# This stub exists only to satisfy the linker at build time; it must not +# be included in the deliverable package. Redirect it to a separate +# directory so it cannot be mistaken for a real output artifact. +set_target_properties(cdsprpc PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/link-stubs" ) -target_include_directories(QcPerfQcomDsp PUBLIC +target_include_directories(QcPerfQcomDsp PUBLIC inc ) -target_include_directories(cdsprpc PUBLIC +target_include_directories(cdsprpc PUBLIC inc )