diff options
author | Andrzej Hajda <andrzej.hajda@intel.com> | 2024-06-27 09:25:02 +0200 |
---|---|---|
committer | Kamil Konieczny <kamil.konieczny@linux.intel.com> | 2024-07-02 17:32:33 +0200 |
commit | 04e219dbe77bb759afe43681bad810f9aabf84c1 (patch) | |
tree | d5a80d6996407bbbb84712af670de1b735ac0ff9 /lib/i915/perf_data_reader.c | |
parent | c0aa6326db14114f1ec1500d09ad9ef4e2cfa224 (diff) |
lib/gpgpu_shader: add inline support for iga64 assembly
With this patch adding iga64 assembly should be similar to
adding x86 assembly inline. Simple example:
emit_iga64_code(shdr, set_exception, R"ASM(
or (1|M0) cr0.1<1>:ud cr0.1<0;1,0>:ud ARG(0):ud
)ASM", value);
Note presence of 'ARG(0)', it will be replaced by 'value' argument,
multiple arguments are possible.
More sophisticated examples in following patches.
How does it works:
1. Raw string literals (C++ feature available in gcc as extension):
R"ASM(...)ASM" allows to use multiline/unescaped string literals.
If for some reason they cannot be used we could always fallback to
old ugly way of handling multiline strings with escape characters:
emit_iga64_code(shdr, set_exception, "\n\
or (1|M0) cr0.1<1>:ud cr0.1<0;1,0>:ud ARG(0):ud\n\
", value);
2. emit_iga64_code puts the assembly string into special linker section,
and calls __emit_iga64_code with pointer to external variable
which will contain code templates generated from the assembly for all
supported platforms, remaining arguments are put to temporal array
to eventually patch the code with positional arguments.
3. During build phase the linker section is scanned for assemblies.
Every assembly is preprocessed with cpp, to replace ARG(x) macros with
magic numbers, and to provide different code for different platforms
if needed. Then output file is compiled with iga64, and then .c file
is generated with global variables pointing to hexified iga64 codes.
v2:
- fixed meson paths to script,
- added check if compiler supports all platforms,
- include assembly names in MD5 calculations,
- use more specific name for MD5 sum
v3:
- bump minimal meson version to kill "ERROR: Expecting eol got id." bug
v4:
- set minimal meson to 0.49.2 - builder uses it
v5:
- revert back minimal ver of meson, instead use old syntax a.contains(b)
v6:
- generate_iga64_codes moved to scripts dir,
- added include guards to iga64_macros.h
v7:
- use C++ style comments in generated file,
- style fixes
v8:
- added sanity check for assembly
Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Zbigniew KempczyĆski <zbigniew.kempczynski@intel.com>
Diffstat (limited to 'lib/i915/perf_data_reader.c')
0 files changed, 0 insertions, 0 deletions