File: gpu-driver.rst

package info (click to toggle)
migraphx 7.1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 32,108 kB
  • sloc: cpp: 212,477; python: 26,075; sh: 307; xml: 199; makefile: 61; ansic: 16
file content (54 lines) | stat: -rw-r--r-- 1,697 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
MIGraphX GPU-driver
===============

The MIGraphX gpu-driver is used to test the performance of GPU kernels produced in MIGraphX.
Example usage::
    
    gpu-driver kernel_test.json

The input json file describes the gpu kernel and the input data settings.
Random data is passed into the gpu kernel and the kernel is run a set number of iterations
(1000 in the example below) and timed for performance.

Format for the input json file
------------------------------

* settings:
    * iterations: the number of iterations to run the kernel
    * lens: the dimensions for the input data shape
    * strides: strides for the input dimension, optional for standard shapes
    * type: data type
* compile_op:
    * name: name of the gpu operation to compile
    * lambda: lambda function
    * inputs: input shapes into the kernel, need 1 more than lambda function input for output buffer

*TODO: many other possible settings*

Example hjson file that tests a pointwise GELU approximation (note this is hjson and needs
to be converted to json before usage)::

    # sigmoid GELU approximation
    {
        settings: {
            iterations: 1000
            lens: [10, 384, 3072]
            type: "float"
        },
        compile_op: {
            name: "pointwise"
            lambda: 
            '''
            [](auto x)
            {
                using x_type = decltype(x);
                x_type one = 1.;
                x_type fit_const = 2.;
                return x / (one + exp(-fit_const * x));
            }
            '''
            inputs: [{}, {}]
        }
    }

To convert the hjson file to a json file you can use ``hjson -j``. To install hjson: ``pip install hjson``