public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Michał Winiarski" <michal.winiarski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: [igt-dev] [PATCH i-g-t] lib/i915/shaders: Tweak converter.py
Date: Thu, 10 Jan 2019 15:23:53 +0100	[thread overview]
Message-ID: <20190110142353.5313-1-michal.winiarski@intel.com> (raw)

The converter contains #!python3, but is written in python2.
Let's fix that, and while I'm here let's also tweak the README.

Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Cc: Katarzyna Dec <katarzyna.dec@intel.com>
Cc: Kalamarz Lukasz <lukasz.kalamarz@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 lib/i915/shaders/README       | 12 +++++++-----
 lib/i915/shaders/converter.py | 20 +++++++++++---------
 2 files changed, 18 insertions(+), 14 deletions(-)
 mode change 100644 => 100755 lib/i915/shaders/converter.py

diff --git a/lib/i915/shaders/README b/lib/i915/shaders/README
index 06b9883c..9b7beb96 100644
--- a/lib/i915/shaders/README
+++ b/lib/i915/shaders/README
@@ -10,11 +10,6 @@ https://github.com/intel/intel-graphics-compiler
     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
@@ -23,3 +18,10 @@ Commands used to generate the shader on gen8
 $> m4 media_fill.gxa > media_fill.gxm
 $> intel-gen4asm -g 8 -o <output> media_fill.gxm
 
+Commands used to generate the shader using IGA on gen9
+$> iga64 -p=9 -a -o <output> gpgpu_fill_gen9.asm
+
+For maintaining compatibility with our tests there is a bin to hex converter
+written in python
+$> converter.py input_file > output_file
+$> converter.py gen9_iga_output > gen9_hex_array
diff --git a/lib/i915/shaders/converter.py b/lib/i915/shaders/converter.py
old mode 100644
new mode 100755
index 25a79a94..9dea0b75
--- a/lib/i915/shaders/converter.py
+++ b/lib/i915/shaders/converter.py
@@ -1,16 +1,18 @@
 #!/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 = argparse.ArgumentParser(
+        prog='converter.py',
+        description='Script for converting shaders from binary to hex',
+        usage='%(prog)s binary_file')
 parser.add_argument('binary', nargs=1, help='binary_file')
-args=parser.parse_args()
+args = parser.parse_args()
 
-print "static const uint32_t kernel[][4] = {"
-with open(sys.argv[1], 'r') as f:
+print("static const uint32_t kernel[][4] = {")
+with open(sys.argv[1], 'rb') as f:
     fmt = '<LLLL'
     step = struct.calcsize(fmt)
     while True:
@@ -18,9 +20,9 @@ with open(sys.argv[1], 'r') as f:
         if not buf:
             break
         elif len(buf) < step:
-            buf += '\x00' * (step - len(buf))
+            buf += b'\x00' * (step - len(buf))
 
         val = struct.unpack('<LLLL', buf)
-        print "\t{{ 0x{:08x}, 0x{:08x}, 0x{:08x}, 0x{:08x} }},".format(*val)
+        print("\t{{ 0x{:08x}, 0x{:08x}, 0x{:08x}, 0x{:08x} }},".format(*val))
 
-print "};"
+print("};")
-- 
2.19.2

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2019-01-10 14:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10 14:23 Michał Winiarski [this message]
2019-01-10 14:37 ` [igt-dev] [PATCH i-g-t] lib/i915/shaders: Tweak converter.py Katarzyna Dec
2019-01-10 15:58 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-01-10 22:36 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190110142353.5313-1-michal.winiarski@intel.com \
    --to=michal.winiarski@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tvrtko.ursulin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox