Skip to content

Commit fe7a8e1

Browse files
committed
Refine code
1 parent 8bd4ea8 commit fe7a8e1

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

script/qai_appbuilder/qnncontext.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ def __del__(self):
248248
del(self.m_context)
249249
m_context = None
250250

251+
251252
class QNNShareMemory:
252253
"""High-level Python wrapper for a AppBuilder model."""
253254
def __init__(self,
@@ -268,10 +269,10 @@ def __del__(self):
268269
if hasattr(self, "m_memory") and self.m_memory is not None:
269270
del(self.m_memory)
270271
m_memory = None
271-
272+
273+
272274
class LoraAdapter: # this will just hold data
273275
m_adapter = None
274276

275277
def __init__(self, graph_name, lora_file_paths):
276278
self.m_adapter = appbuilder.LoraAdapter(graph_name, lora_file_paths) # cpp object
277-

src/LibAppBuilder.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ bool ModelInitializeEx(const std::string& model_name, const std::string& proc_na
290290
const std::string& backend_lib_path, const std::string& system_lib_path,
291291
const std::vector<LoraAdapter>& lora_adapters) {
292292
bool result = false;
293+
293294
QNN_INF("LibAppBuilder::ModelInitialize: %s \n", model_name.c_str());
294295

295296
#ifdef _WIN32

src/LibAppBuilder.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class LIBAPPBUILDER_API LibAppBuilder
5656
const std::string& backend_lib_path, const std::string& system_lib_path);
5757

5858
bool ModelInitialize(const std::string& model_name, const std::string& model_path,
59-
const std::string& backend_lib_path, const std::string& system_lib_path, const std::vector<LoraAdapter>& lora_adapters);
59+
const std::string& backend_lib_path, const std::string& system_lib_path, const std::vector<LoraAdapter>& lora_adapters);
6060

6161
bool ModelInference(std::string model_name, std::vector<uint8_t*>& inputBuffers,
6262
std::vector<uint8_t*>& outputBuffers, std::vector<size_t>& outputSize,

src/SVC/main.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,17 @@ int svcprocess_run(HANDLE hSvcPipeInRead, HANDLE hSvcPipeOutWrite) {
187187

188188
char* cmdBuf = g_buffer + 1;
189189
switch (g_buffer[0]) {
190-
case 'l': // load model.
191-
ModelLoad(cmdBuf, hSvcPipeOutWrite);
192-
break;
190+
case 'l': // load model.
191+
ModelLoad(cmdBuf, hSvcPipeOutWrite);
192+
break;
193193

194-
case 'g': // run Graphs.
195-
ModelRun(cmdBuf, hSvcPipeOutWrite);
196-
break;
194+
case 'g': // run Graphs.
195+
ModelRun(cmdBuf, hSvcPipeOutWrite);
196+
break;
197197

198-
case 'r': // release model.
199-
ModelRelease(cmdBuf, hSvcPipeOutWrite);
200-
break;
198+
case 'r': // release model.
199+
ModelRelease(cmdBuf, hSvcPipeOutWrite);
200+
break;
201201
}
202202
}
203203

@@ -212,7 +212,7 @@ int svcprocess_run(HANDLE hSvcPipeInRead, HANDLE hSvcPipeOutWrite) {
212212
int hostprocess_run(std::string qnn_lib_path, std::string model_path,
213213
std::string input_raw_path, int input_count, int memory_size,
214214
std::string perf_profile, const std::vector <LoraAdapter>& Adapters ) {
215-
BOOL result = false;
215+
BOOL result = false;
216216

217217
std::string MODEL_NAME = "<model_name>";
218218
std::string PROC_NAME = "<proc_name>";
@@ -284,6 +284,7 @@ int hostprocess_run(std::string qnn_lib_path, std::string model_path,
284284
}
285285
os.close();
286286
}
287+
287288
for (int i = 0; i < outputBuffers.size(); i++) {
288289
free(outputBuffers[i]);
289290
}
@@ -420,7 +421,8 @@ int main(int argc, char** argv) {
420421
--model_path <str:model_path> --perf_profile <str:perf_profile> --input_path <str:input_raw_path>
421422
--input_count <int:input_count> --memory_size<int:memory_size>
422423
--binary_updates<str:graph_name,binary_update_path_1;binary_update_path_2>
423-
input files are under 'input_raw_path' and the file names format are 'input_%d.raw'. */
424+
input files are under 'input_raw_path' and the file names format are 'input_%d.raw'.
425+
*/
424426

425427
try {
426428
// Parse command-line arguments
@@ -482,3 +484,4 @@ int main(int argc, char** argv) {
482484

483485
return 0;
484486
}
487+

0 commit comments

Comments
 (0)