Ejemplo n.º 1
0
def parse_arguments():
    parser = argparse.ArgumentParser(description='Parse execution data log stream.')
    parser.add_argument('input_file', metavar='INFILE', type=str, 
            help='FDR file')
    parser.add_argument('--rules-file', metavar='RULESFILE', type=str, 
            help='State map definition file (rules-ng-ng)',
            default=rnndb_path('state.xml'))
    parser.add_argument('--cmdstream-file', metavar='CMDSTREAMFILE', type=str, 
            help='Command stream definition file (rules-ng-ng)',
            default=rnndb_path('cmdstream.xml'))
    parser.add_argument('-l', '--hide-load-state', dest='hide_load_state',
            default=False, action='store_const', const=True,
            help='Hide "LOAD_STATE" entries, this can make command stream a bit easier to read')
    parser.add_argument('-b', '--binary', dest='binary',
            default=False, action='store_const', const=True,
            help='Input is in binary')
    parser.add_argument('-g', '--galcore', dest='galcore',
            default=False, action='store_const', const=True,
            help='Input is in galcore or etnaviv dmesg format')
    parser.add_argument('--output-c', dest='output_c',
            default=False, action='store_const', const=True,
            help='Print command buffer emission in C format')
    parser.add_argument('--output-c-raw', dest='output_c_raw',
            default=False, action='store_const', const=True,
            help='Print command buffer emission in C raw command stream emit format')
    return parser.parse_args()        
Ejemplo n.º 2
0
def parse_arguments():
    parser = argparse.ArgumentParser(description='Parse execution data log stream.')
    parser.add_argument('input', metavar='INFILE', type=str, 
            help='FDR file')
    parser.add_argument('struct_file', metavar='STRUCTFILE', type=str, 
            help='Structures definition file')
    parser.add_argument('--rules-file', metavar='RULESFILE', type=str, 
            help='State map definition file (rules-ng-ng)',
            default=rnndb_path('state.xml'))
    parser.add_argument('-l', '--hide-load-state', dest='hide_load_state',
            default=False, action='store_const', const=True,
            help='Hide "LOAD_STATE" entries, this can make command stream a bit easier to read')
    parser.add_argument('--show-state-map', dest='show_state_map',
            default=False, action='store_const', const=True,
            help='Expand state map from context (verbose!)')
    parser.add_argument('--show-context-commands', dest='show_context_commands',
            default=False, action='store_const', const=True,
            help='Expand context command buffer (verbose!)')
    parser.add_argument('--show-context-buffer', dest='show_context_buffer',
            default=False, action='store_const', const=True,
            help='Expand context CPU buffer (verbose!)')
    parser.add_argument('--list-address-states', dest='list_address_states',
            default=False, action='store_const', const=True,
            help='When dumping command buffer, provide list of states that contain GPU addresses')
    parser.add_argument('--dump-shaders', dest='dump_shaders',
            default=False, action='store_const', const=True,
            help='Dump shaders to file')
    return parser.parse_args()        
Ejemplo n.º 3
0
def parse_arguments():
    parser = argparse.ArgumentParser(description='Disassemble shader')
    parser.add_argument('--isa-file',
                        metavar='ISAFILE',
                        type=str,
                        help='Shader ISA definition file (rules-ng-ng)',
                        default=rnndb_path('isa.xml'))
    parser.add_argument('input',
                        metavar='INFILE',
                        type=str,
                        help='Shader assembly file')
    #parser.add_argument('output', metavar='OUTFILE', type=str,
    #        help='Binary shader file')
    #parser.add_argument('-a', dest='addr',
    #        default=False, action='store_const', const=True,
    #        help='Show address data with instructions')
    parser.add_argument('-a',
                        dest='addr',
                        default=False,
                        action='store_const',
                        const=True,
                        help='Show address with instructions')
    parser.add_argument('-o',
                        dest='bin_out',
                        type=str,
                        help='Write binary shader to output file')
    parser.add_argument(
        '-m',
        dest='model',
        type=str,
        default='GC2000',
        help='GPU type to assemble for (GC2000 or GC3000, default GC3000)')
    return parser.parse_args()
