【问题标题】:Shader compiler on Alderlake GT1: SIMD32 shader inefficientAlderlake GT1 上的着色器编译器:SIMD32 着色器效率低下
【发布时间】:2022-06-11 01:08:47
【问题描述】:

当我在 Alderlake GT1 集成 GPU 上编译和链接我的 GLSL 着色器时,我收到警告:

SIMD32 着色器效率低下

此警告是通过glDebugMessageCallbackARB 机制报告的。

我想调查一下是否可以避免这种低效率,但我不确定如何获取有关此警告的更多信息。

此着色器的驱动程序的完整输出:

WRN [Shader Compiler][Other]{Notification}: VS SIMD8 shader: 11 inst, 0 loops, 40 cycles, 0:0 spills:fills, 1 sends, scheduled with mode top-down, Promoted 0 constants, compacted 176 to 112 bytes.

WRN [API][Performance]{Notification}: SIMD32 shader inefficient

WRN [Shader Compiler][Other]{Notification}: FS SIMD8 shader: 5 inst, 0 loops, 20 cycles, 0:0 spills:fills, 1 sends, scheduled with mode top-down, Promoted 0 constants, compacted 80 to 48 bytes.

WRN [Shader Compiler][Other]{Notification}: FS SIMD16 shader: 5 inst, 0 loops, 28 cycles, 0:0 spills:fills, 1 sends, scheduled with mode top-down, Promoted 0 constants, compacted 80 to 48 bytes.

顺便说一下,消息是在片段着色器编译期间创建的。

我的顶点着色器:

#version 150
in mediump vec2 position;
out lowp vec4 clr;
uniform mediump vec2 rotx;
uniform mediump vec2 roty;
uniform mediump vec2 translation;
uniform lowp vec4 colour;
void main()
{
    gl_Position.x = dot( position, rotx ) + translation.x;
    gl_Position.y = dot( position, roty ) + translation.y;
    gl_Position.z = 1.0;
    gl_Position.w = 1.0;
    clr = colour;
}

我的片段着色器:

#version 150
in  lowp vec4 clr;
out lowp vec4 fragColor;
void main()
{
    fragColor = clr;
}

也就是说,我怀疑它是特定于着色器的,因为它似乎报告了我在这个平台上使用的每个着色器?

GL RENDERER: Mesa Intel(R) Graphics (ADL-S GT1)

操作系统: Ubuntu 22.04

GPU: AlderLake-S GT1

API: OpenGL 3.2 核心配置文件

GLSL 版本: 150

【问题讨论】:

    标签: glsl shader intel


    【解决方案1】:

    这似乎来自英特尔片段着色器编译器,它是 Mesa 的一部分。

    brw_fs.cpp

    看这段代码,编译器似乎有三个选项:使用SIMD8SIMD16SIMD32。这是指宽度,而不是位。所以 SIMD32 是 32 宽的 SIMD。

    编译器使用启发式方法来查看 SIMD32 版本是否有效,如果不是,则跳过该选项。

    当然,这种启发式方法可能会出错,因此有一个选项可以强制 BRW 编译器尝试 SIMD32。

    环境变量设置INTEL_DEBUG=do32 将告诉编译器也尝试SIMD32。

    当我在我的系统上进行测试时,我确实观察到驱动程序现在报告了三种不同的结果:

    WRN [Shader Compiler][Other]{Notification}: FS SIMD8 shader: 5 inst, 0 loops, 20 cycles, 0:0 spills:fills, 1 sends, scheduled with mode top-down, Promoted 0 constants, compacted 80 to 48 bytes.
    
    WRN [Shader Compiler][Other]{Notification}: FS SIMD16 shader: 5 inst, 0 loops, 28 cycles, 0:0 spills:fills, 1 sends, scheduled with mode top-down, Promoted 0 constants, compacted 80 to 48 bytes.
    
    WRN [Shader Compiler][Other]{Notification}: FS SIMD32 shader: 10 inst, 0 loops, 928 cycles, 0:0 spills:fills, 2 sends, scheduled with mode top-down, Promoted 0 constants, compacted 160 to 96 bytes.
    

    请注意,在这种情况下,启发式方法肯定是正确的:几乎是 SIMD8 的 50 倍?

    有趣的事实:BRW stands for Broadwater,第 4 代图形。但是第 12 代 Intel GPU 仍然使用这个编译器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多