Shaders documentation RESENDING
v2 cover Shaders documentation RESENDING
This is the same series that was sent in june'18, but got lost during review. Major issue was with introducing IGA for newer gens.
I've discussed about this series lately on intel-gfx and with high probability we could merge it (after successful review).
Please look at these patches and leave your comment.
v2: I have applied comments from review - fixed typos, changed readme files, updated converter and updated comments like "see shader/ps" in libs to new path.
Katarzyna Dec (2):
shaders: Add assembler instructions and update README for shaders lib/i915: Move shaders directory
lib/gpgpu_fill.c | 2 +-
lib/i915/shaders/README | 25 ++++++++++++++++++
lib/i915/shaders/converter.py | 26 +++++++++++++++++++
.../i915/shaders}/gpgpu/gpgpu_fill.gxa | 0
lib/i915/shaders/gpgpu/gpgpu_fill_gen8.asm | 10 +++++++
lib/i915/shaders/gpgpu/gpgpu_fill_gen9.asm | 10 +++++++
.../i915/shaders}/media/media_fill.gxa | 0
lib/i915/shaders/media/media_fill_gen8.asm | 11 ++++++++
{shaders => lib/i915/shaders}/ps/blit.g7a | 0
lib/i915/shaders/ps/blit_gen8.asm | 7 +++++
lib/i915/shaders/ps/neg1_gen8.asm | 9 +++++++
.../i915/shaders}/ps/neg1_test.g7a | 0
lib/rendercopy_gen8.c | 2 +-
lib/rendercopy_gen9.c | 2 +-
shaders/gpgpu/README | 4 ---
shaders/media/README | 5 ----
shaders/ps/README | 1 -
17 files changed, 101 insertions(+), 13 deletions(-)
create mode 100644 lib/i915/shaders/README
create mode 100644 lib/i915/shaders/converter.py
rename {shaders => lib/i915/shaders}/gpgpu/gpgpu_fill.gxa (100%)
create mode 100644 lib/i915/shaders/gpgpu/gpgpu_fill_gen8.asm
create mode 100644 lib/i915/shaders/gpgpu/gpgpu_fill_gen9.asm
rename {shaders => lib/i915/shaders}/media/media_fill.gxa (100%)
create mode 100644 lib/i915/shaders/media/media_fill_gen8.asm
rename {shaders => lib/i915/shaders}/ps/blit.g7a (100%)
create mode 100644 lib/i915/shaders/ps/blit_gen8.asm
create mode 100644 lib/i915/shaders/ps/neg1_gen8.asm
rename {shaders => lib/i915/shaders}/ps/neg1_test.g7a (100%)
delete mode 100644 shaders/gpgpu/README
delete mode 100644 shaders/media/README
delete mode 100644 shaders/ps/READMESignature · 6 lines
2.17.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v2 1/2 shaders: Add assembler instructions and update README for shaders
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.
v2: Moved converter to single file. Fixed README for shaders.
v3: Fixed typos.
v4: Used python3 in converter. Added 'usage' section to script. Droped readme files for particular shaders and consolidated all needed information in one general file.
--- shaders/README | 25 +++++++++++++++++++++++++ shaders/converter.py | 26 ++++++++++++++++++++++++++ shaders/gpgpu/README | 4 ---- shaders/gpgpu/gpgpu_fill_gen8.asm | 10 ++++++++++ shaders/gpgpu/gpgpu_fill_gen9.asm | 10 ++++++++++ shaders/media/README | 5 ----- shaders/media/media_fill_gen8.asm | 11 +++++++++++ shaders/ps/README | 1 - shaders/ps/blit_gen8.asm | 7 +++++++ shaders/ps/neg1_gen8.asm | 9 +++++++++ 10 files changed, 98 insertions(+), 10 deletions(-) create mode 100644 shaders/README create mode 100644 shaders/converter.py delete mode 100644 shaders/gpgpu/README create mode 100644 shaders/gpgpu/gpgpu_fill_gen8.asm create mode 100644 shaders/gpgpu/gpgpu_fill_gen9.asm delete mode 100644 shaders/media/README create mode 100644 shaders/media/media_fill_gen8.asm delete mode 100644 shaders/ps/README create mode 100644 shaders/ps/blit_gen8.asm create mode 100644 shaders/ps/neg1_gen8.asm
shaders/README new file +25 -0
@@ -0,0 +1,25 @@ +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 + 1. Clone IGC project + 2. Go to igc/visa/iga + 3. Build iga + cmake . && make + +For maintaining compatibility with our tests there is a bin to hex converter +written in python: + $>converter.py input_file > output_file +e.g.$>python converter.py gen9_iga_output > gen9_hex_array + +Commands used to generate the shader on gen7 +$> m4 gpgpu_fill.gxa > gpgpu_fill.gxm +$> intel-gen4asm -g 7 -o <output> gpgpu_fill.gxm + +Commands used to generate the shader on gen8 +$> m4 media_fill.gxa > media_fill.gxm +$> intel-gen4asm -g 8 -o <output> media_fill.gxm +
shaders/converter.py new file +26 -0
@@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +import struct +import sys +import argparse + +parser=argparse.ArgumentParser( + description='''Script for converting shaders from binary to hex ''' ) +parser = argparse.ArgumentParser(prog='converter.py', usage='%(prog)s binary_file') +parser.add_argument('binary', nargs=1, help='binary_file') +args=parser.parse_args() + +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 "\t{{ 0x{:08x}, 0x{:08x}, 0x{:08x}, 0x{:08x} }},".format(*val) + +print "};"
shaders/gpgpu/README deleted +0 -4
@@ -1,4 +0,0 @@ - -Commands used to generate the shader on gen7 -$> m4 gpgpu_fill.gxa > gpgpu_fill.gxm -$> intel-gen4asm -g 7 -o <output> gpgpu_fill.gxm
shaders/gpgpu/gpgpu_fill_gen8.asm new file +10 -0
@@ -0,0 +1,10 @@ + mov (4|M0) r1.0<1>:ub r1.0<0;1,0>:ub + mul (1|M0) r2.0<1>:ud r0.1<0;1,0>:ud 0x10:ud + mov (1|M0) r2.1<1>:ud r0.6<0;1,0>:ud + mov (8|M0) r4.0<1>:ud r0.0<8;8,1>:ud + mov (2|M0) r4.0<1>:ud r2.0<2;2,1>:ud + mov (1|M0) r4.2<1>:ud 0xF:ud + mov (16|M0) (eq)f0.0 r5.0<1>:ud r1.0<0;1,0>:ud + send (16|M0) acc0.0:uw r4:d 0xC 0x060A8000 // DP_DC1 wr:3h, rd:0, fc: 0x28000 + mov (8|M0) r112.0<1>:ud r0.0<8;8,1>:ud + send (16|M0) null:uw r112:d 0x27 0x02000010 {EOT} // SPAWNER wr:1, rd:0, fc: 0x10
shaders/gpgpu/gpgpu_fill_gen9.asm new file +10 -0
@@ -0,0 +1,10 @@ + mov (4|M0) r1.0<1>:ub r1.0<0;1,0>:ub + mul (1|M0) r2.0<1>:ud r0.1<0;1,0>:ud 0x10:ud + mov (1|M0) r2.1<1>:ud r0.6<0;1,0>:ud + mov (8|M0) r4.0<1>:ud r0.0<8;8,1>:ud + mov (2|M0) r4.0<1>:ud r2.0<2;2,1>:ud + mov (1|M0) r4.2<1>:ud 0xF:ud + mov (16|M0) r5.0<1>:ud r1.0<0;1,0>:ud + send (16|M0) acc0.0:uw r4:d 0xC 0x060A8000 // DP_DC1 wr:3h, rd:0, fc: 0x28000 + mov (8|M0) r112.0<1>:ud r0.0<8;8,1>:ud + send (16|M0) null:uw r112:d 0x27 0x02000010 {EOT} // SPAWNER wr:1, rd:0, fc: 0x10
shaders/media/README deleted +0 -5
@@ -1,5 +0,0 @@ -These files are here for reference only. - -Commands used to generate the shader on gen8 -$> m4 media_fill.gxa > media_fill.gxm -$> intel-gen4asm -g 8 -o <output> media_fill.gxm
shaders/media/media_fill_gen8.asm new file +11 -0
@@ -0,0 +1,11 @@ + mov (4|M0) r1.0<1>:ub r1.0<0;1,0>:ub + mov (8|M0) r4.0<1>:ud r0.0<8;8,1>:ud + mov (2|M0) r4.0<1>:ud r2.0<2;2,1>:ud + mov (1|M0) r4.2<1>:ud 0xF000F:ud + mov (16|M0) r5.0<1>:ud r1.0<0;1,0>:ud + mov (16|M0) r7.0<1>:ud r1.0<0;1,0>:ud + mov (16|M0) r9.0<1>:ud r1.0<0;1,0>:ud + mov (16|M0) r11.0<1>:ud r1.0<0;1,0>:ud + send (16|M0) acc0.0:uw r4:d 0x1000000C 0x120A8000 // DP_DC1 wr:9h, rd:0, fc: 0x28000 + mov (8|M0) r112.0<1>:ud r0.0<8;8,1>:ud + send (16|M0) null:uw r112:d 0x10000027 0x02000010 {EOT} // SPAWNER wr:1, rd:0, fc: 0x10
shaders/ps/README deleted +0 -1
@@ -1 +0,0 @@ -These files are here for reference only.
shaders/ps/blit_gen8.asm new file +7 -0
@@ -0,0 +1,7 @@ + pln (8|M0) r10.0<1>:f r6.0<0;1,0>:f r2.0<8;8,1>:f + pln (8|M0) r11.0<1>:f r6.0<0;1,0>:f r4.0<8;8,1>:f + pln (8|M0) r12.0<1>:f r6.4<0;1,0>:f r2.0<8;8,1>:f + pln (8|M0) 13.0<1>:f r6.4<0;1,0>:f r4.0<8;8,1>:f + send (16|M0) r112:f r10:ub 0x10000002 0x08840001 // SAMPLER wr:4, rd:8, fc: 0x40001 + send (16|M0) null:f r112:ub 0x10000025 0x10031000 {EOT} // DP_RC wr:8, rd:0, Render Target Write msc:16, to #0 +
shaders/ps/neg1_gen8.asm new file +9 -0
@@ -0,0 +1,9 @@ +mov(8) r112:ud 0x3f800000:ud +mov(8) r113:ud 0x3f800000:ud +mov(8) r114:ud 0x3f800000:ud +mov(8) r115:ud 0x3f800000:ud +mov(8) r116:ud 0x3f800000:ud +mov(8) r117:ud 0x3f800000:ud +mov(8) r118:ud 0x3f800000:ud +mov(8) r119:ud 0x3f800000:ud +send(16) null r112 0x25 0x10031000 { EOT }
Signature · 6 lines
2.17.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v2 2/2 lib/i915: Move shaders directory
In reply to Katarzyna DecIn shaders/ directory we got Intel specific information. As igt is a project for more vendors, let's move this directory to lib/i915.
v2: Changed shaders directory path in library files comments.
---
lib/gpgpu_fill.c | 2 +-
{shaders => lib/i915/shaders}/README | 0
{shaders => lib/i915/shaders}/converter.py | 0
{shaders => lib/i915/shaders}/gpgpu/gpgpu_fill.gxa | 0
{shaders => lib/i915/shaders}/gpgpu/gpgpu_fill_gen8.asm | 0
{shaders => lib/i915/shaders}/gpgpu/gpgpu_fill_gen9.asm | 0
{shaders => lib/i915/shaders}/media/media_fill.gxa | 0
{shaders => lib/i915/shaders}/media/media_fill_gen8.asm | 0
{shaders => lib/i915/shaders}/ps/blit.g7a | 0
{shaders => lib/i915/shaders}/ps/blit_gen8.asm | 0
{shaders => lib/i915/shaders}/ps/neg1_gen8.asm | 0
{shaders => lib/i915/shaders}/ps/neg1_test.g7a | 0
lib/rendercopy_gen8.c | 2 +-
lib/rendercopy_gen9.c | 2 +-
14 files changed, 3 insertions(+), 3 deletions(-)
rename {shaders => lib/i915/shaders}/README (100%)
rename {shaders => lib/i915/shaders}/converter.py (100%)
rename {shaders => lib/i915/shaders}/gpgpu/gpgpu_fill.gxa (100%)
rename {shaders => lib/i915/shaders}/gpgpu/gpgpu_fill_gen8.asm (100%)
rename {shaders => lib/i915/shaders}/gpgpu/gpgpu_fill_gen9.asm (100%)
rename {shaders => lib/i915/shaders}/media/media_fill.gxa (100%)
rename {shaders => lib/i915/shaders}/media/media_fill_gen8.asm (100%)
rename {shaders => lib/i915/shaders}/ps/blit.g7a (100%)
rename {shaders => lib/i915/shaders}/ps/blit_gen8.asm (100%)
rename {shaders => lib/i915/shaders}/ps/neg1_gen8.asm (100%)
rename {shaders => lib/i915/shaders}/ps/neg1_test.g7a (100%)lib/gpgpu_fill.c +1 -1
@@ -34,7 +34,7 @@#include "gpgpu_fill.h" #include "gpu_cmds.h" -/* shaders/gpgpu/gpgpu_fill.gxa */ +/* lib/i915/shaders/gpgpu/gpgpu_fill.gxa */ static const uint32_t gen7_gpgpu_kernel[][4 ] = { {0x00400001 ,0x20200231 ,0x00000020 ,0x00000000 }, {0x00000041 ,0x20400c21 ,0x00000004 ,0x00000010 },
lib/i915/shaders/README renamed from shaders/README +0 -0
lib/i915/shaders/converter.py renamed from shaders/converter.py +0 -0
lib/i915/shaders/gpgpu/gpgpu_fill.gxa renamed from shaders/gpgpu/gpgpu_fill.gxa +0 -0
lib/i915/shaders/gpgpu/gpgpu_fill_gen8.asm renamed from shaders/gpgpu/gpgpu_fill_gen8.asm +0 -0
lib/i915/shaders/gpgpu/gpgpu_fill_gen9.asm renamed from shaders/gpgpu/gpgpu_fill_gen9.asm +0 -0
lib/i915/shaders/media/media_fill.gxa renamed from shaders/media/media_fill.gxa +0 -0
lib/i915/shaders/media/media_fill_gen8.asm renamed from shaders/media/media_fill_gen8.asm +0 -0
lib/i915/shaders/ps/blit.g7a renamed from shaders/ps/blit.g7a +0 -0
lib/i915/shaders/ps/blit_gen8.asm renamed from shaders/ps/blit_gen8.asm +0 -0
lib/i915/shaders/ps/neg1_gen8.asm renamed from shaders/ps/neg1_gen8.asm +0 -0
lib/i915/shaders/ps/neg1_test.g7a renamed from shaders/ps/neg1_test.g7a +0 -0
lib/rendercopy_gen8.c +1 -1
@@ -48,7 +48,7 @@ struct {uint32_t sf_clip_state; } viewport; -/* see shaders/ps/blit.g7a */ +/* see lib/i915/shaders/ps/blit.g7a */ static const uint32_t ps_kernel[][4 ] = { #if 1 { 0x0080005a, 0x2f403ae8, 0x3a0000c0, 0x008d0040 },
lib/rendercopy_gen9.c +1 -1
@@ -49,7 +49,7 @@ struct {uint32_t sf_clip_state; } viewport; -/* see shaders/ps/blit.g7a */ +/* see lib/i915/shaders/ps/blit.g7a */ static const uint32_t ps_kernel[][4 ] = { #if 1 { 0x0080005a, 0x2f403ae8, 0x3a0000c0, 0x008d0040 },
Signature · 6 lines
2.17.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for Shaders documentation RESENDING (rev3)
In reply to Katarzyna Dec== Series Details ==
== Series Details ==
Series: Shaders documentation RESENDING (rev3)
URL : https://patchwork.freedesktop.org/series/50445/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_4918 -> IGTPW_1903 =
== Summary - SUCCESS ==
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/50445/revisions/3/mbox/
== Known issues ==
Here are the changes found in IGTPW_1903 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@drv_module_reload@basic-reload:
fi-glk-j4005: PASS -> DMESG-WARN (fdo#106725, fdo#106248)
igt@gem_exec_suspend@basic-s3:
fi-bdw-samus: PASS -> INCOMPLETE (fdo#107773)
igt@kms_flip@basic-flip-vs-wf_vblank:
fi-glk-j4005: PASS -> FAIL (fdo#100368)
igt@pm_rpm@module-reload:
fi-skl-6600u: PASS -> INCOMPLETE (fdo#107807) fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#106248 https://bugs.freedesktop.org/show_bug.cgi?id=106248
fdo#106725 https://bugs.freedesktop.org/show_bug.cgi?id=106725
fdo#107773 https://bugs.freedesktop.org/show_bug.cgi?id=107773
fdo#107807 https://bugs.freedesktop.org/show_bug.cgi?id=107807
== Participating hosts (48 -> 45) ==
Additional (1): fi-cfl-guc
Missing (4): fi-bsw-cyan fi-byt-squawks fi-icl-u2 fi-hsw-4200u
== Build changes ==
* IGT: IGT_4662 -> IGTPW_1903
CI_DRM_4918: f595aba3a6e2f6972bb158eb8434b58d22d0e5f0 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1903: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1903/
IGT_4662: ebf6a1dd1795e2f014ff3c47fe2eb4d5255845bd @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1903/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v2 1/2] shaders: Add assembler instructions and update README for shaders
In reply to Katarzyna DecQuoted 11 lines · Katarzyna Dec
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.
v2: Moved converter to single file. Fixed README for shaders.
v3: Fixed typos.
v4: Used python3 in converter. Added 'usage' section to script. Droped readme files for particular shaders and consolidated all needed information in one general file.
Quoted 5 lines
Signed-off-by Katarzyna Dec <[email protected]>Cc Arkadiusz Hiler <[email protected]>Cc Petri Latvala <[email protected]>Cc Kalamarz Lukasz <[email protected]>Cc Antonio Argenziano <[email protected]>
and merged, thanks!
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev