Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Issue 10534173: GPU Program Caching (Closed)

Created:
8 years, 6 months ago by dmurph
Modified:
8 years, 5 months ago
CC:
chromium-reviews, jochen+watch-content_chromium.org, dhollowa+watch_chromium.org, jam, apatrick_chromium, joi+watch-content_chromium.org, darin-cc_chromium.org
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

in-memory program cache implementation with a memory limit + lru eviction. Wiring: - Added bindings for glProgramBinary, glGetProgramBinary, glProgramParameteri - Plumbed the shader cache from gl_channel_manager to program_manager - Program cache creation after first context is created Refactoring: - moved DoCompile to ProgramManager New: - added functionality to ShaderInfo to store if we have a possible pending cache compile - exposed attrib_map and uniform_map in ShaderInfo for the cache - program_cache base class with in-memory status storage - Simple memory_program_cache implementation, stores programs with lru eviction - Added caching logic to DoCompileShader and Link in ProgramMAnager - MemoryProgramCache, the in-memory cache implementation - ProgramCacheLruHelper, an O(1) lru implementation Misc: - A couple style fixes in modified files Design doc: https://docs.google.com/document/d/1Vceem-nF4TCICoeGSh7OMXxfGuJEJYblGXRgN9V9hcE/edit BUG=88572 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=147328

Patch Set 1 #

Total comments: 77

Patch Set 2 : solid in-memory implementation #

Patch Set 3 : solid in-memory implementation #

Total comments: 16

Patch Set 4 : memory limit + lru #

Total comments: 25

Patch Set 5 : Patch #

Patch Set 6 : Patch #

Total comments: 87

Patch Set 7 : Style fixes, thorough tests #

Total comments: 45

Patch Set 8 : more tests #

Total comments: 3

Patch Set 9 : Shader source change tests, git try'd #

Patch Set 10 : tiny fix for android and windows build #

Total comments: 22

Patch Set 11 : shader manager work #

Total comments: 8

Patch Set 12 : nit changes #

Patch Set 13 : fixed eviction issue and test #

Patch Set 14 : fixed license header #

Patch Set 15 : fixed extension check, added cache hint, force compile/link on load failure #

Patch Set 16 : fixed windows git try error #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2269 lines, -90 lines) Patch
M content/common/gpu/gpu_channel.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -0 lines 0 comments Download
M content/common/gpu/gpu_channel_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +7 lines, -0 lines 0 comments Download
M content/common/gpu/gpu_channel_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +17 lines, -2 lines 0 comments Download
M content/common/gpu/gpu_command_buffer_stub.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +0 lines, -1 line 0 comments Download
M content/common/gpu/gpu_command_buffer_stub.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +5 lines, -0 lines 0 comments Download
M gpu/command_buffer/common/gl_mock.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +11 lines, -0 lines 0 comments Download
M gpu/command_buffer/service/context_group.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +11 lines, -0 lines 0 comments Download
M gpu/command_buffer/service/context_group.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +3 lines, -1 line 0 comments Download
M gpu/command_buffer/service/gl_utils.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +7 lines, -0 lines 0 comments Download
M gpu/command_buffer/service/gles2_cmd_decoder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +12 lines, -48 lines 0 comments Download
gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -2 lines 0 comments Download
gpu/command_buffer/service/memory_program_cache.h View 1 2 3 4 5 6 7 8 9 1 chunk +88 lines, -0 lines 0 comments Download
gpu/command_buffer/service/memory_program_cache.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +173 lines, -0 lines 0 comments Download
A gpu/command_buffer/service/memory_program_cache_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +417 lines, -0 lines 0 comments Download
M gpu/command_buffer/service/mocks.h View 1 2 3 4 5 6 7 8 9 2 chunks +21 lines, -0 lines 0 comments Download
M gpu/command_buffer/service/mocks.cc View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -0 lines 0 comments Download
A gpu/command_buffer/service/program_cache.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +127 lines, -0 lines 0 comments Download
gpu/command_buffer/service/program_cache.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +175 lines, -0 lines 0 comments Download
A gpu/command_buffer/service/program_cache_lru_helper.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +51 lines, -0 lines 0 comments Download
A gpu/command_buffer/service/program_cache_lru_helper.cc View 1 2 3 4 5 6 7 8 1 chunk +49 lines, -0 lines 0 comments Download
A gpu/command_buffer/service/program_cache_lru_helper_unittest.cc View 1 2 3 4 5 6 7 1 chunk +84 lines, -0 lines 0 comments Download
A gpu/command_buffer/service/program_cache_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +249 lines, -0 lines 0 comments Download
M gpu/command_buffer/service/program_manager.h View 1 2 3 4 5 6 7 8 9 chunks +31 lines, -5 lines 0 comments Download
M gpu/command_buffer/service/program_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 7 chunks +169 lines, -5 lines 0 comments Download
M gpu/command_buffer/service/program_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 10 chunks +384 lines, -10 lines 0 comments Download
gpu/command_buffer/service/shader_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +54 lines, -0 lines 0 comments Download
M gpu/command_buffer/service/shader_manager.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +5 lines, -1 line 0 comments Download
M gpu/command_buffer/service/shader_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +34 lines, -2 lines 0 comments Download
M gpu/command_buffer/service/shader_translator.h View 1 2 3 4 5 6 7 1 chunk +6 lines, -0 lines 0 comments Download
M gpu/command_buffer/service/test_helper.h View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 0 comments Download
M gpu/command_buffer/service/test_helper.cc View 1 2 3 4 5 6 4 chunks +20 lines, -9 lines 0 comments Download
M gpu/command_buffer/tests/gl_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +6 lines, -3 lines 0 comments Download
M gpu/command_buffer_service.gypi View 1 2 3 2 chunks +6 lines, -0 lines 0 comments Download
M gpu/demos/framework/window.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -0 lines 0 comments Download
M gpu/gpu_common.gypi View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
M ui/gl/generate_bindings.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +16 lines, -0 lines 0 comments Download
M ui/gl/gl_interface.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +13 lines, -0 lines 0 comments Download
M webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 36 (0 generated)
dmurph
Just getting this up here for arch discussion and to have a working shader cache ...
8 years, 6 months ago (2012-06-15 01:46:56 UTC) #1
dmurph
Points: - shader string data needs to be copied into keys used for table insertion. ...
8 years, 6 months ago (2012-06-15 08:06:32 UTC) #2
greggman
Sorry, I didn't notice your comment about using std::string until after I made all my ...
8 years, 6 months ago (2012-06-15 08:10:09 UTC) #3
greggman
https://chromiumcodereview.appspot.com/10534173/diff/1/content/common/gpu/gpu_channel.h File content/common/gpu/gpu_channel.h (right): https://chromiumcodereview.appspot.com/10534173/diff/1/content/common/gpu/gpu_channel.h#newcode38 content/common/gpu/gpu_channel.h:38: class ShaderCache; Should these be named ProgramCache and MemoryProgramCache? ...
8 years, 6 months ago (2012-06-15 08:10:24 UTC) #4
dmurph
Comments that I didn't respond to are ones that I agree with and I'll mark ...
8 years, 6 months ago (2012-06-15 16:40:23 UTC) #5
dmurph
Below are my second round of just 'Done' comments, see above for others. Patch includes ...
8 years, 6 months ago (2012-06-19 01:08:33 UTC) #6
greggman
I let a couple of comments but I'm just going to come over. http://codereview.chromium.org/10534173/diff/11012/gpu/command_buffer/service/memory_program_cache.cc File ...
8 years, 6 months ago (2012-06-19 22:27:50 UTC) #7
dmurph
New patch has more unit tests and supports a memory limit with lru eviction. Other ...
8 years, 6 months ago (2012-06-23 01:37:28 UTC) #8
greggman
here's a few comments. I didn't review everything yet. http://codereview.chromium.org/10534173/diff/18001/gpu/command_buffer/service/context_group.h File gpu/command_buffer/service/context_group.h (right): http://codereview.chromium.org/10534173/diff/18001/gpu/command_buffer/service/context_group.h#newcode14 gpu/command_buffer/service/context_group.h:14: ...
8 years, 6 months ago (2012-06-25 18:53:03 UTC) #9
dmurph
Style fixes + cleaner memory management https://chromiumcodereview.appspot.com/10534173/diff/18001/gpu/command_buffer/service/context_group.h File gpu/command_buffer/service/context_group.h (right): https://chromiumcodereview.appspot.com/10534173/diff/18001/gpu/command_buffer/service/context_group.h#newcode14 gpu/command_buffer/service/context_group.h:14: #include "base/memory/weak_ptr.h" On ...
8 years, 6 months ago (2012-06-26 02:32:56 UTC) #10
greggman
It's looking pretty good. A few issues left. http://codereview.chromium.org/10534173/diff/25001/content/common/gpu/gpu_channel_manager.h File content/common/gpu/gpu_channel_manager.h (right): http://codereview.chromium.org/10534173/diff/25001/content/common/gpu/gpu_channel_manager.h#newcode19 content/common/gpu/gpu_channel_manager.h:19: #include ...
8 years, 6 months ago (2012-06-26 23:00:27 UTC) #11
dmurph
http://codereview.chromium.org/10534173/diff/25001/gpu/command_buffer/service/memory_program_cache.h File gpu/command_buffer/service/memory_program_cache.h (right): http://codereview.chromium.org/10534173/diff/25001/gpu/command_buffer/service/memory_program_cache.h#newcode81 gpu/command_buffer/service/memory_program_cache.h:81: FastHash> StoreMap; On 2012/06/26 23:00:27, greggman wrote: > I ...
8 years, 5 months ago (2012-06-27 01:46:22 UTC) #12
apatrick_chromium
https://chromiumcodereview.appspot.com/10534173/diff/25001/gpu/command_buffer/service/memory_program_cache.cc File gpu/command_buffer/service/memory_program_cache.cc (right): https://chromiumcodereview.appspot.com/10534173/diff/25001/gpu/command_buffer/service/memory_program_cache.cc#newcode51 gpu/command_buffer/service/memory_program_cache.cc:51: value->format, Is the format guaranteed to be understood by ...
8 years, 5 months ago (2012-06-28 21:54:31 UTC) #13
dmurph
https://chromiumcodereview.appspot.com/10534173/diff/25001/gpu/command_buffer/service/memory_program_cache.cc File gpu/command_buffer/service/memory_program_cache.cc (right): https://chromiumcodereview.appspot.com/10534173/diff/25001/gpu/command_buffer/service/memory_program_cache.cc#newcode51 gpu/command_buffer/service/memory_program_cache.cc:51: value->format, On 2012/06/28 21:54:31, apatrick_chromium wrote: > Is the ...
8 years, 5 months ago (2012-06-28 22:49:54 UTC) #14
apatrick_chromium
https://chromiumcodereview.appspot.com/10534173/diff/25001/gpu/command_buffer/service/memory_program_cache.cc File gpu/command_buffer/service/memory_program_cache.cc (right): https://chromiumcodereview.appspot.com/10534173/diff/25001/gpu/command_buffer/service/memory_program_cache.cc#newcode51 gpu/command_buffer/service/memory_program_cache.cc:51: value->format, On 2012/06/28 22:49:54, dmurph wrote: > On 2012/06/28 ...
8 years, 5 months ago (2012-06-28 23:22:33 UTC) #15
dmurph
On 2012/06/28 23:22:33, apatrick_chromium wrote: > https://chromiumcodereview.appspot.com/10534173/diff/25001/gpu/command_buffer/service/memory_program_cache.cc > File gpu/command_buffer/service/memory_program_cache.cc (right): > > https://chromiumcodereview.appspot.com/10534173/diff/25001/gpu/command_buffer/service/memory_program_cache.cc#newcode51 > ...
8 years, 5 months ago (2012-06-28 23:57:56 UTC) #16
dmurph
Didn't have time to upload the patch, done except for adding program manager tests. http://codereview.chromium.org/10534173/diff/25001/content/common/gpu/gpu_channel_manager.h ...
8 years, 5 months ago (2012-07-04 00:01:29 UTC) #17
dmurph
Added many tests to program manager, fixed all lint issues in changed files.
8 years, 5 months ago (2012-07-10 00:20:47 UTC) #18
greggman
Looks good. A few style issues and a couple of issues http://codereview.chromium.org/10534173/diff/39001/gpu/command_buffer/service/memory_program_cache.cc File gpu/command_buffer/service/memory_program_cache.cc (right): ...
8 years, 5 months ago (2012-07-10 21:43:30 UTC) #19
dmurph
https://chromiumcodereview.appspot.com/10534173/diff/39001/gpu/command_buffer/service/memory_program_cache.cc File gpu/command_buffer/service/memory_program_cache.cc (right): https://chromiumcodereview.appspot.com/10534173/diff/39001/gpu/command_buffer/service/memory_program_cache.cc#newcode32 gpu/command_buffer/service/memory_program_cache.cc:32: MemoryProgramCache::MemoryProgramCache() : max_size_bytes_(GetCacheSize()), On 2012/07/10 21:43:30, greggman wrote: > ...
8 years, 5 months ago (2012-07-11 23:32:51 UTC) #20
greggman
Looking good. Unfortunately there's a problem we hadn't thought of. If you do this vs ...
8 years, 5 months ago (2012-07-12 00:48:29 UTC) #21
dmurph
Yes, both of those issues definitely exist. I wasn't thinking about the case where the ...
8 years, 5 months ago (2012-07-12 01:14:08 UTC) #22
dmurph
Patch uploaded with added tests for the two scenarios Gregg outlined, thoroughly git try'd as ...
8 years, 5 months ago (2012-07-13 22:09:14 UTC) #23
greggman
http://codereview.chromium.org/10534173/diff/67002/gpu/command_buffer/service/program_manager.cc File gpu/command_buffer/service/program_manager.cc (right): http://codereview.chromium.org/10534173/diff/67002/gpu/command_buffer/service/program_manager.cc#newcode435 gpu/command_buffer/service/program_manager.cc:435: program_cache_->ShaderCompilationSucceeded(*source); "source" can be null here in which case ...
8 years, 5 months ago (2012-07-16 19:41:24 UTC) #24
dmurph
http://codereview.chromium.org/10534173/diff/67002/gpu/command_buffer/service/shader_manager.h File gpu/command_buffer/service/shader_manager.h (right): http://codereview.chromium.org/10534173/diff/67002/gpu/command_buffer/service/shader_manager.h#newcode37 gpu/command_buffer/service/shader_manager.h:37: // prevent the compiled source from getting deleted when ...
8 years, 5 months ago (2012-07-16 20:00:36 UTC) #25
greggman
http://codereview.chromium.org/10534173/diff/49004/gpu/command_buffer/service/memory_program_cache_unittest.cc File gpu/command_buffer/service/memory_program_cache_unittest.cc (right): http://codereview.chromium.org/10534173/diff/49004/gpu/command_buffer/service/memory_program_cache_unittest.cc#newcode48 gpu/command_buffer/service/memory_program_cache_unittest.cc:48: for (int i = 0; i < length; i++) ...
8 years, 5 months ago (2012-07-16 21:57:25 UTC) #26
dmurph
Do you think 'source_compiled()' is more clear in shader_manager? I'm thinking I should change it ...
8 years, 5 months ago (2012-07-17 18:17:13 UTC) #27
greggman
Looks good. A few minor things then LGTM (see comments) 1) There's another issue but ...
8 years, 5 months ago (2012-07-17 20:51:12 UTC) #28
dmurph
I received a 'FATAL:program_cache.cc(108)] Check failed: info0.ref_count > 0.' Error during the second run of ...
8 years, 5 months ago (2012-07-18 00:45:50 UTC) #29
dmurph
On 2012/07/18 00:45:50, dmurph wrote: > I received a 'FATAL:program_cache.cc(108)] Check failed: info0.ref_count > 0.' ...
8 years, 5 months ago (2012-07-18 00:46:56 UTC) #30
dmurph
Fixed eviction error + fixed test to detect it. Good to submit?
8 years, 5 months ago (2012-07-18 21:30:14 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dmurph@chromium.org/10534173/74002
8 years, 5 months ago (2012-07-18 21:34:02 UTC) #32
commit-bot: I haz the power
Presubmit check for 10534173-74002 failed and returned exit status 1. Running presubmit commit checks ...
8 years, 5 months ago (2012-07-18 21:34:27 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dmurph@chromium.org/10534173/70004
8 years, 5 months ago (2012-07-18 21:38:37 UTC) #34
commit-bot: I haz the power
Change committed as 147328
8 years, 5 months ago (2012-07-18 22:53:32 UTC) #35
dmurph
8 years, 5 months ago (2012-07-20 22:17:05 UTC) #36
Updated patch with the correct extension check, caching hint on desktop, and
force compile/link on load binary failure.  General cleanup as well.

Powered by Google App Engine
This is Rietveld 408576698