Memory 内存

This is only for advanced users! Incorrect settings can result in poor rendering performance and/or crashes!

这只适用于高级用户! 不正确的设置会导致较差的渲染性能和/或崩溃!

Introduction

引言

Redshift supports a set of rendering features not found in other GPU renderers on the market such as point-based GI, flexible shader graphs, out-of-core texturing and out-of-core geometry. While these features are supported by most CPU biased renderers, getting them to work efficiently and predictably on the GPU was a significant challenge!

Redshift 支持一系列市场上其他 GPU 渲染器所没有的渲染特性,比如基于点的 GI、灵活的着色图、核外纹理和核外几何。虽然这些特性支持大多数 CPU 偏见渲染器,让他们工作效率和可预见的 GPU 是一个重大的挑战!

One of the challenges with GPU programs is memory management. There are main two issues at hand: First, the GPU has limited memory resources. Second, no robust methods exist for dynamically allocating GPU memory. For this reason, Redshift has to partition free GPU memory between the different modules so that each one can operate within known limits which are defined at the beginning of each frame.

GPU 程序面临的挑战之一是内存管理。目前主要有两个问题: 第一,GPU 的内存资源有限。其次,没有健壮的方法来动态分配 GPU 内存。因此,Redshift 必须在不同的模块之间划分自由 GPU 内存,以便每个模块都能在每帧开始时定义的已知限制内运行。

Some CPU renderers also do a similar kind of memory partitioning. You might have seen other renderers refer to things like "dynamic geometry memory" or "texture cache". The first holds the scene's polygons while the second holds the textures. Redshift also uses "geometry memory" and "texture cache" for polygons and textures respectively.

一些 CPU 渲染器也执行类似的内存分区。您可能已经看到其他渲染器提到了“动态几何内存”或“纹理缓存”。第一个保存场景的多边形,第二个保存纹理。Redshift 还分别对多边形和纹理使用“几何内存”和“纹理缓存”。

Additionally, Redshift needs to allocate memory for rays. Because the GPU is a massively parallel processor, Redshift constantly builds lists of rays (the 'workload') and dispatches these to the GPU. The more rays we can send to the GPU in one go, the better the performance is. For example, a 1920x1080 scene using brute-force GI with 1024 rays per pixel needs to shoot a minimum of 2.1 billion rays! And this doesn't even include extra rays that might be needed for antialiasing, shadows, depth-of-field etc. Having all these rays in memory is not possible as it would require too much memory so Redshift splits the work into 'parts' and submits these parts individually – this way we only need to have enough memory on the GPU for a single part.

此外,红移需要为光线分配内存。因为 GPU 是大规模并行处理机的,所以 Redshift 不断地建立射线列表(‘ workload’) ,并将这些射线分发给 GPU。我们可以一次发送给 GPU 的光线越多,性能就越好。例如,一个1920x1080的场景使用暴力的每像素1024条光线的 GI,需要至少拍摄21亿条光线!这甚至不包括额外的光线,可能需要反走样,阴影,景深等。在内存中拥有所有这些射线是不可能的,因为这将需要太多的内存,所以红移将工作分成“部分”,并单独提交这些部分——这种方式我们只需要在 GPU 上有足够的内存为一个单一的部分。

Finally, certain techniques such as the Irradiance cache and Irradiance Point cloud need extra memory during their computation stage to store the intermediate points. How many points will be generated by these stages is not known in advance so a memory budget has to be reserved. The current version of Redshift does not automatically adjust these memory buffers so, if these stages generate too many points, the rendering will be aborted and the user will have to go to the memory options and increase these limits. In the future, Redshift will automatically reconfigure memory in these situations so you don't have to.

最后,某些技术如辐照度缓存和辐照度点云在计算阶段需要额外的内存来存储中间点。有多少点将产生这些阶段不知道提前,所以内存预算必须保留。当前版本的红移不会自动调整这些内存缓冲区,因此,如果这些阶段产生太多的点,渲染将被中止,用户将不得不去内存选项和增加这些限制。将来,红移会在这些情况下自动重新配置内存,这样你就不必重新配置内存了。

How Redshift Partitions Memory

如何红移分区内存

From a high-level point of view the steps the renderer takes to allocate memory are the following:

从高层次的角度来看,呈现程序分配内存的步骤如下:

  1. Get the available free GPU memory 获得可用的免费 GPU 内存
  2. If we are performing irradiance cache computations or irradiance point cloud computations, subtract the appropriate memory for these calculations (usually a few tens to a few hundreds of MB) 如果我们正在执行辐照缓存计算或辐照点云计算,请减去这些计算的适当内存(通常是几十到几百 MB)
  3. If we are  如果是的话using 使用 the irradiance cache, photon map, irradiance point cloud or subsurface scattering, allocate space for that memory 辐照度缓存、光子图、辐照度点云或次表面散射,为这些内存分配空间
  4. Allocate ray memory 分配射线内存
  5. From what's remaining, use a percentage for geometry (polygons) and a percentage for the texture cache 在剩下的部分中,为几何图形(多边形)使用一个百分比,为纹理缓存使用一个百分比

The Memory Options

内存选项

Inside the Redshift rendering options there is a "Memory" tab that contains all the GPU memory-related options. These are:

在红移渲染选项中有一个“内存”选项卡,包含所有与 GPU 内存相关的选项,它们是:

Automatic Memory Management

自动内存管理

This setting will let Redshift analyze the scene and determine how GPU memory should be partitioned between rays, geometry and textures. Once this setting is enabled, the controls for these are grayed out. We recommend leaving this setting enabled, unless you are an advanced user and have observed Redshift making the wrong decision (because of a bug or some other kind of limitation).

这个设置可以让 Redshift 分析场景并决定 GPU 内存应该如何在光线、几何体和纹理之间进行分区。一旦启用此设置,这些控件将显示为灰色。我们建议保持此设置为启用状态,除非您是高级用户,并且观察到红移做出了错误的决定(因为 bug 或其他类型的限制)。

Percentage of GPU memory to use

可使用的 GPU 内存百分比

By default, Redshift reserves 90% of the GPU's free memory. This means that all other GPU apps and the OS get the remaining 10%. If you are running other GPU-heavy apps during rendering and encountering issues with them, you can reduce that figure to 80 or 70. On the other hand, if you know that no other app will use the GPU, you can increase it to 100%.

默认情况下,Redshift 保留 GPU 90% 的可用内存。这意味着所有其他 GPU 应用程序和操作系统得到剩下的10% 。如果在渲染和遇到问题时运行其他 gpu 占用较多的应用程序,可以将这个数字减少到80或70。另一方面,如果你知道没有其他应用程序将使用 GPU,你可以增加到100% 。

Please note that increasing the percentage beyond 90% is not typically recommended as it might introduce system instabilities and/or driver crashes!

请注意,通常不建议将百分比提高到90% 以上,因为这可能会导致系统不稳定和/或司机崩溃!

GPU memory inactivity timeout

GPU 内存不活动超时

This setting was added in version 2.5.68. Previously, there were cases where Redshift could reserve memory and hold it indefinitely.

这个设置是在2.5.68版本中添加的。以前,红移可以无限期地保留内存。

As mentioned above, Redshift reserves a percentage of your GPU's free memory in order to operate. Reserving and freeing GPU memory is an expensive operation so Redshift will hold on to this memory while there is any rendering activity, including shaderball rendering. If rendering activity stops for 10 seconds, Redshift will release this memory. It does this so that other 3d applications can function without problems.

正如上面提到的,红移保留一定比例的 GPU 的空闲内存,以便操作。保留和释放 GPU 内存是一个昂贵的操作,因此当存在任何渲染活动(包括 shanderball 渲染)时,Redshift 将保留此内存。如果渲染活动停止10秒钟,红移将释放此内存。它这样做是为了让其他3 d 应用程序可以毫无问题地运行。

Irradiance Point Cloud Working Tree Reserved Memory

辐照点云工作树保留存储器

This is the "working" memory during the irradiance point cloud computations. The default 128MB should be able to hold several hundred thousand points. This setting should be increased if you encounter a render error during computation of the irradiance point cloud. Please see below.

这是辐照点云计算过程中的“工作”记忆。默认的128mb 应该可以容纳几十万个点。如果在计算辐照度点云时遇到渲染错误,这个设置应该增加。请看下面的内容。

Irradiance Cache Working Tree Reserved Memory

辐照度缓存工作树保留存储器

This is the "working" memory during the irradiance cache computations. The default 128MB should be able to hold several hundred thousand points. This setting should be increased if you encounter a render error during computation of the irradiance cache. Please see below.

这是辐照度缓存计算期间的“工作”存储器。默认的128mb 应该可以容纳几十万个点。如果在计算辐照度缓存时遇到渲染错误,这个设置应该增加。请看下面的内容。

Percentage Of Free Memory Used For Texture Cache / Maximum GPU Texture Cache Size

用于纹理缓存/最大 GPU 纹理缓存大小的可用内存百分比

Once reserved memory and rays have been subtracted from free memory, the remaining is split between the geometry (polygons) and the texture cache (textures). The "Percentage" parameter tells the renderer the percentage of free memory that it can use for texturing.

一旦从空闲内存中减去保留的内存和射线,剩下的内存将在几何体(多边形)和纹理缓存(纹理)之间分割。“ Percentage”参数告诉呈现程序可用于纹理处理的空闲内存的百分比。

Example:

例子:

Say we are using a 2GB videocard and what's left after reserved buffers and rays is 1.7GB. The default 15% for the texture cache means that we can use up to 15% of that 1.7GB, i.e. approx 255MB. If on the other hand, we are using a videocard with 1GB and after reserved buffers and rays we are left with 700MB, the texture cache can be up to 105MB (15% of 700MB).
Once we know how many MB maximum we can use for the texture cache, we can further limit the number using the "Maximum Texture Cache Size" option. This is useful for videocards with a lot of free memory. For example, say you are using a 6GB Quadro and, after reserved buffers and rays you have 5.7GB free. 15% of that is 855MB. There are extremely few scenes that will ever need such a large texture cache! If we didn't have the "Maximum Texture Cache Size" option you would have to be constantly modifying the "Percentage" option depending on the videocard you are using.
Using these two options ("Percentage" and "Maximum") allows you to specify a percentage that makes sense (and 15% most often does) while not wasting memory on videocards with lots of free mem.
We explain how/when this parameter should be modified later down.

假设我们使用的是一个2gb 的视频卡,在预留缓冲区和光线之后剩下的是1.7 GB。纹理缓存的默认值为15% ,这意味着我们可以使用1.7 GB 的15% ,也就是大约255 MB。另一方面,如果我们使用一个1gb 的视频卡,在保留缓冲区和光线之后,我们剩下700mb,纹理缓存可以达到105mb (700mb 的15%)。一旦我们知道我们可以使用多少 MB 的最大纹理缓存,我们可以进一步限制数量使用“最大纹理缓存大小”选项。这对有大量空闲内存的视频卡很有用。例如,假设你正在使用一个6gb 的 Quadro,在保留缓冲区和射线之后,你有5.7 GB 的空闲空间。其中15% 是855mb。有极少的场景需要如此大的纹理缓存!如果我们没有“最大纹理缓存大小”选项,你将不得不不断修改“百分比”选项取决于视频卡片你正在使用。使用这两个选项(“百分比”和“最大值”) ,您可以指定一个有意义的百分比(最常见的是15%) ,同时不会在有大量空闲内存的视频卡上浪费内存。我们将解释如何/何时修改这个参数。

Maximum CPU Texture Cache Size

最大 CPU 纹理缓存大小

Before texure data is sent to the GPU, they are stored in CPU memory. By default, Redshift uses 4GB for this CPU storage. If you encounter performance issues with texture-heavy scenes, please increase this setting to 8GB or higher.

在文本数据被发送到 GPU 之前,它们被存储在 CPU 内存中。默认情况下,Redshift 使用4 GB 的 CPU 存储空间。如果您遇到的性能问题与纹理重场景,请增加此设置到8 GB 或更高。

Ray Reserved Memory

If you leave this setting at zero, Redshift will use a default number of MB which depends on shader configuration. However, if your scene is very lightweight in terms of polygons, or you are using a videocard with a lot of free memory you can specify a budget for the rays and potentially increase your rendering performance. That is explained in its own section below.

如果将此设置保持为零,红移将使用默认的 MB 数量,这取决于着色器配置。然而,如果你的场景是非常轻量级的多边形,或者你使用的视频卡片有大量的空闲内存,你可以指定一个预算的射线和潜在的提高你的渲染性能。这一点将在下面的章节中进行解释。

Adjusting Irradiance Point Cloud Or Irradiance Cache Reserved Memory

调整辐照度点云或辐照度缓存保留内存

The only time you should even have to modify these numbers is if you get a message that reads like this:

你唯一需要修改这些数字的时候就是收到这样的信息:

Irradiance cache points don't fit in VRAM. Frame aborted. Please either reduce Irradiance Cache quality settings or increase the irradiance
cache memory budget in the memory options

Or

或者

Irradiance point cloud doesn't fit in VRAM. Frame aborted. Please either increase the 'Screen Radius' parameter or the irradiance
point cloud memory budget in the memory options

If it's not possible (or undesirable) to modify the irradiance point cloud or irradiance cache quality parameters, you can try increasing the memory from 128MB to 256MB or 512MB. If you are already using a lot of memory for this and are still getting this message, this might be because the scene has a lot of micro-detail in which case it is advisable to consider using Brute-Force GI instead.

如果不可能(或者不希望)修改辐射点云或辐射缓存质量参数,您可以尝试将内存从128 MB 增加到256 MB 或512 MB。如果您已经为此使用了大量内存,并且仍然收到此消息,这可能是因为场景中有许多微细节,在这种情况下,最好考虑使用 Brute-Force GI。

Adjusting Texture Cache Memory

调整纹理缓存

When Redshift renders, a "Feedback Display" window should pop up. This window contains useful information about how much memory is allocated for individual modules. One of these entries is "Texture".
That number reports the number of MB that the CPU had to send the GPU via the PCIe bus for texturing. Initially it might say something like "0 KB [128 MB]". This means that "your texture cache is 128MB large and, so far you have uploaded no data".

当红移呈现时,会弹出一个“反馈显示”窗口。此窗口包含有关为单个模块分配多少内存的有用信息。其中一个条目是“纹理”。这个数字报告了 CPU 必须通过 PCIe 总线发送 GPU 进行纹理处理的 MB 数量。最初可能会说“0 KB [128 MB ]”。这意味着“你的纹理缓存是128mb 大,到目前为止你还没有上传任何数据”。

Redshift can successfully render scenes containing gigabytes of texture data. It can achieve that by 'recycling' the texture cache (in this case 128MB). It will also upload only parts of the texture that are needed instead of the entire texture. So when textures are far away, a lower resolution version of the texture will be used (these are called "MIP maps") and only specific tiles of that MIP map.
Because of this method of recycling memory, you will very likely see the PCIe-transferred figure grow larger than the texture cache size (shown in the square brackets). That's ok most of the time – the performance penalty of re-uploading a few megabytes here and there is typically not an issue.

