Skip to content

Commit 9b0d50c

Browse files
committed
cont : more ops
ggml-ci
1 parent 19d8ef9 commit 9b0d50c

File tree

8 files changed

+991
-906
lines changed

8 files changed

+991
-906
lines changed

ggml/include/ggml.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,19 +284,19 @@ __host__ __device__ constexpr inline void ggml_unused_vars_impl(Args&&...) noexc
284284
// GGML_TENSOR_LOCALS(size_t, nb1, src1, nb);
285285
//
286286
#define GGML_TENSOR_LOCALS_1(type, prefix, pointer, array) \
287-
const type prefix##0 = (pointer)->array[0]; \
287+
const type prefix##0 = (pointer) ? (pointer)->array[0] : 0; \
288288
GGML_UNUSED(prefix##0);
289289
#define GGML_TENSOR_LOCALS_2(type, prefix, pointer, array) \
290290
GGML_TENSOR_LOCALS_1 (type, prefix, pointer, array) \
291-
const type prefix##1 = (pointer)->array[1]; \
291+
const type prefix##1 = (pointer) ? (pointer)->array[1] : 0; \
292292
GGML_UNUSED(prefix##1);
293293
#define GGML_TENSOR_LOCALS_3(type, prefix, pointer, array) \
294294
GGML_TENSOR_LOCALS_2 (type, prefix, pointer, array) \
295-
const type prefix##2 = (pointer)->array[2]; \
295+
const type prefix##2 = (pointer) ? (pointer)->array[2] : 0; \
296296
GGML_UNUSED(prefix##2);
297297
#define GGML_TENSOR_LOCALS(type, prefix, pointer, array) \
298298
GGML_TENSOR_LOCALS_3 (type, prefix, pointer, array) \
299-
const type prefix##3 = (pointer)->array[3]; \
299+
const type prefix##3 = (pointer) ? (pointer)->array[3] : 0; \
300300
GGML_UNUSED(prefix##3);
301301

302302
#define GGML_TENSOR_UNARY_OP_LOCALS \

ggml/src/ggml-metal/ggml-metal-context.m

Lines changed: 16 additions & 756 deletions
Large diffs are not rendered by default.

ggml/src/ggml-metal/ggml-metal-device.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,6 @@ bool ggml_metal_device_supports_op(ggml_metal_device_t ctx, const struct ggml_te
507507
return false;
508508
};
509509
}
510-
case GGML_OP_DIAG_MASK_INF:
511510
case GGML_OP_GET_ROWS:
512511
{
513512
return op->ne[3] == 1;

ggml/src/ggml-metal/ggml-metal-impl.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,16 @@ typedef struct {
165165
uint64_t nb3;
166166
} ggml_metal_kargs_repeat;
167167

168+
typedef struct {
169+
float scale;
170+
float bias;
171+
} ggml_metal_kargs_scale;
172+
173+
typedef struct {
174+
float min;
175+
float max;
176+
} ggml_metal_kargs_clamp;
177+
168178
typedef struct {
169179
int64_t ne00;
170180
int64_t ne01;
@@ -506,14 +516,6 @@ typedef struct {
506516
uint64_t nb01;
507517
uint64_t nb02;
508518
uint64_t nb03;
509-
int64_t ne10;
510-
int64_t ne11;
511-
int64_t ne12;
512-
int64_t ne13;
513-
uint64_t nb10;
514-
uint64_t nb11;
515-
uint64_t nb12;
516-
uint64_t nb13;
517519
int64_t ne0;
518520
int64_t ne1;
519521
int64_t ne2;
@@ -547,12 +549,6 @@ typedef struct {
547549
int32_t n_head_log2;
548550
} ggml_metal_kargs_soft_max;
549551

550-
typedef struct {
551-
int64_t ne00;
552-
int64_t ne01;
553-
int n_past;
554-
} ggml_metal_kargs_diag_mask_inf;
555-
556552
typedef struct {
557553
int64_t ne00;
558554
int64_t ne01;
@@ -719,7 +715,12 @@ typedef struct {
719715
int64_t IW;
720716
int64_t OH;
721717
int64_t OW;
722-
int64_t parallel_elements;
718+
int64_t np;
723719
} ggml_metal_kargs_pool_2d;
724720

721+
typedef struct {
722+
int64_t ne00;
723+
uint64_t nb01;
724+
} ggml_metal_kargs_argmax;
725+
725726
#endif // GGML_METAL_IMPL

0 commit comments

Comments
 (0)