Ejemplo n.º 4
0
def parse_arguments():
    parser = argparse.ArgumentParser(description='Disassemble shader')
    parser.add_argument('--isa-file',
                        metavar='ISAFILE',
                        type=str,
                        help='Shader ISA definition file (rules-ng-ng)',
                        default=rnndb_path('isa.xml'))
    parser.add_argument('input',
                        metavar='INFILE',
                        type=str,
                        help='Binary shader file')
    parser.add_argument('-a',
                        dest='addr',
                        default=True,
                        action='store_const',
                        const=False,
                        help='Show no address with instructions')
    parser.add_argument('-r',
                        dest='raw',
                        default=False,
                        action='store_const',
                        const=True,
                        help='Show raw data with instructions')
    parser.add_argument(
        '-c',
        dest='cfmt',
        default=False,
        action='store_const',
        const=True,
        help='Output in format suitable for inclusion in C source')
    return parser.parse_args()
Ejemplo n.º 5
0
def parse_arguments():
    parser = argparse.ArgumentParser(description='Disassemble shader')
    parser.add_argument('--isa-file', metavar='ISAFILE', type=str, 
            help='Shader ISA definition file (rules-ng-ng)',
            default=rnndb_path('isa.xml'))
    parser.add_argument('input', metavar='INFILE', type=str, 
            help='Binary shader file')
    parser.add_argument('-a', dest='addr',
            default=True, action='store_const', const=False,
            help='Show no address with instructions')
    parser.add_argument('-r', dest='raw',
            default=False, action='store_const', const=True,
            help='Show raw data with instructions')
    parser.add_argument('-c', dest='cfmt',
            default=False, action='store_const', const=True,
            help='Output in format suitable for inclusion in C source')
    parser.add_argument('-t', dest='ifmt',
            default=False, action='store_const', const=True,
            help='Input comma-separated integers instead of binary shader')
    parser.add_argument('-m', dest='model',
            type=str, default='GC2000',
            help='GPU type to disassemble for (GC2000 or GC3000, default GC3000)')
    parser.add_argument('--isa-flags', dest='isa_flags',
            type=str, default='',
            help=('ISA flags (available: %s)' % Flags.available()))
    return parser.parse_args()
Ejemplo n.º 6
0
def parse_arguments():
    parser = argparse.ArgumentParser(
        description='Parse execution data log stream.')
    parser.add_argument('input', metavar='INFILE', type=str, help='FDR file')
    parser.add_argument('struct_file',
                        metavar='STRUCTFILE',
                        type=str,
                        help='Structures definition file')
    parser.add_argument('--rules-file',
                        metavar='RULESFILE',
                        type=str,
                        help='State map definition file (rules-ng-ng)',
                        default=rnndb_path('state.xml'))
    parser.add_argument(
        '-l',
        '--hide-load-state',
        dest='hide_load_state',
        default=False,
        action='store_const',
        const=True,
        help=
        'Hide "LOAD_STATE" entries, this can make command stream a bit easier to read'
    )
    parser.add_argument('--show-state-map',
                        dest='show_state_map',
                        default=False,
                        action='store_const',
                        const=True,
                        help='Expand state map from context (verbose!)')
    parser.add_argument('--show-context-commands',
                        dest='show_context_commands',
                        default=False,
                        action='store_const',
                        const=True,
                        help='Expand context command buffer (verbose!)')
    parser.add_argument('--show-context-buffer',
                        dest='show_context_buffer',
                        default=False,
                        action='store_const',
                        const=True,
                        help='Expand context CPU buffer (verbose!)')
    parser.add_argument(
        '--list-address-states',
        dest='list_address_states',
        default=False,
        action='store_const',
        const=True,
        help=
        'When dumping command buffer, provide list of states that contain GPU addresses'
    )
    parser.add_argument('--dump-shaders',
                        dest='dump_shaders',
                        default=False,
                        action='store_const',
                        const=True,
                        help='Dump shaders to file')
    return parser.parse_args()
