Skip to content

Commit

Permalink
make github CI happy
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou.weiguo committed Apr 24, 2024
1 parent b0c3013 commit f9e1b9a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
13 changes: 13 additions & 0 deletions ggml-qnn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@
class qnn_instance;

//TODO: should be removed because this is a workaround method during development stage
//a minor modification is required during development stage for validate QNN backend on Android phone:
//
//modify from
//
//static void ggml_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor)
//
//to
//
//void ggml_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor)
//
//in source file ggml.c#L16156
//
//this workaround will not be needed when the final QNN backend is complete
extern "C" void ggml_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor);

#if (defined __ANDROID__) || (defined ANDROID) //Qualcomm's QNN could running on Windows over ARM(aka WoA)
Expand Down
4 changes: 0 additions & 4 deletions ggml-qnn.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ GGML_API void ggml_backend_qnn_get_device_description(int device, char
GGML_API ggml_backend_buffer_type_t ggml_backend_qnn_buffer_type(size_t dev_num);


//temporary API, should be removed in the future
GGML_API bool ggml_qnn_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor);


#ifdef __cplusplus
}
#endif
3 changes: 1 addition & 2 deletions ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -16153,8 +16153,7 @@ static void ggml_compute_forward_cross_entropy_loss_back(

/////////////////////////////////

//workaround for Qualcomm QNN backend
void ggml_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor) {
static void ggml_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor) {
GGML_ASSERT(params);

if (tensor->op == GGML_OP_NONE || ggml_is_empty(tensor)) {
Expand Down
11 changes: 1 addition & 10 deletions llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15403,7 +15403,7 @@ struct llama_context * llama_new_context_with_model(
#elif defined(GGML_USE_QNN)
if (model->n_gpu_layers > 0) {
//the second param is package name of Andorid app, can be got by JNI from Java layer
ggml_backend_t backend = ggml_backend_qnn_init(QNN_CPU, "/data/data/com.ggml.llamacpp/");
ggml_backend_t backend = ggml_backend_qnn_init(model->main_gpu, "/data/data/com.ggml.llamacpp/");
if (nullptr == backend) {
LLAMA_LOG_ERROR("%s: failed to initialize QNN backend\n", __func__);
llama_free(ctx);
Expand Down Expand Up @@ -17577,14 +17577,6 @@ void llama_reset_timings(struct llama_context * ctx) {
ctx->t_p_eval_us = ctx->n_p_eval = 0;
}

static int llama_has_qnn(void) {
#ifdef GGML_USE_QNN
return 1;
#else
return 0;
#endif
}

const char * llama_print_system_info(void) {
static std::string s;

Expand All @@ -17606,7 +17598,6 @@ const char * llama_print_system_info(void) {
s += "SSSE3 = " + std::to_string(ggml_cpu_has_ssse3()) + " | ";
s += "VSX = " + std::to_string(ggml_cpu_has_vsx()) + " | ";
s += "MATMUL_INT8 = " + std::to_string(ggml_cpu_has_matmul_int8()) + " | ";
s += "QNN = " + std::to_string(llama_has_qnn()) + " | ";

return s.c_str();
}
Expand Down

0 comments on commit f9e1b9a

Please sign in to comment.