From 4df40e5fcf5596ee1e41dad0a7018ea76349537e Mon Sep 17 00:00:00 2001 From: charlie Date: Thu, 15 Feb 2024 11:48:45 -0600 Subject: [PATCH 1/3] Add first draft --- docs/gpu-driver/gpu-driver.rst | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 docs/gpu-driver/gpu-driver.rst diff --git a/docs/gpu-driver/gpu-driver.rst b/docs/gpu-driver/gpu-driver.rst new file mode 100755 index 00000000000..15494cc3dac --- /dev/null +++ b/docs/gpu-driver/gpu-driver.rst @@ -0,0 +1,51 @@ +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 +and timed for performance. + +json file formatting: +* 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 gpu-driver hjson testing a pointwise GELU approximation:: + + # 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``. From 897caab1edf4cf79329d33543de5a08bf964697a Mon Sep 17 00:00:00 2001 From: charlie Date: Thu, 15 Feb 2024 11:50:56 -0600 Subject: [PATCH 2/3] Formatting --- docs/gpu-driver/gpu-driver.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/gpu-driver/gpu-driver.rst b/docs/gpu-driver/gpu-driver.rst index 15494cc3dac..831b1874ad1 100755 --- a/docs/gpu-driver/gpu-driver.rst +++ b/docs/gpu-driver/gpu-driver.rst @@ -10,7 +10,9 @@ 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 and timed for performance. -json file formatting: +json file formatting +-------------------- + * settings: * iterations: the number of iterations to run the kernel * lens: the dimensions for the input data shape @@ -21,7 +23,7 @@ json file formatting: * lambda: lambda function * inputs: input shapes into the kernel, need 1 more than lambda function input for output buffer -** TODO: many other possible settings** +*TODO: many other possible settings* Example gpu-driver hjson testing a pointwise GELU approximation:: From b5e5c6e7c6863a6fadbffac6e950461fc9234996 Mon Sep 17 00:00:00 2001 From: charlie Date: Fri, 27 Sep 2024 15:23:50 -0500 Subject: [PATCH 3/3] Update wrt. review comments --- docs/gpu-driver/gpu-driver.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/gpu-driver/gpu-driver.rst b/docs/gpu-driver/gpu-driver.rst index 831b1874ad1..b1e86638782 100755 --- a/docs/gpu-driver/gpu-driver.rst +++ b/docs/gpu-driver/gpu-driver.rst @@ -8,10 +8,10 @@ Example usage:: 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 -and timed for performance. +(1000 in the example below) and timed for performance. -json file formatting --------------------- +Format for the input json file +------------------------------ * settings: * iterations: the number of iterations to run the kernel @@ -25,7 +25,8 @@ json file formatting *TODO: many other possible settings* -Example gpu-driver hjson testing a pointwise GELU approximation:: +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 { @@ -50,4 +51,4 @@ Example gpu-driver hjson testing a pointwise GELU approximation:: } } -To convert the hjson file to a json file you can use ``hjson -j``. +To convert the hjson file to a json file you can use ``hjson -j``. To install hjson: ``pip install hjson``