Skip to content
amdkila edited this page Jun 13, 2020 · 66 revisions

Tensile is a tool for creating a benchmark-driven backend library for GEMMs, GEMM-like problems (such as batched GEMM), N-dimensional tensor contractions, and anything else that multiplies two multi-dimensional objects together on AMD GPU.

Overview for creating a custom TensileLib backend library for your application :

  1. Install the PyYAML and cmake dependency (mandatory), git clone and cd Tensile
  2. Create a benchmark config.yaml file in ./Tensile/Configs/
  3. Run the benchmark. After the benchmark is finished. Tensile will dump 4 directories: 1 & 2 is about benchmarking. 3 & 4 is the summarized results from your library (like rocBLAS) viewpoints.

1_BenchmarkProblems: has all the problems descriptions and executables generated during benchmarking, where you can re-launch exe to reproduce results.

2_BenchmarkData: has the raw performance results.

3_LibraryLogic: has optimal kernel configurations yaml file and Winner*.csv. Usually rocBLAS takes the yaml files from this folder.

4_LibraryClient: has a client exe, so you can launch from a library viewpoint.

  1. Add the Tensile library to your application's CMake target. The Tensile library will be written, compiled and linked to your application at application-compile-time.

Quick Example (Ubuntu):

sudo apt-get install python3-yaml
mkdir Tensile
cd Tensile
git clone https://github.com/ROCmSoftwarePlatform/Tensile repo
cd repo
git checkout master
mkdir build
cd build
../Tensile/bin/Tensile ../Tensile/Configs/rocblas_sgemm_asm_only.yaml ./

After about 10 minutes of benchmarking, Tensile will output a yaml file. This file contains the results of the winning kernels in the 3_LibraryLogic directory. Spreadsheets with the Benchmark Data for all kernels are available in the 2_BenchmarkData directory. To use the client, do the following:

./0_Build/client/tensile_client -h
./0_Build/client/tensile_client --problem-size=5760,5760,1,5760 --library-file=path/to/TensileLibrary.yaml --code-object=path/to/*hsaco --code-object=path/to/*TensileLibrary.co --problem-identifier=Cijk_Ailk_Bjlk 
Clone this wiki locally