-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add metric for 3D texture max concurrent cache read (#4421)
Summary: Pull Request resolved: #4421 This diff introduces a metric to calculate the maximum concurrent cache line accesses for each dimension of a 3D texture. The experiment works by allowing each thread to access a different texel on the texture and slowly increasing the number of threads, until the cache line is no longer able to handle all simultaneous accesses. By detecting a jump in latency, we can define the optimal maximum size that can be accessed concurrently on each dimension. NOTE: ArchProbe uses this information to[ obtain a supposed cache line size for textures](https://fburl.com/98xiou3g). However, it is unclear why they define the cache line size as being the ratio between the larger concurrency value over the lower, times the texel size. It is also unclear how to extend their calculations to three dimensions. TODO: Understand the relationship between concurrency and cache line size, and modify this metric to output the cache line size. For a Samsung S22, the latency graph looks like this: {F1780375117} Reviewed By: copyrightly Differential Revision: D60246121 fbshipit-source-id: c2bac010077bf14e95f70bb6038acbb47a534dde
- Loading branch information
1 parent
298b625
commit 5867129
Showing
4 changed files
with
155 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
backends/vulkan/tools/gpuinfo/glsl/tex_cacheline_concurr.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#version 450 core | ||
|
||
#define PRECISION ${PRECISION} | ||
#define VEC4_T ${texel_type(DTYPE)} | ||
|
||
layout(std430) buffer; | ||
|
||
${layout_declare_sampler(0, "r", "in_tex", DTYPE)} | ||
${layout_declare_buffer(1, "w", "out_buf", DTYPE, "PRECISION", False)} | ||
|
||
layout(local_size_x_id = 0, local_size_y_id = 1, local_size_z_id = 2) in; | ||
|
||
layout(constant_id = 3) const int niter = 1; | ||
|
||
void main() { | ||
vec4 sum = vec4(0); | ||
int i = 0; | ||
for (; i < niter; ++i){ | ||
$if DIM == 0: | ||
sum += texelFetch(in_tex, ivec3(gl_GlobalInvocationID[0], 0, 0), 0); | ||
$elif DIM == 1: | ||
sum += texelFetch(in_tex, ivec3(0, gl_GlobalInvocationID[0], 0), 0); | ||
$elif DIM == 2: | ||
sum += texelFetch(in_tex, ivec3(0, 0, gl_GlobalInvocationID[0]), 0); | ||
} | ||
|
||
// This is to ensure no compiler optimizations occur | ||
vec4 zero = vec4(i>>31); | ||
|
||
out_buf[0] = sum + zero; | ||
} |
14 changes: 14 additions & 0 deletions
14
backends/vulkan/tools/gpuinfo/glsl/tex_cacheline_concurr.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
tex_cacheline_concurr: | ||
parameter_names_with_default_values: | ||
DTYPE: float | ||
generate_variant_forall: | ||
DIM: | ||
- RANGE: [0, 2] | ||
shader_variants: | ||
- NAME: tex_cacheline_concurr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters