Skip to contentSkip to conversation

Shaders documentation

PATCH Superseded Katarzyna Dec 3 participants 5 messages Jun 14, 2018

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Shaders documentation

Since discussion about hw-tests directory is still going, I am submitting shaders documentation as a single patch. Let me know if this documentation is ok.
Any feedback is welcome.

Kasia :)

Cc Arkadiusz Hiler <[email protected]>
Cc Petri Latvala <[email protected]>
Cc Kalamarz Lukasz <[email protected]>
Cc Antonio Argenziano <[email protected]>

Katarzyna Dec (1):
shaders: Add assembler instructions and update README for shaders

 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
Signature · 6 lines
2.14.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

PATCH 1/1 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.

Cc Arkadiusz Hiler <[email protected]>
Cc Petri Latvala <[email protected]>
Cc Kalamarz Lukasz <[email protected]>
Cc Antonio Argenziano <[email protected]>
---
 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
shaders/README new file +37 -0
new file mode 100644
index 00000000..9e6bf410
@@ -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 "\t{{ 0x{:08x}, 0x{:08x}, 0x{:08x}, 0x{:08x} }},".format(*val)
+
+print "};"
\ No newline at end of file
shaders/gpgpu/README +11 -0
index 3bf328ad..91aca7e8 100644
@@ -1,4 +1,15 @@
+These files are here for reference only.
 
 Commands used to generate the shader on gen7
 $> m4 gpgpu_fill.gxa > gpgpu_fill.gxm
 $> intel-gen4asm -g 7 -o <output> gpgpu_fill.gxm
+
+From gen8 we can use Intel Graphics Assember to generate binary from asm
+instructions
+https://github.com/intel/intel-graphics-compiler/tree/master/visa/iga.
+
+
+How to get binary from .asm (e.g. when ISA instructions has changed):
+        $> iga64 gpgpu_fill.asm -p=8 -a -o gpgpu_fill_gen8.bin
+        $> Use converter from shaders/README to have hex array used in libs
+        $> Copy output to proper lib
shaders/gpgpu/gpgpu_fill_gen8.asm new file +10 -0
new file mode 100644
index 00000000..448e0256
@@ -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
new file mode 100644
index 00000000..6f948935
@@ -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 +9 -0
index 9f296010..dff53bd0 100644
@@ -3,3 +3,12 @@ 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
+
+From gen8 we can use Intel Graphics Assember to generate binary from asm
+instructions https://github.com/intel/intel-graphics-compiler/tree/master/visa/iga.
+
+How to get binary from .asm (e.g. when ISA instructions has changed):
+        $> iga64 media_fill_gen8.asm -p=8 -a -o media_fill_gen8.bin
+        $> Use converter from shaders/README to have hex array used in libs
+        $> Copy output to proper lib
+
shaders/media/media_fill_gen8.asm new file +11 -0
new file mode 100644
index 00000000..4b6eb84b
@@ -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 +8 -0
index b196d025..a4be135d 100644
@@ -1 +1,9 @@
 These files are here for reference only.
+
+From gen8 we can use Intel Graphics Assember to generate binary from asm
+instructions https://github.com/intel/intel-graphics-compiler/tree/master/visa/iga.
+
+How to get binary from .asm?
+        $> iga64 blit_gen8.asm -p=8 -a -o blit_gen8.bin
+        $> Use converter from shaders/README to have hex array used in libs
+        $> Copy output to proper lib
shaders/ps/blit_gen8.asm new file +7 -0
new file mode 100644
index 00000000..c35b70a1
@@ -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
new file mode 100644
index 00000000..582375b5
@@ -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.14.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#2 lore raw
In reply to Katarzyna Dec

Quoting Katarzyna Dec (2018-06-14 14:57:25)

Quoted 4 lines

Since discussion about hw-tests directory is still going, I am submitting shaders documentation as a single patch. Let me know if this documentation is ok.
Any feedback is welcome.

Same. Why a top level for something that is very i915 specific, and only used in very limited scenarios. Why the separation?
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for Shaders documentation

In reply to Katarzyna Dec
== Series Details ==

== Series Details ==

Series: Shaders documentation
URL : https://patchwork.freedesktop.org/series/44758/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4314 -> IGTPW_1461 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/44758/revisions/1/mbox/

== Known issues ==

