【问题标题】:using HLSL to invisibly stress a graphics card - How to stress the memory?使用 HLSL 对显卡进行无形压力 - 如何对内存进行压力?
【发布时间】:2012-09-27 17:08:32
【问题描述】:

我一直在开发一种不可见的(阅读:不产生任何视觉输出)压力源来测试我的显卡的功能(并且作为对 DirectCompute 的一般探索,我对它很陌生)。我现在有以下代码,我很自豪:

RWStructuredBuffer<uint> BufferOut : register(u0);

[numthreads(1, 1, 1)]
void CSMain( uint3 DTid : SV_DispatchThreadID )
{
    uint total = 0;
    float p = 0;
    while(p++ < 40.0){      
        float s= 4.0;
        float M= pow(2.0,p) - 1.0;
        for(uint i=0; i <= p - 2; i++)
        {
            s=((s*s) - 2) % M;
        }
        if(s < 1.0) total++;
    }
    BufferOut[DTid.x] = total;
}

这将运行 Lucas Lehmer Test 的前 40 个 2 的幂。当我在定时循环中调度此代码并使用GPU-Z 查看我的显卡统计信息时,我的 GPU 负载在此期间飙升至 99%。我对此很满意,但我也注意到,满载 GPU 产生的热量实际上非常小(我的温度上升了大约 5 到 10 摄氏度,远不及跑步时的热量跳跃,说,无主之地2)。我的想法是我的大部分热量来自内存访问,因此我需要在整个运行过程中包含一致的内存访问。我的初始代码如下所示:

RWStructuredBuffer<uint> BufferOut : register(u0);

groupshared float4 memory_buffer[1024];

[numthreads(1, 1, 1)]
void CSMain( uint3 DTid : SV_DispatchThreadID )
{
    uint total = 0;
    float p = 0;
    while(p++ < 40.0){
            [fastop] // to lower compile times - Code efficiency is strangely not what Im looking for right now.
            for(uint i = 0; i < 1024; ++i)


        float s= 4.0;
        float M= pow(2.0,p) - 1.0;
        for(uint i=0; i <= p - 2; i++)
        {
            s=((s*s) - 2) % M;
        }
        if(s < 1.0) total++;
    }
    BufferOut[DTid.x] = total;
}

【问题讨论】:

    标签: memory gpu hlsl directcompute


    【解决方案1】:

    在大纹理中读取大量不连贯的样本。尝试 DXT1 压缩和非压缩值。并使用渲染纹理。和捷运。一切都将在 GPU 内存系统上胜出。

    【讨论】:

      猜你喜欢
      • 2015-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-12
      • 1970-01-01
      • 1970-01-01
      • 2023-03-28
      相关资源
      最近更新 更多