Ejemplo n.º 7
0
def parse_args():
    parser = argparse.ArgumentParser(description='Generate state merge function')
    parser.add_argument('--input', metavar='INFILE', type=str, 
            help='State definition file',
            default='data/viv_gallium_state.txt')
    parser.add_argument('--rules-file', metavar='RULESFILE', type=str, 
            help='State map definition file (rules-ng-ng)',
            default=rnndb_path('state.xml'))

    return parser.parse_args()        
Ejemplo n.º 8
0
def parse_arguments():
    parser = argparse.ArgumentParser(description='Parse execution data log stream.')
    parser.add_argument('input_file', metavar='INFILE', type=str, 
            help='FDR file')
    parser.add_argument('--rules-file', metavar='RULESFILE', type=str, 
            help='State map definition file (rules-ng-ng)',
            default=rnndb_path('state.xml'))
    parser.add_argument('-l', '--hide-load-state', dest='hide_load_state',
            default=False, action='store_const', const=True,
            help='Hide "LOAD_STATE" entries, this can make command stream a bit easier to read')
    return parser.parse_args()        
Ejemplo n.º 9
0
def parse_arguments():
    parser = argparse.ArgumentParser(description='Parse execution data log stream.')
    parser.add_argument('input_file', metavar='INFILE', type=str, 
            help='FDR file')
    parser.add_argument('--rules-file', metavar='RULESFILE', type=str, 
            help='State map definition file (rules-ng-ng)',
            default=rnndb_path('state.xml'))
    parser.add_argument('-l', '--hide-load-state', dest='hide_load_state',
            default=False, action='store_const', const=True,
            help='Hide "LOAD_STATE" entries, this can make command stream a bit easier to read')
    return parser.parse_args()        
Ejemplo n.º 10
0
def parse_arguments():
    parser = argparse.ArgumentParser(description='Parse execution data log stream.')
    parser.add_argument('input', metavar='INFILE', type=str, 
            help='FDR file')
    parser.add_argument('struct_file', metavar='STRUCTFILE', type=str, 
            help='Structures definition file', default=None, nargs='?')
    parser.add_argument('--rules-file', metavar='RULESFILE', type=str, 
            help='State map definition file (rules-ng-ng)',
            default=rnndb_path('state.xml'))
    parser.add_argument('--cmdstream-file', metavar='CMDSTREAMFILE', type=str, 
            help='Command stream definition file (rules-ng-ng)',
            default=rnndb_path('cmdstream.xml'))
    parser.add_argument('-l', '--hide-load-state', dest='hide_load_state',
            default=False, action='store_const', const=True,
            help='Hide "LOAD_STATE" entries, this can make command stream a bit easier to read')
    parser.add_argument('--show-state-map', dest='show_state_map',
            default=False, action='store_const', const=True,
            help='Expand state map from context (verbose!)')
    parser.add_argument('--show-context-buffer', dest='show_context_buffer',
            default=False, action='store_const', const=True,
            help='Expand context CPU buffer (verbose!)')
    parser.add_argument('--list-address-states', dest='list_address_states',
            default=False, action='store_const', const=True,
            help='When dumping command buffer, provide list of states that contain GPU addresses')
    parser.add_argument('--dump-shaders', dest='dump_shaders',
            default=False, action='store_const', const=True,
            help='Dump shaders to file')
    parser.add_argument('--dump-cmdbufs', dest='dump_cmdbufs',
            default=False, action='store_const', const=True,
            help='Dump command buffers to file')
    parser.add_argument('--output-c', dest='output_c',
            default=False, action='store_const', const=True,
            help='Print command buffer emission in C format')
    parser.add_argument('--txdesc-file', metavar='TXDESCFILE', type=str, 
            help='Texture descriptionp definition file (rules-ng-ng)',
            default=rnndb_path('texdesc_3d.xml'))
    parser.add_argument('-s', '--summary', dest='summary',
            default=False, action='store_const', const=True,
            help='Crude summary: for now, show only submitted command buffers')
    return parser.parse_args()        
