Page MenuHome

fixes wrong texture limit for OpenCL in Cycles
ClosedPublic

Authored by mathieu menuet (bliblubli) on Sep 25 2015, 9:17 PM.

Details

Summary

OpenCL has actually no limitation regarding the numbers of textures. This patch however limits it to 235 as it was the max that could fit in memory of a 7750 (the lowest end card that is faster than a CPU) using the pixar library. Using lower res texture certainly would allow more to fit in and most people will render with higher end cards. But it's a safe patch that could be included in 2.76. Tested on 7750, 7770, 280x and 390x on many scenes and scenes specifically made for this patch. The 390x could render with more than 1024 textures by the way in our test.
We are using this for some weeks now in production without any problem and we offer it to now following a discussion here : http://blenderartists.org/forum/showthread.php?254521-A-good-news-for-AMD-ATI-Graphic-cards-owners/page127&highlight=opencl

Diff Detail

Event Timeline

mathieu menuet (bliblubli) retitled this revision from to fixes wrong texture limit for OpenCL in Cycles.Sep 25 2015, 9:17 PM
mathieu menuet (bliblubli) updated this object.
mathieu menuet (bliblubli) set the repository for this revision to rB Blender.
mathieu menuet (bliblubli) updated this revision to Diff 5088.
Thomas Dinges (dingto) edited edge metadata.

2.76 is in Feature Freeze (RC2), an inclusion there is not possible.

well, it's more a fix (OpenCL shouldn't have any limit set actually?) than a feature I think. But I don't care as we have our own builds.

Sergey Sharybin (sergey) requested changes to this revision.

This is really bad approach for solving the issue, especially for the AMD hardware which will compile the switch statement to huge if..else block which really kills the performance.

This is really to be solved by switching from packed textures and hardcoded texture names to texture objects which are available since kepler cards and opencl 1.2.

This revision now requires changes to proceed.Sep 25 2015, 10:21 PM

Well actually, the changes in switch statement are even never being compiled for OpenCL kernel, they only affect on CUDA and CPU kernels.

So the only thing needed to make textures work is to set tex_num_images to some high value when device is requesting packed images.

mathieu menuet (bliblubli) updated this revision to Diff 5089.

corrected diff after comments from Sergey, thank you by the way, it's much easier like that and 2048 work on 390x in our test.

Sergey Sharybin (sergey) requested changes to this revision.
Sergey Sharybin (sergey) added inline comments.
intern/cycles/render/image.cpp
72

You should be checking whether images are to be packed or not here.

intern/cycles/render/image.h
37

After checking note below it'll become clear that name of constant is misleading. Should be something like TEX_PACKED_NUM_IMAGES in it's own category.

This revision now requires changes to proceed.Sep 26 2015, 9:28 AM
mathieu menuet (bliblubli) removed rB Blender as the repository for this revision.
mathieu menuet (bliblubli) updated this revision to Diff 5090.

Done. The OpenCL test is left until the CUDA kernel supports this.

This revision was automatically updated to reflect the committed changes.

Applied the patch with some other minor edits.

For the future -- please provide your real full name for a proper authorship.