Mesa (main): aco/tests: Assert that the requested IR is actually provided
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 1 09:05:43 UTC 2021
Module: Mesa
Branch: main
Commit: b70e551a5131c6231e75f5ad24cb480694b07b67
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b70e551a5131c6231e75f5ad24cb480694b07b67
Author: Tony Wasserka <tony.wasserka at gmx.de>
Date: Tue Sep 28 17:59:43 2021 +0200
aco/tests: Assert that the requested IR is actually provided
In particular, assembly will not be provided if no disassembler is available
for the given GPU architecture.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>
---
src/amd/compiler/tests/helpers.cpp | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/src/amd/compiler/tests/helpers.cpp b/src/amd/compiler/tests/helpers.cpp
index ed15e35eb75..58303346a8d 100644
--- a/src/amd/compiler/tests/helpers.cpp
+++ b/src/amd/compiler/tests/helpers.cpp
@@ -386,28 +386,31 @@ void print_pipeline_ir(VkDevice device, VkPipeline pipeline, VkShaderStageFlagBi
result = GetPipelineExecutableInternalRepresentationsKHR(device, &exec_info, &ir_count, ir);
assert(result == VK_SUCCESS);
- for (unsigned i = 0; i < ir_count; i++) {
- if (strcmp(ir[i].name, name))
- continue;
+ VkPipelineExecutableInternalRepresentationKHR* requested_ir = nullptr;
+ for (unsigned i = 0; i < ir_count; ++i) {
+ if (strcmp(ir[i].name, name) == 0) {
+ requested_ir = &ir[i];
+ break;
+ }
+ }
+ assert(requested_ir && "Could not find requested IR");
- char *data = (char*)malloc(ir[i].dataSize);
- ir[i].pData = data;
- result = GetPipelineExecutableInternalRepresentationsKHR(device, &exec_info, &ir_count, ir);
- assert(result == VK_SUCCESS);
+ char *data = (char*)malloc(requested_ir->dataSize);
+ requested_ir->pData = data;
+ result = GetPipelineExecutableInternalRepresentationsKHR(device, &exec_info, &ir_count, ir);
+ assert(result == VK_SUCCESS);
- if (remove_encoding) {
- for (char *c = data; *c; c++) {
- if (*c == ';') {
- for (; *c && *c != '\n'; c++)
- *c = ' ';
- }
+ if (remove_encoding) {
+ for (char *c = data; *c; c++) {
+ if (*c == ';') {
+ for (; *c && *c != '\n'; c++)
+ *c = ' ';
}
}
-
- fprintf(output, "%s", data);
- free(data);
- return;
}
+
+ fprintf(output, "%s", data);
+ free(data);
}
VkShaderModule __qoCreateShaderModule(VkDevice dev, const QoShaderModuleCreateInfo *module_info)
More information about the mesa-commit
mailing list