Skip to content

Commit e613ef2

Browse files
authored
hexagon: enable I32 GET_ROWS (#29116)
1 parent 851cb34 commit e613ef2

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎ggml/src/ggml-hexagon/ggml-hexagon.cpp‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5339,19 +5339,25 @@ static bool ggml_hexagon_supported_get_rows(const struct ggml_hexagon_session *
53395339
}
53405340
}
53415341

5342-
if (src0->type != GGML_TYPE_F32 && src0->ne[0] < 32) {
5342+
if (src0->type != GGML_TYPE_F32 && src0->type != GGML_TYPE_I32 && src0->ne[0] < 32) {
53435343
return false;
53445344
}
53455345

5346-
if (src0->type != GGML_TYPE_F32 && src0->type != GGML_TYPE_F16 && src0->type != GGML_TYPE_Q8_0) {
5346+
if (src0->type != GGML_TYPE_F32 && src0->type != GGML_TYPE_F16 &&
5347+
src0->type != GGML_TYPE_Q8_0 && src0->type != GGML_TYPE_I32) {
53475348
return false;
53485349
}
53495350

53505351
if (src1->type != GGML_TYPE_I32 && src1->type != GGML_TYPE_I64) {
53515352
return false;
53525353
}
53535354

5354-
if (dst->type != GGML_TYPE_F32) {
5355+
if (src0->type == GGML_TYPE_I32) {
5356+
if (dst->type != GGML_TYPE_I32) {
5357+
return false;
5358+
}
5359+
}
5360+
else if (dst->type != GGML_TYPE_F32) {
53555361
return false;
53565362
}
53575363

‎ggml/src/ggml-hexagon/htp/get-rows-ops.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,13 @@ int op_get_rows(struct htp_ops_context * octx) {
213213

214214
if (octx->src[0]->type != HTP_TYPE_F32 &&
215215
octx->src[0]->type != HTP_TYPE_F16 &&
216-
octx->src[0]->type != HTP_TYPE_Q8_0) {
216+
octx->src[0]->type != HTP_TYPE_Q8_0 &&
217+
octx->src[0]->type != HTP_TYPE_I32) {
217218
return HTP_STATUS_NO_SUPPORT;
218219
}
219220

220-
if (octx->dst->type != HTP_TYPE_F32) {
221+
if ((octx->src[0]->type == HTP_TYPE_I32 && octx->dst->type != HTP_TYPE_I32) ||
222+
(octx->src[0]->type != HTP_TYPE_I32 && octx->dst->type != HTP_TYPE_F32)) {
221223
return HTP_STATUS_NO_SUPPORT;
222224
}
223225

@@ -275,6 +277,7 @@ int op_get_rows(struct htp_ops_context * octx) {
275277
case HTP_TYPE_F32: q_func = (work_queue_func_t)(is_i32 ? get_rows_thread_f32_int32_t : get_rows_thread_f32_int64_t); break;
276278
case HTP_TYPE_F16: q_func = (work_queue_func_t)(is_i32 ? get_rows_thread_f16_int32_t : get_rows_thread_f16_int64_t); break;
277279
case HTP_TYPE_Q8_0: q_func = (work_queue_func_t)(is_i32 ? get_rows_thread_q8_0_int32_t : get_rows_thread_q8_0_int64_t); break;
280+
case HTP_TYPE_I32: q_func = (work_queue_func_t)(is_i32 ? get_rows_thread_st_int32_t : get_rows_thread_st_int64_t); break;
278281
default: return HTP_STATUS_NO_SUPPORT;
279282
}
280283
}

‎ggml/src/ggml-hexagon/htp/htp-tensor.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ static inline uint32_t htp_tensor_get_row_size(int type, uint32_t ne00) {
126126
case HTP_TYPE_F32: return ne00 * 4;
127127
case HTP_TYPE_F16: return ne00 * 2;
128128
case HTP_TYPE_Q8_0: return (ne00 / 32) * 34;
129+
case HTP_TYPE_I32: return ne00 * 4;
129130
default: return 0;
130131
}
131132
}

0 commit comments

Comments
 (0)