zhouwg / kantv

workbench for learing&practising AI tech in real scenario on Android device, powered by GGML(Georgi Gerganov Machine Learning) and NCNN(Tencent NCNN) and FFmpeg
Apache License 2.0
117 stars 19 forks source link

高通8Gen3设备上使用QNN的HTP加速效果不理想 #239

Open WangHao311 opened 2 weeks ago

WangHao311 commented 2 weeks ago

您好, 大佬,借贵宝地,请问一下,为什么我在高通8Gen3设备上使用QNN的HTP加速,感觉效果很差,没有达到加速效果呢?

设置了QnnHtpPerfInfrastructure_PowerConfig_t如下:

sample_app::StatusCode sample_app::QnnSampleApp::setBurstPerformanceMode() {
    QnnHtpPerfInfrastructure_PowerConfig_t powerConfig;
    memset(&powerConfig, 0, sizeof(powerConfig));
    powerConfig.option = QNN_HTP_PERF_INFRASTRUCTURE_POWER_CONFIGOPTION_DCVS_V3;
    powerConfig.dcvsV3Config.dcvsEnable = 0;
    powerConfig.dcvsV3Config.setDcvsEnable = 1;
    powerConfig.dcvsV3Config.contextId = m_powerConfigId;
    powerConfig.dcvsV3Config.powerMode = QNN_HTP_PERF_INFRASTRUCTURE_POWERMODE_PERFORMANCE_MODE;
    powerConfig.dcvsV3Config.setSleepLatency = 1; // True to consider Latency parameter otherwise False
    powerConfig.dcvsV3Config.setBusParams = 1; // True to consider Bus parameter otherwise False
    powerConfig.dcvsV3Config.setCoreParams = 1; // True to consider Core parameter otherwise False
    powerConfig.dcvsV3Config.sleepDisable = 0; // True to consider sleep/LPM modes, False to enable
    powerConfig.dcvsV3Config.setSleepDisable = 0; // True to consider sleep disable/enable parameter otherwise False
    powerConfig.dcvsV3Config.sleepLatency = 40; // range 40-2000 micro sec
    powerConfig.dcvsV3Config.busVoltageCornerMin = DCVS_VOLTAGE_VCORNER_MAX_VOLTAGE_CORNER;
    powerConfig.dcvsV3Config.busVoltageCornerTarget = DCVS_VOLTAGE_VCORNER_MAX_VOLTAGE_CORNER;
    powerConfig.dcvsV3Config.busVoltageCornerMax = DCVS_VOLTAGE_VCORNER_MAX_VOLTAGE_CORNER;
    powerConfig.dcvsV3Config.coreVoltageCornerMin = DCVS_VOLTAGE_VCORNER_MAX_VOLTAGE_CORNER;
    powerConfig.dcvsV3Config.coreVoltageCornerTarget = DCVS_VOLTAGE_VCORNER_MAX_VOLTAGE_CORNER;
    powerConfig.dcvsV3Config.coreVoltageCornerMax = DCVS_VOLTAGE_VCORNER_MAX_VOLTAGE_CORNER;

    const QnnHtpPerfInfrastructure_PowerConfig_t *powerConfigs[] =
            {&powerConfig, NULL};
    if (m_perfInfra) {
        m_perfInfra->setPowerConfig(m_powerConfigId, powerConfigs);
    }
    return StatusCode::SUCCESS;
}