Skip to content

applications/include/layer.h

Classes

Name
struct gemm_layer_struct
This structure contains all parameters necessary for GEMM.
struct conv_layer_struct
This structure contains all parameters necessary for Convolutional layers.

Types

Name
enum precision_t { FP64 = 8, FP32 = 4, FP16 = 2, FP8 = 1}
typedef struct gemm_layer_struct gemm_layer
typedef struct conv_layer_struct conv_layer

Types Documentation

enum precision_t

Enumerator Value Description
FP64 8
FP32 4
FP16 2
FP8 1

typedef gemm_layer

typedef struct gemm_layer_struct gemm_layer;

typedef conv_layer

typedef struct conv_layer_struct conv_layer;

Source code

// Copyright 2020 ETH Zurich and University of Bologna.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include <stdint.h>

typedef enum { FP64 = 8, FP32 = 4, FP16 = 2, FP8 = 1 } precision_t;

typedef struct gemm_layer_struct {
    uint32_t M;
    uint32_t M_p;
    uint32_t N;
    uint32_t K;

    uint32_t TA;
    uint32_t TB;

    uint32_t TILE_M;
    uint32_t TILE_N;
    uint32_t TILE_K;

    double *A;
    double *B;
    double *C;

    uint32_t ALPHA;

    precision_t dtype;
    uint32_t expand;
} gemm_layer;

typedef struct conv_layer_struct {
    // CONV2D
    uint32_t CO;
    uint32_t CI;
    uint32_t IH;
    uint32_t IW;
    uint32_t OH;
    uint32_t OW;
    uint32_t FH;
    uint32_t FW;
    uint32_t pad;

    double *ifmap;
    double *weights;
    double *ofmap;

    uint32_t TILE_CI;
    uint32_t cluster2cluster;
    uint32_t im2col;

    // BATCHNORM
    double *gamma;
    double *beta;

    precision_t dtype;
} conv_layer;

Updated on 2023-06-19 at 09:43:56 +0000