From 4d8653a643ab404fee213e698aeb78cd55dd2839 Mon Sep 17 00:00:00 2001 From: Simon Perretta Date: Thu, 9 May 2024 19:50:29 +0100 Subject: [PATCH] pco: pygen stubs Signed-off-by: Simon Perretta Acked-by: Frank Binns Part-of: --- src/imagination/pco/meson.build | 44 +++++++++++++++++++++++-- src/imagination/pco/pco_common.h.py | 32 ++++++++++++++++++ src/imagination/pco/pco_internal.h | 2 ++ src/imagination/pco/pco_isa.h.py | 32 ++++++++++++++++++ src/imagination/pco/pco_isa.py | 4 +++ src/imagination/pco/pco_ops.h.py | 34 +++++++++++++++++++ src/imagination/pco/pco_ops.py | 4 +++ src/imagination/pco/pco_pygen_common.py | 13 ++++++++ 8 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 src/imagination/pco/pco_common.h.py create mode 100644 src/imagination/pco/pco_isa.h.py create mode 100644 src/imagination/pco/pco_isa.py create mode 100644 src/imagination/pco/pco_ops.h.py create mode 100644 src/imagination/pco/pco_ops.py create mode 100644 src/imagination/pco/pco_pygen_common.py diff --git a/src/imagination/pco/meson.build b/src/imagination/pco/meson.build index 5ecc434261a..84e5e6e33a0 100644 --- a/src/imagination/pco/meson.build +++ b/src/imagination/pco/meson.build @@ -12,9 +12,49 @@ libpowervr_compiler_files = files( 'pco_trans_nir.c', ) +pco_pygen_dep_files = files('pco_pygen_common.py', 'pco_isa.py', 'pco_ops.py') + +pco_common_h = custom_target( + 'pco_common.h', + input : ['pco_common.h.py'], + output : 'pco_common.h', + command : [prog_python, '@INPUT@'], + capture : true, + depend_files : pco_pygen_dep_files, +) + +pco_isa_h = custom_target( + 'pco_isa.h', + input : ['pco_isa.h.py'], + output : 'pco_isa.h', + command : [prog_python, '@INPUT@'], + capture : true, + depend_files : pco_pygen_dep_files, +) + +pco_ops_h = custom_target( + 'pco_ops.h', + input : ['pco_ops.h.py'], + output : 'pco_ops.h', + command : [prog_python, '@INPUT@'], + capture : true, + depend_files : pco_pygen_dep_files, +) + +idep_pco_pygen = declare_dependency( + sources : [ + pco_common_h, + pco_isa_h, + pco_ops_h, + ], + include_directories : inc_powervr_compiler, +) + +pco_pygen_c_files = [] + libpowervr_compiler = static_library( 'powervr_compiler', - [libpowervr_compiler_files], + [libpowervr_compiler_files, pco_pygen_c_files], include_directories : [ inc_imagination, inc_powervr_compiler, @@ -24,7 +64,7 @@ libpowervr_compiler = static_library( ], # Suppress 'parameter passing for argument of type ... changed in GCC ...' warnings. c_args : [imagination_c_args, no_override_init_args, '-Wno-psabi'], - dependencies : [idep_mesautil, idep_nir], + dependencies : [idep_mesautil, idep_nir, idep_pco_pygen], gnu_symbol_visibility : 'hidden', install : false, ) diff --git a/src/imagination/pco/pco_common.h.py b/src/imagination/pco/pco_common.h.py new file mode 100644 index 00000000000..af5d34eb8c6 --- /dev/null +++ b/src/imagination/pco/pco_common.h.py @@ -0,0 +1,32 @@ +# Copyright © 2024 Imagination Technologies Ltd. +# SPDX-License-Identifier: MIT + +from mako.template import Template +from pco_pygen_common import * + +template = """/* + * Copyright © 2024 Imagination Technologies Ltd. + * + * SPDX-License-Identifier: MIT + */ + +#ifndef PCO_COMMON_H +#define PCO_COMMON_H + +/** + * \\file pco_common.h + * + * \\brief PCO common definitions. + */ + +#include "util/macros.h" + +#include + +#endif /* PCO_COMMON_H */""" + +def main(): + print(Template(template).render()) + +if __name__ == '__main__': + main() diff --git a/src/imagination/pco/pco_internal.h b/src/imagination/pco/pco_internal.h index 3031b8fef91..77525cf876a 100644 --- a/src/imagination/pco/pco_internal.h +++ b/src/imagination/pco/pco_internal.h @@ -13,7 +13,9 @@ * \brief PCO internal header. */ +#include "compiler/spirv/nir_spirv.h" #include "pco.h" +#include "pco_common.h" #include "spirv/nir_spirv.h" #include "util/macros.h" diff --git a/src/imagination/pco/pco_isa.h.py b/src/imagination/pco/pco_isa.h.py new file mode 100644 index 00000000000..083b0c8d382 --- /dev/null +++ b/src/imagination/pco/pco_isa.h.py @@ -0,0 +1,32 @@ +# Copyright © 2024 Imagination Technologies Ltd. +# SPDX-License-Identifier: MIT + +from mako.template import Template +from pco_isa import * + +template = """/* + * Copyright © 2024 Imagination Technologies Ltd. + * + * SPDX-License-Identifier: MIT + */ + +#ifndef PCO_ISA_H +#define PCO_ISA_H + +/** + * \\file pco_isa.h + * + * \\brief PCO ISA definitions. + */ + +#include "util/macros.h" + +#include + +#endif /* PCO_ISA_H */""" + +def main(): + print(Template(template).render()) + +if __name__ == '__main__': + main() diff --git a/src/imagination/pco/pco_isa.py b/src/imagination/pco/pco_isa.py new file mode 100644 index 00000000000..53cea5a69f1 --- /dev/null +++ b/src/imagination/pco/pco_isa.py @@ -0,0 +1,4 @@ +# Copyright © 2024 Imagination Technologies Ltd. +# SPDX-License-Identifier: MIT + +from pco_pygen_common import * diff --git a/src/imagination/pco/pco_ops.h.py b/src/imagination/pco/pco_ops.h.py new file mode 100644 index 00000000000..1b929591da4 --- /dev/null +++ b/src/imagination/pco/pco_ops.h.py @@ -0,0 +1,34 @@ +# Copyright © 2024 Imagination Technologies Ltd. +# SPDX-License-Identifier: MIT + +from mako.template import Template +from pco_ops import * + +template = """/* + * Copyright © 2024 Imagination Technologies Ltd. + * + * SPDX-License-Identifier: MIT + */ + +#ifndef PCO_OPS_H +#define PCO_OPS_H + +/** + * \\file pco_ops.h + * + * \\brief PCO op definitions and functions. + */ + +#include "util/macros.h" + +#include +#include +#include + +#endif /* PCO_OPS_H */""" + +def main(): + print(Template(template).render()) + +if __name__ == '__main__': + main() diff --git a/src/imagination/pco/pco_ops.py b/src/imagination/pco/pco_ops.py new file mode 100644 index 00000000000..53cea5a69f1 --- /dev/null +++ b/src/imagination/pco/pco_ops.py @@ -0,0 +1,4 @@ +# Copyright © 2024 Imagination Technologies Ltd. +# SPDX-License-Identifier: MIT + +from pco_pygen_common import * diff --git a/src/imagination/pco/pco_pygen_common.py b/src/imagination/pco/pco_pygen_common.py new file mode 100644 index 00000000000..3634f783fa1 --- /dev/null +++ b/src/imagination/pco/pco_pygen_common.py @@ -0,0 +1,13 @@ +# Copyright © 2024 Imagination Technologies Ltd. +# SPDX-License-Identifier: MIT + +from enum import Enum, auto + +_ = None + +prefix = 'pco' + +class BaseType(Enum): + bool = auto() + uint = auto() + enum = auto()