Zhao-Dongyu / sgemm_riscv

This project records the process of optimizing SGEMM (single-precision floating point General Matrix Multiplication) on the riscv platform.
MIT License
15 stars 0 forks source link

sgemm_riscv


RISC-V is an open standard Instruction Set Architecture (ISA) enabling a new era of processor innovation through open collaboration.


GEMM General matrix multiply, one of the Basic Linear Algebra Subprograms.


This project records the process of optimizing SGEMM (single-precision floating point General Matrix Multiplication) on the riscv platform.


To get started, please refer to Section Usage

Related tutorials are located on the wiki.

Blislab

Blislab is an open source teaching project that teaches you step-by-step optimization of matrix multiplication.

On the basis of the blislab project, surez-ok has made some deletions and optimizations (deleted into the simplest code, only supports x86 or riscv Linux OS), so The project is clearer and easier to get started.

Project structure

.
├── data
├── pics
├── prepare
│   ├── 0.hello_world
│   ├── 1.memory_copy
│   ├── 2.memcpy_bandwidth_test
│   ├── 3.flw_bandwidth_test
│   ├── 4.vlw_bandwidth_test
│   ├── 5.saxpy
│   └── imgs
└── sgemm
    ├── common
    ├── step0
    ├── step1
    ├── step2
    ├── step3
    ├── step4
    ├── step5
    ├── step6
    ├── step7
    ├── step8
    └── step9

In the prepare folder, I compiled some tutorials and demos for hardware performance testing.

In the sgemm folder, step0 to step9 are my experiments.

See wiki for more details.

Installation

You need to download the cross-compilation chain of riscv.

The development board I use is Nezha D1, download from here

Usage

Take step1 as an example

You need to modify the Makefile and configure CROSS_COMPILE in the first few lines of the Makefile as the correct cross-compiler

$ cd step1
$ make
$ adb push test_bl_sgemm_step1.x ./.
$ adb shell './test_bl_sgemm_step1.x'

Acknowledgement

Support

zhaodongyu1024@gmail.com

License

MIT License