Ejemplo n.º 11
0
def parse_arguments():
    parser = argparse.ArgumentParser(description='Disassemble shader')
    parser.add_argument('--isa-file', metavar='ISAFILE', type=str, 
            help='Shader ISA definition file (rules-ng-ng)',
            default=rnndb_path('isa.xml'))
    parser.add_argument('input', metavar='INFILE', type=str, 
            help='Binary shader file')
    parser.add_argument('-a', dest='addr',
            default=False, action='store_const', const=True,
            help='Show address data with instructions')
    parser.add_argument('-r', dest='raw',
            default=False, action='store_const', const=True,
            help='Show raw data with instructions')
    return parser.parse_args()        
Ejemplo n.º 12
0
def parse_arguments():
    parser = argparse.ArgumentParser(description='Disassemble shader')
    parser.add_argument('--isa-file',
                        metavar='ISAFILE',
                        type=str,
                        help='Shader ISA definition file (rules-ng-ng)',
                        default=rnndb_path('isa.xml'))
    parser.add_argument('input',
                        metavar='INFILE',
                        type=str,
                        help='Binary shader file')
    parser.add_argument('-a',
                        dest='addr',
                        default=True,
                        action='store_const',
                        const=False,
                        help='Show no address with instructions')
    parser.add_argument('-r',
                        dest='raw',
                        default=False,
                        action='store_const',
                        const=True,
                        help='Show raw data with instructions')
    parser.add_argument(
        '-c',
        dest='cfmt',
        default=False,
        action='store_const',
        const=True,
        help='Output in format suitable for inclusion in C source')
    parser.add_argument(
        '-t',
        dest='ifmt',
        default=False,
        action='store_const',
        const=True,
        help='Input comma-separated integers instead of binary shader')
    parser.add_argument(
        '-m',
        dest='model',
        type=str,
        default='GC2000',
        help='GPU type to disassemble for (GC2000 or GC3000, default GC3000)')
    parser.add_argument('--isa-flags',
                        dest='isa_flags',
                        type=str,
                        default='',
                        help=('ISA flags (available: %s)' % Flags.available()))
    return parser.parse_args()
Ejemplo n.º 13
0
def parse_args():
    parser = argparse.ArgumentParser(
        description='Generate state merge function')
    parser.add_argument('--input',
                        metavar='INFILE',
                        type=str,
                        help='State definition file',
                        default='data/viv_gallium_state.txt')
    parser.add_argument('--rules-file',
                        metavar='RULESFILE',
                        type=str,
                        help='State map definition file (rules-ng-ng)',
                        default=rnndb_path('state.xml'))

    return parser.parse_args()
Ejemplo n.º 14
0
def parse_arguments():
    parser = argparse.ArgumentParser(description='Disassemble shader')
    parser.add_argument('--isa-file', metavar='ISAFILE', type=str, 
            help='Shader ISA definition file (rules-ng-ng)',
            default=rnndb_path('isa.xml'))
    parser.add_argument('input', metavar='INFILE', type=str, 
            help='Shader assembly file')
    #parser.add_argument('output', metavar='OUTFILE', type=str, 
    #        help='Binary shader file')
    #parser.add_argument('-a', dest='addr',
    #        default=False, action='store_const', const=True,
    #        help='Show address data with instructions')
    parser.add_argument('-a', dest='addr',
            default=False, action='store_const', const=True,
            help='Show address with instructions')
    parser.add_argument('-o', dest='bin_out', type=str,
            help='Write binary shader to output file')
    parser.add_argument('-m', dest='model',
            type=str, default='GC2000',
            help='GPU type to assemble for (GC2000 or GC3000, default GC3000)')
    parser.add_argument('--isa-flags', dest='isa_flags',
            type=str, default='',
            help=('ISA flags, comma separated (available: %s)' % Flags.available()))
    return parser.parse_args()        
Ejemplo n.º 15
0
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
from __future__ import print_function, division, unicode_literals
import argparse
import json, cgi
from etnaviv.util import rnndb_path
from etnaviv.parse_rng import parse_rng_file, format_path, BitSet, Domain
import sys

GPUS_FILE = 'data/gpus.json'
STATE_MAP = rnndb_path('state.xml')

class Cell(object):
    def __init__(self, row, column, value, rowspan=1, colspan=1, cls=None):
        self.row = row
        self.column = column
        self.rowspan = rowspan
        self.colspan = colspan
        self.value = value
        self.cls = cls

def main():
    parser = argparse.ArgumentParser(description='Compare GCxxx chips.')
    parser.add_argument('-i', dest='gpus_file', metavar='GPUSFILE', type=str, 
            help='gpus.json file', default=GPUS_FILE)
    parser.add_argument('-s', dest='state_xml_file', metavar='STATEXML', type=str, 
Ejemplo n.º 16
0
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
from __future__ import print_function, division, unicode_literals
import argparse
import json, cgi
from etnaviv.util import rnndb_path
from etnaviv.parse_rng import parse_rng_file, format_path, BitSet, Domain
import sys

GPUS_FILE = 'data/gpus.json'
STATE_MAP = rnndb_path('state.xml')

class Cell(object):
    def __init__(self, row, column, value, rowspan=1, colspan=1, cls=None):
        self.row = row
        self.column = column
        self.rowspan = rowspan
        self.colspan = colspan
        self.value = value
        self.cls = cls

def main():
    parser = argparse.ArgumentParser(description='Compare GCxxx chips.')
    parser.add_argument('-i', dest='gpus_file', metavar='GPUSFILE', type=str, 
            help='gpus.json file', default=GPUS_FILE)
    parser.add_argument('-s', dest='state_xml_file', metavar='STATEXML', type=str, 
Ejemplo n.º 17
0
    Usage:
      gpu-inspect <resource>
    """

    def __init__ (self):
        super(GPUInspect, self).__init__ ("gpu-inspect", gdb.COMMAND_USER)

    def invoke(self, arg, from_tty):
        self.dont_repeat()
        arg = gdb.string_to_argv(arg)
        arg[0] = gdb.parse_and_eval(arg[0])
        etna_resource_type = gdb.lookup_type('struct etna_resource').pointer()
        res = arg[0].cast(etna_resource_type)
        # this is very, very primitive now
        # dump first 128 bytes of level 0 by default, as floats
        # XXX make this more flexible
        logical = res['levels'][0]['logical']
        size = 128
        buffer = indirect_memcpy(logical, logical+size)
        data = struct.unpack_from(b'%df' % (len(buffer)/4), buffer)
        print(data)

state_xml = parse_rng_file(rnndb_path('state.xml'))
isa_xml = parse_rng_file(rnndb_path('isa.xml'))

GPUState(state_xml)
GPUDisassemble(isa_xml) 
GPUTrace(state_xml)
GPUInspect()

Ejemplo n.º 18
0
    Usage:
      gpu-inspect <resource>
    """

    def __init__ (self):
        super(GPUInspect, self).__init__ ("gpu-inspect", gdb.COMMAND_USER)

    def invoke(self, arg, from_tty):
        self.dont_repeat()
        arg = gdb.string_to_argv(arg)
        arg[0] = gdb.parse_and_eval(arg[0])
        etna_resource_type = gdb.lookup_type('struct etna_resource').pointer()
        res = arg[0].cast(etna_resource_type)
        # this is very, very primitive now
        # dump first 128 bytes of level 0 by default, as floats
        # XXX make this more flexible
        logical = res['levels'][0]['logical']
        size = 128
        buffer = indirect_memcpy(logical, logical+size)
        data = struct.unpack_from(b'%df' % (len(buffer)/4), buffer)
        print(data)

state_xml = parse_rng_file(rnndb_path('state.xml'))
isa_xml = parse_rng_file(rnndb_path('isa.xml'))

GPUState(state_xml)
GPUDisassemble(isa_xml) 
GPUTrace(state_xml)
GPUInspect()