[igt-dev] [PATCH i-g-t v2 1/2] shaders: Add assembler instructions and update README for shaders
Chris Wilson
chris at chris-wilson.co.uk
Fri Jun 15 09:19:02 UTC 2018
Quoting Katarzyna Dec (2018-06-15 10:12:59)
> We're not planning to work on assembler in igt anymore, since we can
> reuse an existing project (IGA) that will do this work for us. The
> only extra thing we need to do is convert the result binary to C-array,
> simple python script.
>
> Signed-off-by: Katarzyna Dec <katarzyna.dec at intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
> Cc: Petri Latvala <petri.latvala at intel.com>
> Cc: Kalamarz Lukasz <lukasz.kalamarz at intel.com>
> Cc: Antonio Argenziano <antonio.argenziano at intel.com>
> ---
> shaders/README | 37 +++++++++++++++++++++++++++++++++++++
> shaders/gpgpu/README | 11 +++++++++++
> shaders/gpgpu/gpgpu_fill_gen8.asm | 10 ++++++++++
> shaders/gpgpu/gpgpu_fill_gen9.asm | 10 ++++++++++
> shaders/media/README | 9 +++++++++
> shaders/media/media_fill_gen8.asm | 11 +++++++++++
> shaders/ps/README | 8 ++++++++
> shaders/ps/blit_gen8.asm | 7 +++++++
> shaders/ps/neg1_gen8.asm | 9 +++++++++
> 9 files changed, 112 insertions(+)
> create mode 100644 shaders/README
> create mode 100644 shaders/gpgpu/gpgpu_fill_gen8.asm
> create mode 100644 shaders/gpgpu/gpgpu_fill_gen9.asm
> create mode 100644 shaders/media/media_fill_gen8.asm
> create mode 100644 shaders/ps/blit_gen8.asm
> create mode 100644 shaders/ps/neg1_gen8.asm
>
> diff --git a/shaders/README b/shaders/README
> new file mode 100644
> index 00000000..9e6bf410
> --- /dev/null
> +++ b/shaders/README
> @@ -0,0 +1,37 @@
> +This directory is for shaders used in media_fill, gpgpu_fill, rendercopy
> +and media_spin libraries.
> +
> +Till Gen8 shaders were generated using intel-gen4asm script (implementation in
> +assembler/ directory). From Gen8 it is possible to use Intel Graphics Assembler
> +to generate binary from asm instructions
> +https://github.com/intel/intel-graphics-compiler/tree/master/visa/iga
> +Clone and build this project to use IGA.
> +
> +where to find IGA binary TODO: add path
> +
> +For maintaining compatibility with our tests there is a bin to hex converter
> +written in python.
> +Instructions how to build media, gpgpu or ps shaders included in their
> +subdirectories.
> +
> +Converter:
> +#!/usr/bin/env python2
> +import struct
> +import sys
> +
> +print "static const uint32_t kernel[][4] = {"
> +
> +with open(sys.argv[1], 'r') as f:
> + fmt = '<LLLL'
> + step = struct.calcsize(fmt)
> + while True:
> + buf = f.read(step)
> + if not buf:
> + break
> + elif len(buf) < step:
> + buf += '\x00' * (step - len(buf))
> +
> + val = struct.unpack('<LLLL', buf)
> + print " {{ 0x{:08x}, 0x{:08x}, 0x{:08x}, 0x{:08x} }},".format(*val)
> +
> +print "};"
> \ No newline at end of file
How difficult is to make it into a pipe? converter.py < asm.obj > asm.c
(As well as converter.py -i asm.obj -o asm.c)
Rather than putting this in a README, save the cut'n'paste and include
it as a .py.
-Chris
More information about the igt-dev
mailing list