Skip to content

Commit b7a77cf

Browse files
committed
ggml-zdnn: add guards to prevent loading ztensor if transformed
Signed-off-by: Aaron Teo <[email protected]>
1 parent 4d5edb2 commit b7a77cf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ggml/src/ggml-zdnn/ggml-zdnn-rewrite.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,13 @@ static void ggml_zdnn_mul_mat_op(ggml_backend_zdnn_context * ctx, const ggml_ten
133133
// ggml_zdnn_create_tensor(ptd_output, td_output, zt_output, output, output_dim, ZDNN_2D);
134134

135135
void * bias_data = (void *)calloc(ne0, ggml_element_size(output));
136-
ggml_zdnn_load_tensor(weights_extra->ztensor, weights->data);
137-
ggml_zdnn_load_tensor(inputs_extra->ztensor, inputs->data);
136+
if (weights_extra->ztensor.is_transformed == false) {
137+
ggml_zdnn_load_tensor(weights_extra->ztensor, weights->data);
138+
}
139+
140+
if (inputs_extra->ztensor.is_transformed == false) {
141+
ggml_zdnn_load_tensor(inputs_extra->ztensor, inputs->data);
142+
}
138143
ggml_zdnn_load_tensor(zt_bias, bias_data);
139144
// ggml_zdnn_load_tensor(output_extra->ztensor, output->data);
140145

0 commit comments

Comments
 (0)