Add Kernels namespace

This commit is contained in:
2024-03-11 21:04:23 +01:00
parent e0178e2d5c
commit d2ab78fbc7
18 changed files with 188 additions and 186 deletions

View File

@@ -1,19 +1,14 @@
#ifndef ACTIVATIONS_H
#define ACTIVATIONS_H
__global__ void
sigmoid_kernel(const float* __restrict__ src, float* __restrict__ dst, int len);
namespace Kernels {
__global__ void
relu_kernel(const float* __restrict__ src, float* __restrict__ dst, int len);
sigmoid(const float* __restrict__ src, float* __restrict__ dst, int len);
__global__ void
linear_kernel(const float* __restrict__ src, float* __restrict__ dst, int len);
relu(const float* __restrict__ src, float* __restrict__ dst, int len);
enum Activation {
SIGMOID,
RELU,
LINEAR
};
} // namespace Kernels
#endif // ACTIVATIONS_H

View File

@@ -1,7 +1,18 @@
#ifndef CONVOLUTION_H
#define CONVOLUTION_H
__global__ void convolution_kernel(
namespace Kernels {
__global__ void padding(
const float* d_input,
float* d_padded,
int w,
int h,
int n,
int p
);
__global__ void convolution(
const float* d_input,
const float* d_kernel,
float* d_output,
@@ -13,4 +24,6 @@ __global__ void convolution_kernel(
int outputSize
);
} // namespace Kernels
#endif // CONVOLUTION_H

View File

@@ -1,7 +1,9 @@
#ifndef MATRIX_MATH_H
#define MATRIX_MATH_H
#ifndef MATMUL_H
#define MATMUL_H
__global__ void mat_vec_mul_kernel(
namespace Kernels {
__global__ void mat_vec_mul(
const float* d_matrix,
const float* d_vector,
float* d_output,
@@ -9,11 +11,13 @@ __global__ void mat_vec_mul_kernel(
int h
);
__global__ void vec_vec_add_kernel(
__global__ void vec_vec_add(
const float* d_vector1,
const float* d_vector2,
float* d_output,
int w
);
#endif // MATRIX_MATH_H
} // namespace Kernels
#endif // MATMUL_H

View File

@@ -1,18 +0,0 @@
#ifndef PADDING_H
#define PADDING_H
__global__ void pad_matrix_kernel(
const float* d_input,
float* d_padded,
int w,
int h,
int n,
int p
);
enum Padding {
SAME,
VALID
};
#endif // PADDING_H