Here are the changes found in IGTPW_1461 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@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
      fi-glk-j4005:       PASS -> FAIL (fdo#106765)

    igt@kms_flip@basic-flip-vs-dpms:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#106097, fdo#106000)

    igt@kms_flip@basic-flip-vs-modeset:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#105719)

    igt@kms_flip@basic-plain-flip:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#106097)

    igt@kms_frontbuffer_tracking@basic:
      fi-hsw-peppy:       PASS -> DMESG-FAIL (fdo#102614, fdo#106103)

    igt@prime_vgem@basic-fence-flip:
      fi-hsw-4770:        PASS -> FAIL (fdo#104008)

    
    ==== Possible fixes ====

    igt@debugfs_test@read_all_entries:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

    igt@gem_exec_suspend@basic-s4-devices:
      fi-kbl-7500u:       DMESG-WARN (fdo#105128) -> PASS

    igt@kms_flip@basic-flip-vs-wf_vblank:
      fi-cnl-psr:         FAIL (fdo#100368) -> PASS

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
fdo#105719 https://bugs.freedesktop.org/show_bug.cgi?id=105719
fdo#106000 https://bugs.freedesktop.org/show_bug.cgi?id=106000
fdo#106097 https://bugs.freedesktop.org/show_bug.cgi?id=106097
fdo#106103 https://bugs.freedesktop.org/show_bug.cgi?id=106103
fdo#106248 https://bugs.freedesktop.org/show_bug.cgi?id=106248
fdo#106725 https://bugs.freedesktop.org/show_bug.cgi?id=106725
fdo#106765 https://bugs.freedesktop.org/show_bug.cgi?id=106765

== Participating hosts (44 -> 38) ==

Missing (6): fi-ilk-m540 fi-hsw-4200u fi-cnl-y3 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600

== Build changes ==

* IGT: IGT_4518 -> IGTPW_1461

CI_DRM_4314: 2f4a101babe898ba750fa274dc90db1ede57d59c @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1461: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1461/
IGT_4518: e4908004547b63131352fbc0ddcdb1d3d55480e0 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1461/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#4 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for Shaders documentation

In reply to Katarzyna Dec
== Series Details ==

== Series Details ==

Series: Shaders documentation
URL : https://patchwork.freedesktop.org/series/44758/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4518_full -> IGTPW_1461_full =

== Summary - WARNING ==

Minor unknown changes coming with IGTPW_1461_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_1461_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/44758/revisions/1/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in IGTPW_1461_full:

=== IGT changes ===

    ==== Warnings ====

    igt@gem_exec_schedule@deep-render:
      shard-kbl:          PASS -> SKIP

    igt@gem_mocs_settings@mocs-rc6-vebox:
      shard-kbl:          SKIP -> PASS +2

== Known issues ==

Here are the changes found in IGTPW_1461_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_hangcheck:
      shard-apl:          PASS -> DMESG-FAIL (fdo#106560)

    igt@gem_busy@extended-semaphore-render:
      shard-snb:          SKIP -> INCOMPLETE (fdo#105411)

    igt@kms_flip@2x-plain-flip-ts-check-interruptible:
      shard-glk:          PASS -> FAIL (fdo#100368)

    igt@kms_flip@flip-vs-expired-vblank:
      shard-glk:          PASS -> FAIL (fdo#105363, fdo#102887)

    igt@kms_flip_tiling@flip-to-y-tiled:
      shard-glk:          PASS -> FAIL (fdo#103822, fdo#104724)

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-snb:          PASS -> FAIL (fdo#103166, fdo#104724)

    igt@kms_rotation_crc@primary-rotation-180:
      shard-snb:          PASS -> FAIL (fdo#104724, fdo#103925)

    igt@kms_setmode@basic:
      shard-hsw:          PASS -> FAIL (fdo#99912)

    
    ==== Possible fixes ====

    igt@gem_wait@await-bsd2:
      shard-snb:          INCOMPLETE (fdo#105411) -> SKIP

    igt@kms_atomic_transition@1x-modeset-transitions-nonblocking-fencing:
      shard-glk:          FAIL (fdo#105703) -> PASS

    igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
      shard-glk:          FAIL (fdo#105363) -> PASS

    igt@kms_flip@2x-plain-flip-fb-recreate-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS +1

    igt@kms_flip@2x-plain-flip-ts-check:
      shard-hsw:          FAIL (fdo#100368) -> PASS

    igt@kms_rotation_crc@sprite-rotation-180:
      shard-snb:          FAIL (fdo#104724, fdo#103925) -> PASS
      shard-hsw:          FAIL (fdo#104724, fdo#103925) -> PASS

    igt@kms_setmode@basic:
      shard-apl:          FAIL (fdo#99912) -> PASS

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103822 https://bugs.freedesktop.org/show_bug.cgi?id=103822
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#105703 https://bugs.freedesktop.org/show_bug.cgi?id=105703
fdo#106560 https://bugs.freedesktop.org/show_bug.cgi?id=106560
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

== Participating hosts (5 -> 5) ==

No changes in participating hosts

== Build changes ==

* IGT: IGT_4518 -> IGTPW_1461
* Linux: CI_DRM_4309 -> CI_DRM_4314

CI_DRM_4309: 2740c5b0d0f40092355b329a62ede8cced7f64b9 @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4314: 2f4a101babe898ba750fa274dc90db1ede57d59c @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1461: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1461/
IGT_4518: e4908004547b63131352fbc0ddcdb1d3d55480e0 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1461/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev