mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 19:00:13 +01:00
radv/tests: add a test to verify that pipeline hash matches RGP<->Fossilize
Very useful to get the fossil from one RGP capture. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33875>
This commit is contained in:
parent
3da9d6dac9
commit
8abe6beb3c
1 changed files with 71 additions and 0 deletions
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "util/macros.h"
|
||||
#include "helpers.h"
|
||||
|
||||
class misc : public radv_test {};
|
||||
|
|
@ -44,3 +45,73 @@ TEST_F(misc, invariant_pipeline_cache_uuid)
|
|||
|
||||
destroy_device();
|
||||
}
|
||||
|
||||
/**
|
||||
* This test verifies that the pipeline hash returned when shader stats are captured (eg. Fossilize)
|
||||
* matches the pipeline hash returned when RGP is enabled.
|
||||
*/
|
||||
TEST_F(misc, pipeline_hash_rgp_fossilize)
|
||||
{
|
||||
|
||||
create_device();
|
||||
|
||||
/*
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 460
|
||||
OpName %main "main"
|
||||
OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
*/
|
||||
unsigned char code[] = {
|
||||
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x00, 0x08, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c,
|
||||
0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x05, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||
0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00,
|
||||
0x00, 0x00, 0xcc, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00,
|
||||
0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00,
|
||||
0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
|
||||
0x00, 0x15, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00,
|
||||
0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06,
|
||||
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00,
|
||||
0x09, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05,
|
||||
0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00,
|
||||
0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00};
|
||||
|
||||
uint64_t pipeline_hash;
|
||||
|
||||
/* Create a simple compute pipeline that captures shader statistics (like Fossilize) and get the pipeline hash. */
|
||||
create_compute_pipeline(ARRAY_SIZE(code), (uint32_t *)code, VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR);
|
||||
pipeline_hash = get_pipeline_hash(VK_SHADER_STAGE_COMPUTE_BIT);
|
||||
EXPECT_NE(pipeline_hash, 0);
|
||||
destroy_pipeline();
|
||||
|
||||
destroy_device();
|
||||
|
||||
/* RADV_THREAD_TRACE_CACHE_COUNTERS needs to be disabled with noop device. */
|
||||
add_envvar("RADV_THREAD_TRACE_CACHE_COUNTERS", "false");
|
||||
add_envvar("MESA_VK_TRACE", "rgp");
|
||||
|
||||
create_device();
|
||||
|
||||
/* Verify the pipeline hash matches. */
|
||||
create_compute_pipeline(ARRAY_SIZE(code), (uint32_t *)code);
|
||||
EXPECT_EQ(pipeline_hash, get_pipeline_hash(VK_SHADER_STAGE_COMPUTE_BIT));
|
||||
destroy_pipeline();
|
||||
|
||||
destroy_device();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue