Skip to content

Commit 1b18472

Browse files
committed
Simple CUDA kernel
1 parent ab11d94 commit 1b18472

File tree

6 files changed

+486
-133
lines changed

6 files changed

+486
-133
lines changed

ggml/src/ggml-cpu/ggml-cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2144,6 +2144,7 @@ static int ggml_get_n_tasks(struct ggml_tensor * node, int n_threads) {
21442144
case GGML_OP_ADD_ID:
21452145
case GGML_OP_ADD1:
21462146
case GGML_OP_ACC:
2147+
case GGML_OP_XIELU:
21472148
{
21482149
n_tasks = n_threads;
21492150
} break;
@@ -2167,7 +2168,6 @@ static int ggml_get_n_tasks(struct ggml_tensor * node, int n_threads) {
21672168
case GGML_OP_REPEAT:
21682169
case GGML_OP_REPEAT_BACK:
21692170
case GGML_OP_LEAKY_RELU:
2170-
case GGML_OP_XIELU:
21712171
{
21722172
n_tasks = 1;
21732173
} break;

ggml/src/ggml-cpu/unary-ops.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,6 @@ void ggml_compute_forward_xielu(const ggml_compute_params * params, ggml_tensor
207207
const float beta = op_params[2];
208208
const float eps = op_params[3];
209209

210-
// alpha_p = softplus(alpha_p);
211-
// alpha_n = beta + softplus(alpha_n);
212-
213210
const auto xielu_op_params = [alpha_n, alpha_p, beta, eps](float f) {
214211
return op_xielu(f, alpha_n, alpha_p, beta, eps);
215212
};

ggml/src/ggml-cuda/ggml-cuda.cu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2517,6 +2517,9 @@ static bool ggml_cuda_compute_forward(ggml_backend_cuda_context & ctx, struct gg
25172517
case GGML_OP_OPT_STEP_SGD:
25182518
ggml_cuda_opt_step_sgd(ctx, dst);
25192519
break;
2520+
case GGML_OP_XIELU:
2521+
ggml_cuda_op_xielu(ctx, dst);
2522+
break;
25202523
default:
25212524
return false;
25222525
}

0 commit comments

Comments
 (0)