return ggml_webgpu_unary_op(ctx, src0, node);
case GGML_OP_LOG:
return ggml_webgpu_unary_op(ctx, src0, node);
+ case GGML_OP_SQR:
+ return ggml_webgpu_unary_op(ctx, src0, node);
+ case GGML_OP_SQRT:
+ return ggml_webgpu_unary_op(ctx, src0, node);
+ case GGML_OP_SIN:
+ return ggml_webgpu_unary_op(ctx, src0, node);
+ case GGML_OP_COS:
+ return ggml_webgpu_unary_op(ctx, src0, node);
case GGML_OP_PAD:
return ggml_webgpu_pad(ctx, src0, node);
case GGML_OP_ARGMAX:
case GGML_OP_LOG:
supports_op = (op->type == GGML_TYPE_F32 || op->type == GGML_TYPE_F16) && (src0->type == op->type);
break;
+ case GGML_OP_SQR:
+ supports_op = (op->type == GGML_TYPE_F32 || op->type == GGML_TYPE_F16) && (src0->type == op->type);
+ break;
+ case GGML_OP_SQRT:
+ supports_op = (op->type == GGML_TYPE_F32 || op->type == GGML_TYPE_F16) && (src0->type == op->type);
+ break;
+ case GGML_OP_SIN:
+ supports_op = (op->type == GGML_TYPE_F32 || op->type == GGML_TYPE_F16) && (src0->type == op->type);
+ break;
+ case GGML_OP_COS:
+ supports_op = (op->type == GGML_TYPE_F32 || op->type == GGML_TYPE_F16) && (src0->type == op->type);
+ break;
case GGML_OP_PAD:
supports_op = op->type == GGML_TYPE_F32 && src0->type == GGML_TYPE_F32;
break;
#ifdef TRUNC
let res = trunc(src[params.offset_src + src_idx]);
#endif
+#ifdef SQR
+ let res = src[params.offset_src + src_idx] * src[params.offset_src + src_idx];
+#endif
+#ifdef SQRT
+ let res = sqrt(src[params.offset_src + src_idx]);
+#endif
+#ifdef SIN
+ let res_f32 = sin(f32(src[params.offset_src + src_idx]));
+ let res = TYPE(res_f32);
+#endif
+#ifdef COS
+ let res_f32 = cos(f32(src[params.offset_src + src_idx]));
+ let res = TYPE(res_f32);
+#endif
#ifdef INPLACE
src[params.offset_src + src_idx] = res;