红移可以成功地渲染包含千兆字节纹理数据的场景。它可以通过“回收”纹理缓存(在本例中为128 MB)来实现这一点。它也只上传需要的部分纹理,而不是整个纹理。因此,当纹理远离时,会使用较低分辨率的纹理(这些称为“ MIP 贴图”) ,并且只使用该 MIP 贴图的特定贴图。由于这种回收内存的方法,您很可能会看到 pcie 传输的图形比纹理缓存大小更大(在方括号中显示)。这在大多数情况下是可以的——这里重新上传几兆字节的性能损失通常不成问题。

However, if you see the "Uploaded" number grow very fast and quickly go into several hundreds of megabytes or even gigabytes, this might mean that the texture cache is too small and needs to be increased.
If that is the case, you will need to do one or two things:

然而,如果你看到“上传”的数字增长非常快,并且很快达到几百兆甚至千兆字节,这可能意味着纹理缓存太小,需要增加。如果是这样的话,你需要做一到两件事:

  1. First try increasing the "Max Texture Cache Size". The default it 128MB. Try 256MB as a test. 首先尝试增加“最大纹理缓存大小”。默认为128 MB。尝试256 MB 作为一个测试
  2. If you did that and the number shown in the Feedback window did not become 256MB, then you will need to increase the "Percentage Of Free Memory Used For Texture Cache" parameter. Try numbers such as 0.3 or 0.5 如果你这样做了,并且反馈窗口中显示的数字没有变成256 MB,那么你需要增加“用于纹理缓存的空闲内存百分比”参数。试试数字,比如0.3或0.5

Increasing Ray Reserved Memory

增加射线保留内存

On average, Redshift can fit approximately 1 million triangles per 60MB of memory (in the typical case of meshes containing a single UV channel and a tangent space per vertex). This means that even scenes with a few million triangles might still leave some memory free (unused for geometry).

平均来说,红移可以适合大约100万三角形每60 MB 的内存(在典型的情况下,网格包含一个单一的 UV 通道和每个顶点的切线空间)。这意味着即使场景中有几百万个三角形,也可能留下一些空闲内存(对于几何学来说没有使用)。

That memory can be reassigned to the rays which, as was explained earlier, will help Redshift submit fewer, larger packets of work to the GPU which, in some cases, can be good for performance.

这些内存可以被重新分配到射线上,正如前面解释的那样,这将有助于 Redshift 向 GPU 提交更少、更大的工作包,在某些情况下,这对性能有好处。

Determining if your scene's geometry is underutilizing GPU memory is easy: all you have to do is look at the Feedback display "Geometry" entry. Similar to the texture cache, the geometry memory is recycled. If your scene is simple enough (and after rendering a frame) you will see the PCIe-transferred memory be significantly lower the geometry cache size (shown in the square bracket). For example it might read like this: "Geometry: 100 MB [400 MB]". In this example, this means we can use the 300MB and reassign them to Rays.

判断你的场景的几何图形是否没有充分利用 GPU 内存是很容易的: 你所要做的就是看看反馈显示“几何图形”条目。与纹理缓存相似,几何内存被回收。如果你的场景足够简单(在渲染完一帧之后) ,你会看到 pcie 传输的内存大大降低了几何缓存大小(在方括号中显示)。例如,它可能会这样读: “几何: 100 MB [400 MB ]”。在这个例子中,这意味着我们可以使用300mb 并将它们重新分配给 ray。

The ray memory currently used is also shown on the Feedback display under "Rays". It might read something like "Rays: 300MB". So, in the memory options, we could make the "Ray Resevered Memory", approximately 600MB. I.e. add 300MB that our geometry is not using to the 300MB that rays are using.

当前使用的光线存储器也显示在“光线”下的反馈显示器上。它可能读起来像“ ray: 300mb”。因此,在内存选项中,我们可以将“ Ray reevered Memory”设置为大约600mb。例如,将我们的几何体不使用的300mb 添加到射线使用的300mb。

3

赶快留个言打破零评论!~

返回顶部

显示

忘记密码?

显示

显示

获取验证码

Close