From 08176d9d16ba495ee55bb148a0b71bd742c8973e Mon Sep 17 00:00:00 2001 From: Mark Janes Date: Fri, 9 Feb 2024 16:57:42 -0800 Subject: [PATCH] intel/tools: add shader compiler hash key to json devinfo format Offline shader compilation will use json as the source configuration to accurately instantiate mesa for target hardware. Similar platforms generate identical shader binaries even though intel_device_info differs inconsequenially. Include the shader compilation hash key to device info json files, so these platforms can be deduplicated. Closes: #6746 Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/tools/intel_dev_info.c | 10 ++++++++++ src/intel/tools/meson.build | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/intel/tools/intel_dev_info.c b/src/intel/tools/intel_dev_info.c index 6bbca5c495e..d0373dd2df3 100644 --- a/src/intel/tools/intel_dev_info.c +++ b/src/intel/tools/intel_dev_info.c @@ -38,6 +38,7 @@ #include "dev/intel_device_info.h" #include "dev/intel_device_info_serialize.h" #include "dev/intel_hwconfig.h" +#include "compiler/brw_compiler.h" static int error(char *fmt, ...) @@ -260,6 +261,15 @@ main(int argc, char *argv[]) if (print_json) { JSON_Value *json = intel_device_info_dump_json(&devinfo); + + /* add the compiler device sha, to allow deduplication of similar + * device info files + */ + JSON_Object *obj = json_object(json); + char device_info_sha[41]; + brw_device_sha1(device_info_sha, &devinfo); + json_object_set_string(obj, "shader_cache_sha1", device_info_sha); + char *pretty_string = json_serialize_to_string_pretty(json); printf("%s", pretty_string); json_free_serialized_string(pretty_string); diff --git a/src/intel/tools/meson.build b/src/intel/tools/meson.build index d84609b4b71..3d7c7133f39 100644 --- a/src/intel/tools/meson.build +++ b/src/intel/tools/meson.build @@ -185,7 +185,8 @@ if with_intel_tools intel_dev_info = executable( 'intel_dev_info', [files('intel_dev_info.c'), [intel_dev_serialize_src]], - dependencies : [dep_libdrm, dep_dl, dep_thread, dep_m, idep_intel_dev, idep_parson], + dependencies : [dep_libdrm, dep_dl, dep_thread, dep_m, idep_intel_dev, idep_parson, idep_nir], + link_with : [libintel_compiler], include_directories : [inc_include, inc_src, inc_intel], c_args : [no_override_init_args], gnu_symbol_visibility : 'hidden',