src/libANGLE/renderer/vulkan/ProgramExecutableVk.h


Log

Author Commit Date CI Message
Shahbaz Youssefi fc4fc174 2024-12-10T22:01:28 Vulkan: Prevent crash with D/S FF without D/S attachment The spec says that the values for gl_LastFragDepth/StencilARM are undefined if there is no depth/stencil attachment. This "just" works on tiling GPUs, because reading input attachments simply translates to reading _something_ from the tile memory. For ANGLE, the situation is a little more complicated. ANGLE has to bind descriptors for input attachments (because non-tilers read from the input attachment descriptor instead of using the knowledge that input and color/depth/stencil attachments are one and the same thing in tile memory). When a depth/stencil attachment is missing, there is no image to bind to the descriptor set. ANGLE cannot skip binding an image to the descriptor set, because OpImageRead (translated from subpassLoad()) attempts to access the input descriptor; skipping this causes an internal crash in SwiftShader for example. ANGLE cannot bind a bogus image as input attachment, as Vulkan requires that input attachments are also color/depth/stencil attachments. ANGLE _could_ bind a bogus image as input attachment and also as depth/stencil attachment. This is rather risky, as it then also has to be careful to make sure that depth/stencil attachment is never actually used (i.e. it affects the depth/stencil state, load/store ops etc). In this change, the shader itself is modified to remove references to the depth/stencil input attachments if the attachment is missing. This is rather inefficient, as it means the pipeline warmup will not produce a usable pipeline, but it's accepted as a workaround for something apps shouldn't really be doing. Bug: angleproject:376572258 Change-Id: I0de68252b61615cb82cba7d1730699aadf41e92f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6085368 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 2dc072ec 2024-11-22T16:14:52 Vulkan: Switch PipelineLayout from AtomicBind* to AtomicSharedPtr AtomicSharedPtr/SharedPtr has better semantics and safer to use. This will allow deleting BindingPointer in later CL. Bug: angleproject:372268711 Change-Id: Ife20f68b2277a1913b06be0de153770214ac964a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6044326 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 87d61997 2024-11-21T14:20:55 Vulkan: Switch ShaderModule to use SharedPtr This CL gets rid of many vk::RefCounted<vk::ShaderModule> usage which is risky due to it allows you to direct manipulate reference count. Switch to vk::SharedPtr manages the reference counting automatically. Bug: angleproject:372268711 Change-Id: I14f5c509bcbd9ea7d17101637e033652a68710a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6039117 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao ce53aff0 2024-11-05T16:57:57 Vulkan: Add per descriptorSet LRU cache eviction Before this CL, the descriptor set cache eviction is at the pool level. Either the entire pool is deleted or not. It is also not LRU based. This CL adds a per descriptor set cache eviction and reuse evicted descriptorSet before allocating a new pool. This eviction is LRU based so that it is more precise. The mCurrentFrameCount is passed into various API so that it can make eviction decision based on the frame number. In this CL, anything not been used in last 10 frames will be evicted and recycled before allocate a new pool. Since eviction is based on individual descriptor set, not by pool, ProgramExecutableVk no longer needs to track the DescriptorSetPool object. mDescriptorPools has been removed from ProgramExecutableVk class. As measured by crrev.com/c/5425496/133 This LRU linked list maintenance does not add any measurable time difference, but reduces total descriptorSet pool count by one third (from 75 down to 48). running test name: "TracePerf", backend: "_vulkan", story: "batman_telltale" Before this CL: cacheMissCount: 200, averageTime:23998 ns cacheHitCount: 1075445, averageTime:626 ns descriptorSetEvicted: 0, descriptorSetPoolCount:75 Average frame time 3.9262 ms After this CL: cacheMissCount: 200, averageTime:23207 ns cacheHitCount: 1025415, averageTime:602 ns descriptorSetEvicted: 102708, descriptorSetPoolCount:48 Average frame time 3.9074 ms BYPASS_LARGE_CHANGE_WARNING Bug: angleproject:372268711 Change-Id: I84daaf46f4557cbbfdb94c10c5386001105f5046 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5985112 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 2df8d32b 2024-10-25T13:49:40 Vulkan: Tag DescriptorSets properly with every command buffer When descriptorSetCache is disabled, there is a bug that the current descriptorSet is not properly tagged with current ResourceUse. Right now when we get a descriptorSet (from cache or reused or allocated new), we retain to the current command buffer. But if we submit command buffer and get a new command buffer, and draw with the same program/buffer/textures, we will be reusing the current bound descriptorSets, but it is not retained with new command buffer. In theory, we have the same bug for pool eviction as well when cache is enabled. It's just very hard to hit due to pool eviction occur very rare. But with cache disabled, this is very easy to hit with multiple tests. In this CL, the retainResource call is moved from ProgramExecutableVk::getOrAllocateDescriptorSet() call to ProgramExecutableVk::bindDescriptorSets() call. Since bindDescriptorSets is always get called when we get a new descriptorSet, and is always get called when a new command buffer is allocated, this covers all usage case. And even better, with this change we are able to remove commandBufferHelper from arguments of quite a few functions. Bug: angleproject:372268711 Change-Id: I1f21a3e7e9ea34e2842e54025b5eb930dbf6c593 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4743599 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 08c1724f 2024-10-11T14:29:00 Vulkan: Support GL_ARM_shader_framebuffer_fetch_depth_stencil Bug: angleproject:352364582 Change-Id: I63fd78314fa7ebccbf366c252e309a9c0f09c8c1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5938150 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 31c80bbf 2024-10-17T10:56:16 Vulkan: Avoid redundant work in updateFullActiveTextures ContextVk keeps mActiveTexturesDesc, which gets updated by UpdatePreCacheActiveTextures(). This is only used for cache lookup. When there is a cache miss, we end up call updateFullActiveTextures() which recomputes DescriptorSetDesc again, which is redundant work. This CL removes mActiveTexturesDesc from ContextVk. UpdatePreCacheActiveTextures has been changed to be a DescriptorSetDescBuilder method so that it can directly update the mDesc. updateFullActiveTextures has been renamed to updateActiveTexturesForCacheMiss which avoid mDesc calculation. updateFullActiveTextures is still kept for now which will be used in next CL when cache is disabled. Bug: b/372268711 Change-Id: Ic9a0cdaa7cefca5f72b599d26d079cef14888f07 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5905766 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao dd54eeec 2024-10-11T13:26:46 Reland "Vulkan: Track GPU progress for individual DescriptorSet" This is a reland of commit 292102944add2ab30f4aa12a971cac456cc7726b with the fix of garbage being added back to garbage list. Original change's description: > Vulkan: Track GPU progress for individual DescriptorSet > > Right now ProgramExecutableVk keeps VkDescriptorSet object, and > DescriptorSetHelper is created when a cache entry becomes invalid. > Further, DescriptorSetCache keeps the cache of {VkDescriptorSet, > RefCountedDescriptorPoolHelper} pair. So we are having three different > type of objects at different stages of life: VkDescriptorSet, > DescriptorSetHelper, and {VkDescriptorSet, > RefCountedDescriptorPoolHelper. This CL makes DescriptorSetHelper at > creation and at cache and at garbage. With this change, you have a > reference counted DescriptorSetHelper object (i.e, DescriptorSetPointer) > during entire life cycle and is passed around between cache and program > as is. This CL is preparation for the future CL where we may disable > cache for descriptorSet. The descriptorSet will be added to garbage list > and reused constantly without go through the cache code. We need to > track the individual descriptorSet with ResourceUse so that it won't > reuse until GPU is finished. This CL is making DescriptorSetHelper a GPU > tracking object so that it will still just work when cache is disabled. > > Bug: angleproject:372268711 > Change-Id: I1cfb77cc5069b202d870388fd8809e265cdca90b > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5918586 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Yuxin Hu <yuxinhu@google.com> Bug: angleproject:372268711 Change-Id: Ic920f99cc78cde1e94690bdbee3b885844fa155b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5954701 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao 45cc47af 2024-10-22T21:41:22 Revert "Vulkan: Track GPU progress for individual DescriptorSet" This reverts commit 292102944add2ab30f4aa12a971cac456cc7726b. Reason for revert: Causing bot failure in later CLs Original change's description: > Vulkan: Track GPU progress for individual DescriptorSet > > Right now ProgramExecutableVk keeps VkDescriptorSet object, and > DescriptorSetHelper is created when a cache entry becomes invalid. > Further, DescriptorSetCache keeps the cache of {VkDescriptorSet, > RefCountedDescriptorPoolHelper} pair. So we are having three different > type of objects at different stages of life: VkDescriptorSet, > DescriptorSetHelper, and {VkDescriptorSet, > RefCountedDescriptorPoolHelper. This CL makes DescriptorSetHelper at > creation and at cache and at garbage. With this change, you have a > reference counted DescriptorSetHelper object (i.e, DescriptorSetPointer) > during entire life cycle and is passed around between cache and program > as is. This CL is preparation for the future CL where we may disable > cache for descriptorSet. The descriptorSet will be added to garbage list > and reused constantly without go through the cache code. We need to > track the individual descriptorSet with ResourceUse so that it won't > reuse until GPU is finished. This CL is making DescriptorSetHelper a GPU > tracking object so that it will still just work when cache is disabled. > > Bug: angleproject:372268711 > Change-Id: I1cfb77cc5069b202d870388fd8809e265cdca90b > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5918586 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Yuxin Hu <yuxinhu@google.com> Bug: angleproject:372268711 Change-Id: I4d3c34058d100112a098144276b52c0faf8d593a No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5955529 Auto-Submit: Charlie Lao <cclao@google.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Charlie Lao 29210294 2024-10-11T13:26:46 Vulkan: Track GPU progress for individual DescriptorSet Right now ProgramExecutableVk keeps VkDescriptorSet object, and DescriptorSetHelper is created when a cache entry becomes invalid. Further, DescriptorSetCache keeps the cache of {VkDescriptorSet, RefCountedDescriptorPoolHelper} pair. So we are having three different type of objects at different stages of life: VkDescriptorSet, DescriptorSetHelper, and {VkDescriptorSet, RefCountedDescriptorPoolHelper. This CL makes DescriptorSetHelper at creation and at cache and at garbage. With this change, you have a reference counted DescriptorSetHelper object (i.e, DescriptorSetPointer) during entire life cycle and is passed around between cache and program as is. This CL is preparation for the future CL where we may disable cache for descriptorSet. The descriptorSet will be added to garbage list and reused constantly without go through the cache code. We need to track the individual descriptorSet with ResourceUse so that it won't reuse until GPU is finished. This CL is making DescriptorSetHelper a GPU tracking object so that it will still just work when cache is disabled. Bug: angleproject:372268711 Change-Id: I1cfb77cc5069b202d870388fd8809e265cdca90b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5918586 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao 4bdcdf0d 2024-10-16T11:44:49 Vulkan: Switch RefCountedDescriptorPoolBinding to use SharedPtr This mostly a clean up. RefCountedDescriptorPoolBinding is replaced with DescriptorPoolPointer, which is defined as SharedPtr<DescriptorPoolHelper>. It has more intuitive semantics to use. Bug: angleproject:372268711 Change-Id: I0397111b5228e896c1d226e00930851319d955a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5938947 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao c52e8493 2024-10-11T14:21:19 Vulkan: Switch DescriptorPoolPointer to use SharedPtr To make the reference counting easier to maintain, SharedPtr class is added to automatically tracking the reference counting and object creation/destruction. Right now we have BindingPointer class doing similar things except it does not automatically manage the object create/destroy, which makes it less robust as well as redundant code to manage object life cycle. The other problem with BindingPointer is that it does not work with normal assign/copy operator which made it hard to read and use. SharedPtr uses exact same API semantics as std::shared_ptr, which makes the reference counting very easy to use. The main difference of SharedPtr and std::shared_ptr is that it does not use any atomic or lock since it assumes user only uses it under thread safe environment, which ANGLE's backend is. This CL also changes mDescriptorPools to mDynamicDescriptorPools to make it clear that it is dynamic descriptor pool not the descriptor pool. This is also preparation CL for the next CL where we will use SharedPtr to manage DescriptorSetHelper life cycle, which otherwise a bit complicated to manually manage. Bug: angleproject:372268711 Change-Id: I1033d9bf259bbc075a9b374d8a28e1f67d889873 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5926183 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 323187d9 2024-10-11T13:48:51 Vulkan: Fix color attachment limit with framebuffer fetch ANGLE incorreclty assumed that the input descriptor limit is at least as big as the color attachment limit. This is not true on Intel/windows where 8 color attachments are available but only 7 input descriptors. With this change, the color attachment limit is dropped to 7 in such a case so that framebuffer fetch can continue to be supported. Bug: angleproject:372873263 Change-Id: If836563b47399a23b293b74815f6bccb21aaf47c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5919759 Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
angle-autoroll 6024e9c0 2024-10-02T08:01:43 Manual roll VK-GL-CTS from 65470ff2e321 to 179dd9f858f0 (27 revisions) https://chromium.googlesource.com/external/github.com/KhronosGroup/VK-GL-CTS.git/+log/65470ff2e321..179dd9f858f0 2024-09-30 lorenzo@khronosgroup.org Fix build 2024-09-30 mark@igalia.com Support standalone executable builds on Android 2024-09-30 javed@igalia.com Add tests for draw count clamping with null index buffer 2024-09-30 piotr.byszewski@mobica.com Capture replay tests for VK_EXT_descriptor_buffer 2024-09-30 javed@igalia.com Add tests vkCmdDrawIndexedIndirectCount draw count clamping 2024-09-30 rgarcia@igalia.com Add R8 and R16 large image tests in host image copy test group 2024-09-30 ziga@lunarg.com Add missing linked shader object test case 2024-09-30 tapani.palli@intel.com Fix issues with GLX reset notification strategy 2024-09-30 kamil.goras@mobica.com Split KHR-GLES32.core.tessellation_shader.vertex.vertex_spacing 2024-09-30 jimblackler@google.com Handle resize events in EGL bounding box tests. 2024-09-30 lorenzo@khronosgroup.org Merge vk-gl-cts/vulkan-cts-1.3.9 into vk-gl-cts/main 2024-09-30 lorenzo@khronosgroup.org Merge remote-tracking branch 'vk-gl-cts/dev/VK_EXT_depth_clamp_control' into main 2024-09-30 lorenzo@khronosgroup.org Update Vulkan spec to 1.3.296 2024-09-30 lorenzo@khronosgroup.org Merge remote-tracking branch 'vk-gl-cts/dev/VK_KHR_compute_shader_derivatives' into main 2024-09-20 lorenzo@khronosgroup.org Update SPIRV-Tools, SPIRV-Headers, glslang, Vulkan-Docs, Vulkan-ValidationLayers external sources 2024-09-19 piotr.byszewski@mobica.com Check limits before running mapping_to_large_index DRLR test 2024-09-19 ziga@lunarg.com Test pipeline without render pass or VkPipelineRenderingCreateInfo 2024-09-19 piotr.byszewski@mobica.com Remove invalid dynamic rendering local read tests 2024-09-19 piotr.byszewski@mobica.com Fix pipeline binary graphics tests 2024-09-19 piotr.byszewski@mobica.com Fix pNext chain loop in FSR tests 2024-09-19 kamil.goras@mobica.com Split KHR-Single-GL46.arrays_of_arrays 2024-09-19 marcin.hajder@mobica.com Port KC-CTS tests to VK-GL-CTS (glGetUniform), PART 11 2024-09-19 marcin.hajder@mobica.com Port KC-CTS tests to VK-GL-CTS (scissor_blit), PART 12 2024-09-19 marcin.zajac@mobica.com Suballocated DRM images 2024-09-19 piotr.byszewski@mobica.com Test feedback loop with dynamic rendering local read 2024-09-19 lorenzo@khronosgroup.org Merge vk-gl-cts/vulkan-cts-1.3.9 into vk-gl-cts/main 2024-09-18 jimblackler@google.com Fix error in test logging in all CtsDeqpTestCases If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/vk-gl-cts-angle-autoroll Please CC angle-team@google.com,syoussefi@google.com on the revert to ensure that a human is aware of the problem. To file a bug in ANGLE: https://bugs.chromium.org/p/angleproject/issues/entry To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Bug: None Change-Id: Idbc50f78119327844e1488db25d58c1c588f9ff6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5903935 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Matthew Denton 7e462c22 2024-09-17T15:32:41 WGPU: Implement SetUniform() enough so GetUniform() works Lays out a shadow buffer for basic uniforms per-shadertype in std140, which is close to matching WGPU's layout. This does not actually pass the buffer to WGPU as a uniform buffer. GetUniform() just reads from the shadow buffer. This is copied from the VK backend and so some code is deduplicated. Bug: angleproject:42267100 Change-Id: I727dc9e09a7ccabbb617f148dd68590469883b07 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5867444 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org> Reviewed-by: Liza Burakova <liza@chromium.org>
Igor Nazarov 703c5960 2024-07-24T17:02:28 Vulkan: PPO must warmup pipeline cache according to GPL support This commit caused regression: https://chromium-review.googlesource.com/c/angle/angle/+/5366173 `ProgramPipelineVk::link()` uses Complete subset for warmup regardless of the GPL support. However, `ContextVk::createGraphicsPipeline()` will respect the GPL support. Before the above change, PPO was respecting GPL for warmup. This change removed `subset` parameter from the `getPipelineCacheWarmUpTasks()` not only to avoid copy-paste logic, but also to ensure consistency with `waitForGraphicsPostLinkTasks()`. Bug: angleproject:8601 Change-Id: Iab5df1b55921649a8f98a34bb07d8e6a145bfd4d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5738153 Reviewed-by: mohan maiya <m.maiya@samsung.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 7691cea7 2024-07-22T13:46:14 Vulkan: Remove seamful cubemap emulation Practically, the Vulkan backend is never expected to run on ES2 hardware. It _may_ for WebGL, but seamful cubemap emulation was disabled for webgl anyway. Bug: angleproject:354729454 Change-Id: Iafa20fbdbe232c4df4c777b12e7698ef7a87cf24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5730143 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 7d461b21 2024-07-10T14:11:53 Revert "Vulkan: Use VK_KHR_dynamic_rendering[_local_read]" This reverts commit c379ff48043a47e444c388c45270db40d3172d50. Reason for revert: Regresses CPU perf and memory when _not_ using DR Original change's description: > Vulkan: Use VK_KHR_dynamic_rendering[_local_read] > > Bug: angleproject:42267038 > Change-Id: I1f4eb0f309992a9c1c287a69520dadf5eff23b26 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637155 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> > Reviewed-by: Charlie Lao <cclao@google.com> Bug: angleproject:42267038 Change-Id: I3865f0d86813f0eeb9085a92875a33bd449b907f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5691337 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c379ff48 2024-06-10T22:01:57 Vulkan: Use VK_KHR_dynamic_rendering[_local_read] Bug: angleproject:42267038 Change-Id: I1f4eb0f309992a9c1c287a69520dadf5eff23b26 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637155 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Mohan Maiya 5703bd61 2024-06-14T14:12:41 Vulkan: Further optimize ProgramExecutableVk::resetLayout 1. Handle compute pipelines similar to how we handle graphics pipelines 2. Track valid compute pipeline permutations Bug: angleproject:8297 Change-Id: I58200517e5a44a2b3092777ea24d1529ceee00f5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5634574 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 8ae91859 2024-06-13T15:38:11 Vulkan: Optimize ProgramExecutableVk::resetLayout Instead of iterating through all elements of caches and programinfo, track valid permutations of ProgramTransformOptions. Bug: angleproject:8297 Change-Id: I7676f153f696bf8c4fb268792c667fdac12f827c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5629578 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Igor Nazarov 68a899c2 2024-06-04T12:02:06 Vulkan: Remove shaderProgramOut from initGraphicsShaderPrograms - Remove `shaderProgramOut` from `ProgramExecutableVk` `initGraphicsShaderPrograms()` method, because in all instances argument was `nullptr` (unused). - Update `ProgramInfo::getShaderProgram()` to return reference instead of pointer. This removes confusion, causing unnecessary ASSERTs that checked result for `nullptr`. Note: CL that removed last use of `shaderProgramOut`: https://chromium-review.googlesource.com/c/angle/angle/+/5408796 Bug: angleproject:8297 Change-Id: Idf9fb1c3fd42e90dd385f48a5714ea2751f0c7db Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5596549 Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Igor Nazarov d0280f09 2024-06-03T13:21:06 Cleanup Program Executable post link task wait Frontend changes: - Add `ASSERT` into `ProgramExecutable::waitForPostLinkTasks()` to check that `mPostLinkSubTasks` must be empty after backend wait. - Add `UNIMPLEMENTED` into `ProgramExecutableImpl` `waitForPostLinkTasks()`, because this method is only required if backend fills `postLinkSubTasksOut` in `LinkTask`, and frontend must not call this method if `mPostLinkSubTasks` are empty. Vulkan backend changes: - Add public `ProgramExecutableVk::waitForComputePostLinkTasks()` with ASSERT to only allow usage with Compute executable. This change avoids confusion calling `waitForPostLinkTasksIfNecessary()` with `nullptr` in case of the Compute pipelines, which will always wait. - Rename `waitForPostLinkTasksIfNecessary()` to `waitForGraphicsPostLinkTasks()`, add ASSERT to only allow usage with Graphics executable, and change optional pointer to the `GraphicsPipelineDesc` to the reference. - Add `WaitableEvent::AllReady()` check into `ProgramExecutableVk` `waitForGraphicsPostLinkTasks()` when going to skip waiting, in order to process tasks (by calling wait) when all tasks are ready. Without this change, post link task may never be processed, causing repeated `GraphicsPipelineDesc` comparisons. - Replace `GraphicsPipelineDesc` hash comparison in `waitForGraphicsPostLinkTasks()` with `keyEqual()` call. This method is around 7 times faster, however effect on the overall performance will likely be unmeasurable. Changed for clarity. - Remove unnecessary `mWarmUpGraphicsPipelineDesc` reset from: `ProgramExecutableVk` initializer list (has default constructor), Compute warmup (already clean after constructor), wait post link tasks (not used when no tasks). - Other minor changes. Bug: angleproject:8297 Change-Id: I7d790da6712be013243083e314af75f82e73886d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5592474 Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Roman Lavrov 5e66f6e4 2024-06-03T09:27:44 Vulkan: Make setUniformMatrixfv a free function Same as https://crrev.com/c/5588853 but for matrices const gl::ProgramExecutable and non-const output variables, makes it clear that it only updates: mDefaultUniformBlocks mDefaultUniformBlocksDirty Bug: angleproject:8666 Bug: b/335295728 Change-Id: Ie5a5d527bf314309860fc7ca193c2a32013e7872 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5592968 Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Roman Lavrov 9137d9a9 2024-05-31T12:28:04 Vulkan: Make setUniformImpl a free function const gl::ProgramExecutable and non-const output variables, makes it clear that it only updates: mDefaultUniformBlocks mDefaultUniformBlocksDirty Bug: angleproject:8666 Bug: b/335295728 Change-Id: I8851eb500c3e09e896d02c0f83b700cde2a1bbf1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5588853 Auto-Submit: Roman Lavrov <romanl@google.com> Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Roman Lavrov 818915a9 2024-05-27T10:53:35 PPO: Propagate dirty uniforms via mPPOProgramExecutables This eliminates the need for ProgramUniformUpdated notification Update mDefaultUniformBlocksDirty rather than just add a check to hasDirtyUniforms, as mDefaultUniformBlocksDirty can then be used elsewhere (for example, calcUniformUpdateRequiredSpace) Also adds ProgramExecutable.mIsPPO flag for an easy check for PPO without inspecting mPPOProgramExecutables Bug: angleproject:8666 Bug: b/335295728 Change-Id: I7725d02460104997df5c89a54d0e5ef3c3079946 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5569184 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jose Dapena Paz 47fc356b 2024-04-09T11:20:07 GCC: move warm up tasks out of anonymous namespace GCC anonymous namespace is set per file. So forward declaring in the anonymous namespace of .h will not be valid in the .cpp file. Bug: chromium:40565911 Change-Id: I10bd94f035761602d69e59a94dfde5dc774a6776 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5475346 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 36ae4553 2024-04-21T05:18:17 Vulkan: Remove unnecessary member from ProgramExecutableVk Bug: None Change-Id: I896cd67c0ca41d146d8f1cd5494404bbd30b8264 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5469555 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya c1397510 2024-04-07T21:05:34 Vulkan: Fix data race in WarmUpGraphicsTask std::unordered_map doesn't support simultaneous read and write. Cache placeholder PipelineHelper in WarmUpGraphicsTask and std::move the newly created PipelineHelper when warm up is complete. Bug: angleproject:8297 Change-Id: I1cc4b3cd48147d0080666d5669d61de006c2252d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5431830 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya ad13fec3 2024-03-30T15:31:49 Vulkan: warmUpGraphicsPipelineCache(...) shouldn't set state The prepareForWarmUpPipelineCache(...) method would have already setup all necessary state for the warm up task. Make that intent explicit by calling into a method that sets no state. Bug: angleproject:8297 Change-Id: I959d8591045ff05ddb2a410fd0e0eda8dd692d37 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5408796 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 06472a7e 2024-04-04T21:07:02 Extend ProgramExecutableImpl API waitForPostLinkTasks(...) will be called into by the frontend. Backends can now choose to defer or avoid waiting for post-link tasks. Also, move warmUp task code to ProgramExecutableVk in the Vulkan backend Bug: angleproject:8297 Change-Id: Ia8a0682923e2f8c6287d62a606eed7f481cda08f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5427000 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 6d569003 2024-03-17T13:15:21 Vulkan: Deduplicate merge to Renderer's pipeline cache Decouple warmUp*PipelineCache(...) and the merge of ProgramExecutableVk::mPipelineCache into Renderer's global cache. This allows the last link subtask to perform the merge once instead of doing so in each subtask. Also, remove AtomicShared datatype and use AtomicRefCounted directly Bug: angleproject:8601 Change-Id: If27831d7d132a3b8644c425072169cf2e9a4bc69 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5376409 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Mohan Maiya 553e3c80 2024-03-15T08:40:42 Vulkan: Async compile pipelines with different surface rotations Add prepareForWarmUpPipelineCache(...) method to ProgramExecutableVk that sets up the required common state for warmup tasks. On platforms that support worker threads enqueue a warmup task per surface rotation. Bug: angleproject:8601 Change-Id: I22c0d664736ef682d4207c1e08163f79ac79f7d0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5366173 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 60aaf4a0 2024-03-14T12:58:56 Vulkan: Move renderer to namespace vk This class is agnostic of EGL. This change moves it to namespace vk for use with the OpenCL implementation Bug: angleproject:8564 Change-Id: I57f7807d6af8b3d5d7f8efbaf8b5d537a930f881 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5371324 Reviewed-by: Austin Annestrand <a.annestrand@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi ecc35205 2024-01-25T23:58:25 Move uniform block dirty bits to State When glUniformBlockBinding changes the mapping from a program uniform block to a buffer binding, all contexts in the share group need to reprocess the affected block index. Prior to this change, the dirty bits that indicated which blocks have their mapping redefined were placed in the program executable, and were reset by the first context that processed them. As a result, the other contexts in the share group where not aware of such modifications. Similarly, when a buffer changed in one context, the mapped program blocks were marked dirty, with similar cross-context issues. In this change, the dirty bits are moved to State, so every context would react to these changes. Bug: angleproject:8493 Change-Id: I5712002224cbc4a576bf2ac46e8e75f26ebc5b2a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5238991 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 572323cc 2024-01-11T16:20:02 Fix program link after backend rejects program binary If ANGLE believes the program binary is fine, it populates the program executable. If the backend then rejects the program binary, the executable was not reset. After the rejection, ANGLE proceeds to redo the program link, in which case it fails in various ways (ASSERT failures, incorrect data etc) as it tries to accumulate info on top of the previous executable. Bug: angleproject:8471 Change-Id: Ia4d626f5f9643c39a81062da3d5d58aa4c6be762 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5189152 Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi dd8432b5 2023-11-14T14:39:45 Remove angle::Result::Incomplete from shader/program paths angle::Result is not an error code, and having Incomplete made it very unclear what the purpose of this class is. A follow up will remove it entirely. Bug: angleproject:8414 Change-Id: Ica8271b9f7d8868671c7658161e50a53ef23c681 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5028091 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Cody Northrop 1ea49a22 2023-10-13T11:28:41 Move uniform dirty bits to ProgramExecutable Rather than try to funnel them through Program and ProgramPipeline to the executable in the backend, just move them to ProgramExecutable in the front end. This fixes Dota Underlords at the same time due to not needing to set the Program dirty to propagate bits. Test: Dota Underlords Test: ProgramPipelineTest31.ProgramPipelineBindBufferRange Bug: b/299532942 Change-Id: Ic73c45608e22f89ca400ebf684f8cd287ed2f43a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4922969 Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi eb0d5997 2023-09-15T16:41:13 Move set/get uniform machinery to ProgramExecutable This is done because some uniforms are internally added by the compiler (draw ID, base vertex, and base instance) and are automatically set **on the installed executable**. This change fixes scenarios where a draw is done after a program has failed a relink, and therefore is unable to correctly set the uniforms (as it does not have access to the executable that is installed). It also fixes draws that use those uniforms in a PPO. Bug: angleproject:8297 Change-Id: Id74b4984b88aa09b5b81be1c91412d6c91711136 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4864693 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 68bfa1ed 2023-08-22T22:02:15 Support for link to be entirely parallelized The link job is split as such: - Front-end link - Back-end link - Independent back-end link subtasks (typically native driver compile jobs) - Post-link finalization Each step depends on the previous. These steps are executed as such: 1. Program::link calls into ProgramImpl::link - ProgramImpl::link runs whatever needs the Context, such as releasing resources - ProgramImpl::link returns a LinkTask 2. Program::link implements a closure that calls the front-end link and passes the results to the backend's LinkTask. 3. The LinkTask potentially returns a set of LinkSubTasks to be scheduled by the worker pool 4. Once the link is resolved, the post-link finalization is run In the above, steps 1 and 4 are done under the share group lock. Steps 2 and 3 can be done in threads or without holding the share group lock if the backend supports it. Step 2 is not yet made independent of the Context on some backends, and a frontend feature is used to make that step either run on the main thread or as a worker thread. Bug: angleproject:8297 Change-Id: I12f1e6bbaf365543dfcac969e166e0b5aa622104 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4808191 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 6698fb69 2023-08-25T22:21:32 Vulkan: Stop passing both ProgramExecutable and ...Vk around Now that ProgramExecutableVk is accessible through ProgramExecutable. Bug: angleproject:8297 Change-Id: Ie08770ef97400195d63b87f2d4b7e2a2c8f4ad24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4812147 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi ae67a24b 2023-08-25T14:51:50 Metal: Move program state to ProgramExecutableMtl Bug: angleproject:8297 Change-Id: I1d13f7aee1ff5b0ce799b486d8a57c83c4481983 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4812047 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi bb135f0e 2023-08-24T15:29:11 Make ProgramExecutableImpl managed by ProgramExecutable This change allows both parts of the program executable to be safely backed up and swapped on link. Bug: angleproject:8297 Change-Id: I17e4b6c05e4e481a66a227d6047dbf943d2c2603 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4812138 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 57388ab2 2023-08-24T14:44:48 Vulkan: Make sure ProgramVk has no members other than executable The program is really just an interface to the executable. It should not hold on to any data on its own. The SpvProgramInterfaceInfo member did not even need to be a member, and was left over from previous refactorings. Bug: angleproject:8297 Change-Id: I4edb53c1c8b27e242a62fb4fc253ade58bd8dde1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4812137 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 571b4cdb 2023-08-14T16:55:28 Vulkan: Move pipeline/desc-set layout creation to link job The pipeline and desc-set layout caches are consequently made thread-safe. The reference counter on the layouts are also made atomic. With this change, practically all of the link in the Vulkan backend is moved to the link job. Bug: angleproject:8297 Change-Id: Iba694ece5fc5510d34cce2c34441ae08ca5bb646 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4774787 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi cfd9ccd0 2023-08-09T17:21:20 Reland: Vulkan: Move SPIR-V set up to link job This is a reland of 10f54902e816fa7e4cf314384e00590e2b9bfa1d Bug: angleproject:8297 Change-Id: I701b750a13ac5b17df67dee5b6c37c13c60f5b10 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4793219 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 8f64b51d 2023-08-09T16:51:13 Reland: Vulkan: Move default uniform init to link job This is a reland of d8cd4dcdc9c55c88f030f7fca41357e99e600ed2 Bug: angleproject:8297 Change-Id: Ib4f8e9dd258da71d44983bbb619b6b4abda0b109 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4793218 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 4ba4af61 2023-08-17T11:28:18 Revert recompile blocking on link Causing timeouts on some platforms. An alternative implementation will follow. This change also reverts two changes that depend on it: Vulkan: Move SPIR-V set up to link job 10f54902e816fa7e4cf314384e00590e2b9bfa1d. Vulkan: Move default uniform init to link job d8cd4dcdc9c55c88f030f7fca41357e99e600ed2. Bug: angleproject:8297 Change-Id: I9a258460e7bcaeac214be5e63c16c20681e0bcde Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4789843 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi 10f54902 2023-08-09T17:21:20 Vulkan: Move SPIR-V set up to link job Bug: angleproject:8297 Change-Id: I2c7eb0281d181560c8fa3ace007b1e547b6cf18e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4764619 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi d8cd4dcd 2023-08-09T16:51:13 Vulkan: Move default uniform init to link job Bug: angleproject:8297 Change-Id: I5bab916f452439d92afa65b9172574000ee0b587 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4762838 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 16cfa28e 2023-08-08T22:08:24 Vulkan: Basic infra for parallel link This change moves pipeline warm up to a parallelizable task, mostly as an exercise to put in the infrastructure for parallel link in the Vulkan backend. Follow up changes will move more of the link step to this task. The end goal is to be able to make the link task independent of ContextVk, which would allow it to be run as an UnlockedTailCall, even if not using a worker thread. Bug: angleproject:8297 Change-Id: I17047162b2a41f0d681d9e3ee33f2e0239b4280d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4764231 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 02292814 2023-06-01T14:46:05 Vulkan: Optimize the usage of FastMap in DescriptorSetDescBuilder While looking at disassemble of DescriptorSetDescBuilder::updateOneShaderBuffer() function, I noticed that there are a lot of CPU cycles spent in FastMap::operator[]. What happend here is that we are increasing size one by one as we build descriptorSet, and that hit `if (mData.size() <= key)` case and we end up resize the underline FastVector, and that resize also initialize the element with zeros, which immediately overwrite by actual data. Since we actually know the eventual size of DescriptorSetDescBuilder::mDesc/mHandles/mDynamicOffsets, we could just switch to angle::FastVector which will avoid this check size and grow every time we write to it. This CL switches the use of FastMap in DescriptorSetDescBuilder to FastVector. The only trick we need to watch out is that previously the new elements are always zero filled and now it does not. So we need to make sure we write every field of structure. This CL also renames WriteDescriptorDescBuilder to WriteDescriptorDescs since when it is read only we are passing it as const reference already, there is no added advantage to have two classes. Bug: b/282194402 Change-Id: I06a063cc51585fc17fbf0d5aa916b9aa0ab88dd4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4581881 Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b5f87c04 2023-06-20T20:22:15 Vulkan: Simplify shader interface variable map The shader interface variable map had a "resource index" -> info map to optimize descriptor set building. That avoided hashing the resource name when the rest of the map was name-based. With the map using SPIR-V ids now, there is no reason to maintain this map; SPIR-V ids can be used to look up the info just as efficiently. Bug: angleproject:7220 Change-Id: I619783dce558a59184955cc314c1f41e6733f1b7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4630728 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi c1ba8e6f 2023-06-20T16:03:20 Vulkan: Flatten shader interface variable maps This change removes duplicate entries added in the shader shader interface variable maps. One level of arrayness (indexed by shader type) is removed from these maps as now there is only a single entry per linked resource/etc. Bug: angleproject:7220 Change-Id: Ibf2d06a0e1f68e68797c2066f36e14cb9e667f77 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4628677 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi bbcf54bc 2023-06-16T16:02:08 Vulkan: Refactor uniform/block binding duplication code Previously, resource binding assignment was done as such: ``` for each shader stage assign bindings to textures assign bindings to blocks assign bindings to images etc ``` To deduplicate bindings when the same resource was used in multiple stages, a map was used, keyed by the resource's name, to detect when an already visited resource is encountered in a future stage. This was both inefficient and unnecessarily complicated. With this change, resource binding assignment is done as such: ``` for each texture assign one binding to all shader stages for each block assign one binding to all shader stages for each image assign one binding to all shader stages etc ``` The aforementioned map is removed. Because the resource bindings are now changed, the rest of the code (which sets up the pipeline layout, updates descriptor sets, sets dynamic buffer offsets, etc) are all updated to follow the above pattern. As a result, nested loops are avoided and duplicate entries in the variable map are never visited. Bug: angleproject:7220 Change-Id: Iaff7b5f8b2bada8ac5078d21e5c790bf0d27aca7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4622011 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao e21ecd1b 2023-05-26T14:06:46 Vulkan: Add dirty bit processing for uniform buffer change When app calls glBufferData for the uniform buffer, we may end up reallocate the storage. This will set DIRTY_BIT_UNIFORM_BUFFER_BINDINGS on the context, but the exact uniform block index gets lost along the way. This CL sets mDirtyBits on the program for the corresponding block index and then changed vulkan backend to utilize the program's mDirtyBits and only update the buffer if it is dirty, instead of always update all uniform buffers even if only one of the buffer is dirty. In order to make this work, this CL also adds the reverse tracking from buffer binding to uniform blocks. Previously we already have the tracking of which buffer binding index is used for which buffer block index. This CL adds mUniformBlockBindingMasks which is an array of BitSets. Each array element tracks all the uniform block index that is using this buffer binding index (you can have the same buffer bound to multiple uniform block index). Then when a buffer binding index is dirty, that BitSet gets added into program's uniform block dirty bits. This CL and previous CL improves GfxBench gl_driver2_off score 1.8% (from average 6797 to average 6919) on pixel 7 pro. Bug: b/282194402 Change-Id: Ic5002643a5297907276fc9b20ca7d21af9bdc4fe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4553136 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 93eee5d2 2023-05-18T16:33:25 Vulkan: Add the Sample decoration when sample shading The Vulkan spec was clarified that per-sample interpolation is not necessarily done when sample shading is enabled in the API. In this change, a SPIR-V transformation is added to add the Sample decoration to whatever varying is missing it when sample shading is enabled in the API. Bug: b/283017896 Change-Id: I121c740add6fc015c9140e6a04d37ea5300c8e57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4544591 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 297687c6 2023-05-18T17:27:54 Vulkan: Reduce CPU overhead for uniform buffer change One of the common usage pattern is change uniform buffers and draw. Right now every uniform buffer change goes into ShaderResource dirty code path that rebuilds entire ShaderResource cache key and descriptor set etc. This CL keeps SHaderResource dirty code path, and will be used when program changes or framebuffer changes. But uniform buffer change will go down its own code path that only update uniform buffer related state. This CL along with prior two CLs reduced asphalt_9 average frame time (with multi context hacked away) from 5.375 ms to 5.2594 ms (reduced 2.15%). Bug: b/282194402 Change-Id: Ibae2895663918ddc10bf13bc559f1483f94d2e11 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4528314 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Roman Lavrov <romanl@google.com>
Charlie Lao 9445fbbe 2023-05-16T10:43:55 Vulkan: Move mWriteDescriptors out of DescriptorSetDescBuilder DescriptorSetDescBuilder has two data structures: mWriteDescriptors, which keeps track of "layout" of descriptorSet, and mDescriptorInfos, which is the actual cache key for descriptorSet. mDescriptorInfos will be updated every time buffer or image changes. But mWriteDescriptors is immutable with buffer/image, it is static per program executable (with exception of InputAttachment). Right now whenever there is a buffer or image change, we call into DescriptorSetDescBuilder and update both mWriteDescriptors and mDescriptorInfos. This CL moves mWriteDescriptors out of DescriptorSetDescBuilder, and stores it in ProgramExecutableVk. To deal with InputAttachment variation, ContextVk makes a copy of mWriteDescriptors when program is bound, and then update inputAttachment with framebuffer information. This not only removes unnecessary update of mWriteDescriptors, but also removes the requirement that mShaderBuffersDescriptorDesc has to reset and rebuild as a whole (because mWriteDescriptors keeps mCurrentInfoIndex which gets incremented as we build). This allows us to do further optimization in future to do piece meal update of mDescriptorInfos with only the changed data. Bug: b/282194402 Change-Id: I443c7c3b85b7a2e2e93c68d40ea102533c43f76a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4540280 Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 2c836045 2023-05-18T12:00:41 Vulkan: Remove buffer/image tracking from DescriptorSetDescBuilder Right now DescriptorSetDescBuilder keeps an array of images and buffers as we build DescriptorSet cache key. Later on if we have a cache miss and allocated a new cache entry, we walk the array and tag the images and buffers with newSharedCacheKey. If we have a cache hit, the tracked images/buffers are unused and then cleared. This means the effort of keep track of these buffers are wasted when we have cache hit, which we expect to be most likely. This was initially implemented this way simply because of convenience, but there is really not a need to add another tracker for them, as they are readily available from context state anyway. This CL remove the tracking of images/buffers from DescriptorSetDescBuilder and replaced with context API to tag images and buffers with newSharedCacheKeywhen when we have a cache miss. Bug: b/282194402 Change-Id: I355c2fbabdfc573ce71c0a4281788c942d260271 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4539290 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Hailin Zhang 8b9440b6 2023-05-01T15:31:01 Vulkan: add option to control pipeline cache data compression. Bug: b/258207403 Change-Id: I487b1cadbacfa2f7ee889a8f58278307a126a391 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4497248 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Hailin Zhang <hailinzhang@google.com>
Shahbaz Youssefi 40c17b58 2022-12-13T15:35:23 Vulkan: Move SPIR-V transform to vulkan/ No longer used by metal/. Bug: angleproject:7220 Change-Id: Idb3a6369fefbcf87e7993daa652c8702ec53c20f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4104002 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi a1be7188 2022-12-12T16:11:34 Vulkan: Keep referenced pipeline libraries alive As required by the spec, it's not enough to keep the linked pipeline alive. With this change, the serials of the invidual libraries are updated every time the serial of a linked pipeline is updated. Bug: angleproject:7369 Change-Id: Iedc98a427d988d00b4e8745964d9827fdf51ea7f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4098744 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi bd79968a 2022-12-02T14:17:14 Vulkan: Make sure program's pipeline cache is created The condition to create or use the program's pipeline cache has become quite complicated. This change simplifies things by making sure the pipeline cache is created if and when it's used, instead of guessing how it will be used and pre-create it. Bug: angleproject:7369 Change-Id: I7f3558e55f391da8c701e359d2f88d248c820de4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4076508 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 6384f76b 2022-11-16T21:47:04 Vulkan: Move PipelineCacheAccess to namespace vk In preparation for a change that uses it in that namespace. Bug: angleproject:7369 Change-Id: Icc75b8839d702fd3e6d3d00c1d8f81619cdd89cc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4031150 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxin Hu 3db679eb 2022-11-22T10:37:31 Revert "Vulkan: Remove useRelaxedPrecision" and "Vulkan: remove SpirvVaryingPrecisionFixer" This reverts commit cb618b3d42d9013c48b5aa233efc4d80a9c4efa4 and commit 427086a9c7612da7325cb36054859a929c3727d5 Reason for revert: IMG reported that they need to keep the "precision qualifier matching" feature to make triangle clipping work properly, because the clipping needs to to know the decoration in vertex shader output in order to sort the data correctly for clipping. Original change's description: > Vulkan: Remove useRelaxedPrecision > > Bug: angleproject:7488 > Change-Id: I30ca3e2740d8810a01615ca778eb072d77ad34d9 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3856658 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Original change's description: > Vulkan: remove SpirvVaryingPrecisionFixer > > Bug: angleproject:7488 > Change-Id: I957839bd8fbdf1cd849d5ed7e9edd65fd1a5f2cb > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3780874 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Yuxin Hu <yuxinhu@google.com> Bug: angleproject:7488 Change-Id: I90b584cbc549a663bca734a59d135a1d1d5bcbfc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4049421 Commit-Queue: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 68b47e58 2022-11-16T10:46:59 Vulkan: Initial support for VK_EXT_graphics_pipeline_library When available, this change uses VK_EXT_graphics_pipeline_library to create pipelines. Currently, it is only used when graphicsPipelineLibraryFastLinking is available. This restricts the use of this extension to devices where monolithic pipelines are not any more performant than linked libraries. A future change adds support for other implementations by providing async pipeline creation. Bug: angleproject:7369 Change-Id: I1e3b7ac4aa56e75c7d6f4d0d5ea91cb0b862e581 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4031489 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Steven Noonan <steven@valvesoftware.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 71d28a9b 2022-11-02T13:19:20 Vulkan: Remove unused ShaderAndSerial The serial in the ShaderAndSerial is unused. This CL removed ShaderAndSerial and replaced with ShaderModule directly. Bug: b/257116399 Change-Id: I50d42af7818a12888309a80423531d75135e0bfd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3998747 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi adde4265 2022-10-19T23:33:48 Vulkan: Separate pipeline cache query and insertion In preparation for VK_EXT_graphics_pipeline_library usage, the query and insertion functions of the graphics pipeline cache are separated. This will allow the implementation using VK_EXT_graphics_pipeline_library to query the monolithic pipeline cache, and if a pipeline is not found, create it through the pipeline library caches. Bug: angleproject:7369 Change-Id: Iebf7669ae3ea95e180646198c4861cc59d67e580 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3963854 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi 7b4b56f0 2022-10-19T00:05:22 Vulkan: Missing output mask in GraphicsPipelineDesc Currently, there's some program state used in creating pipelines alongside what's in GraphicsPipelineDesc. This works because the pipeline cache lives in the program executable. With VK_EXT_graphics_pipeline_library however, we could create vertex input and fragment output partial pipelines that are independent from and are shared between multiple programs. To support this, any program state that's necessary for pipeline creation should be part of the GraphicsPipelineDesc structure. This change places the state affecting fragment output in GraphicsPipelineDesc. Bug: angleproject:7369 Change-Id: I2e48fc9da220475e1b2ed376fc947ce13489610e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3963652 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi b521be4c 2022-10-14T23:09:26 Vulkan: Decouple shader-set from pipeline caches In preparation for VK_EXT_graphics_pipeline_library, where different pipeline caches (for the complete pipelines and the shaders subset partial pipelines) may create pipelines from the same shader set, the pipeline caches are pulled out of ShaderProgramHelper. In an upcoming change, ProgramExecutableVk will have more than one GraphicsPipelineCache instance, both creating pipelines through the same ShaderProgramHelper. The pipeline creation methods in ShaderProgramHelper are now const. This means a thread would be able to create pipelines using an object of this class while the main thread creates other pipelines using the same object, but in a different pipeline cache. Bug: angleproject:7369 Change-Id: Ib8a76dedf1105ba9dfcad9e972157c92ba18e349 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3956944 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 1abeeaae 2022-09-28T12:22:58 GLES1/Vulkan: Remove double SPIR-V validation assertion The SPIR-V transformation is validated on program link because many tests link programs but don't draw with them. This helps catch bugs. However, GLES1 programs are always created right before draw, so the SPIR-V transformer will definitely be run on them. The link-time validation is thus unnecessary. This change disables the latter on GLES1, which cuts down the TexCombine test run time by about 10%. Bug: angleproject:6644 Change-Id: Idb9d229fc08bf746f933fa8924fa67e5426f87a7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3926036 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Yuxin Hu 427086a9 2022-07-22T10:45:24 Vulkan: remove SpirvVaryingPrecisionFixer Bug: angleproject:7488 Change-Id: I957839bd8fbdf1cd849d5ed7e9edd65fd1a5f2cb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3780874 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi be708446 2022-07-25T15:24:52 Vulkan: Remove the bindEmptyForUnusedDescriptorSets workaround Only applied to older Qualcomm-based phones. Bug: angleproject:2727 Change-Id: I37a611e2ff79d898eff9401467407543f3c690b8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3785290 Reviewed-by: Charlie Lao <cclao@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Charlie Lao c7459a46 2022-07-15T09:55:03 Vulkan: Destroy descriptorSet cache when BufferBlock destroyed When a new cache entry has been created, we record the cache entry in the BufferBlock. When BufferBlock is destroyed, we also immediately destroy the cache entry since the cache will no longer reused. This CL also removes DescriptorCacheResult from various APIs since it is now redundant with newSharedCacheKey argument. Bug: b/237686097 Change-Id: I14fa8906fdbe7d9226c8e8ecddef2beb05fbaa5c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3756694 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Auto-Submit: Charlie Lao <cclao@google.com>
Charlie Lao 01092c48 2022-07-12T10:11:22 Vulkan: Destroy descriptorSet cache when shader image is destroyed Similar to texture descriptor set, this applies to images used as shader resource. When a texture is used in a shader resource descriptorSet, we record it. When texture is destroyed, we also destroy that shader resource descriptorSet cache. Bug: b/237686097 Change-Id: I475982fcec45535cc285a4aebca922d01efc7ed2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3758884 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Auto-Submit: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Yuxin Hu 0d3ecf46 2022-06-24T16:37:17 Vulkan: Multisample Framebuffer Fetch Implement Multisample Framebuffer Fetch. This should fix the deqp failure dEQP.GLES31/functional_blend_equation_advanced_msaa_colorburn Bug: angleproject:7351 Bug: angleproject:3586 Bug: angleproject:6195 Bug: b/234173199 Change-Id: Idd7559dcba3d91e36d8f253f1554fb931a7a6775 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3724165 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 723cc880 2022-06-10T17:55:54 Reland "Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid"" This is a reland of commit 551a26aeedbfd971d6199c8eddb433a4f4ff871c Original change's description: > Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid" > > This is a reland of commit 0779ccbcd427dcb00e53afa6385fb4e8e2377993 with > the fix for angleproject:7466. When DescriptorPoolhelper gets > release/destroyed, we ensure all sharedCacheKeys are destroyed. > > Original change's description: > > Vulkan: Destroy DescriptorSet cache when it becomes invalid > > > > When a new texture descriptorSet is allocated, we store one reference of > > the cache key in ProgramExecutableVk and all TextureVks that it > > associated with. When any of the TextureVk is destroyed or its view > > destroyed, we immediately erase the descriptorSet from the cache and > > track GPU progress and free the descriptorSet when it's GPU completed. > > That way we delete the dead descriptorSet that will for sure never been > > reused ASAP so that its space is avialable for reuse. > > > > Bug: b/235523746 > > Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 > > Reviewed-by: Lingfeng Yang <lfy@google.com> > > Commit-Queue: Charlie Lao <cclao@google.com> > > Reviewed-by: Ian Elliott <ianelliott@google.com> > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Bug: b/235523746 > Bug: angleproject:7466 > Change-Id: I4413bec27ea0ca830010e2ca15036c2e667141c0 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3726964 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/235523746 Bug: angleproject:7466 Change-Id: I6b88b884841c5dbc625ee7e0c52c45af09dec199 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3741027 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>
Ian Elliott 4b745c2b 2022-07-01T01:25:36 Revert "Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid"" This reverts commit 551a26aeedbfd971d6199c8eddb433a4f4ff871c. Reason for revert: Blink test failures at: https://ci.chromium.org/ui/p/chromium/builders/ci/WebKit%20Linux%20MSAN/15546/overview Original change's description: > Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid" > > This is a reland of commit 0779ccbcd427dcb00e53afa6385fb4e8e2377993 with > the fix for angleproject:7466. When DescriptorPoolhelper gets > release/destroyed, we ensure all sharedCacheKeys are destroyed. > > Original change's description: > > Vulkan: Destroy DescriptorSet cache when it becomes invalid > > > > When a new texture descriptorSet is allocated, we store one reference of > > the cache key in ProgramExecutableVk and all TextureVks that it > > associated with. When any of the TextureVk is destroyed or its view > > destroyed, we immediately erase the descriptorSet from the cache and > > track GPU progress and free the descriptorSet when it's GPU completed. > > That way we delete the dead descriptorSet that will for sure never been > > reused ASAP so that its space is avialable for reuse. > > > > Bug: b/235523746 > > Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 > > Reviewed-by: Lingfeng Yang <lfy@google.com> > > Commit-Queue: Charlie Lao <cclao@google.com> > > Reviewed-by: Ian Elliott <ianelliott@google.com> > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Bug: b/235523746 > Bug: angleproject:7466 > Change-Id: I4413bec27ea0ca830010e2ca15036c2e667141c0 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3726964 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/235523746 Bug: angleproject:7466 Change-Id: Icdde2752c462b7ebbb51d46fd35ce749b5caf377 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3739585 Reviewed-by: Ian Elliott <ianelliott@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Ian Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Charlie Lao 551a26ae 2022-06-10T17:55:54 Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid" This is a reland of commit 0779ccbcd427dcb00e53afa6385fb4e8e2377993 with the fix for angleproject:7466. When DescriptorPoolhelper gets release/destroyed, we ensure all sharedCacheKeys are destroyed. Original change's description: > Vulkan: Destroy DescriptorSet cache when it becomes invalid > > When a new texture descriptorSet is allocated, we store one reference of > the cache key in ProgramExecutableVk and all TextureVks that it > associated with. When any of the TextureVk is destroyed or its view > destroyed, we immediately erase the descriptorSet from the cache and > track GPU progress and free the descriptorSet when it's GPU completed. > That way we delete the dead descriptorSet that will for sure never been > reused ASAP so that its space is avialable for reuse. > > Bug: b/235523746 > Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 > Reviewed-by: Lingfeng Yang <lfy@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/235523746 Bug: angleproject:7466 Change-Id: I4413bec27ea0ca830010e2ca15036c2e667141c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3726964 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 97a6e581 2022-05-30T16:50:26 Vulkan: Useful implementation of program binaries ANGLE already serializes the pipeline state for the sake of OES_get_program_binary. This serialization had limited usefulness however, since the Vulkan driver hasn't actually created any pipelines yet (which is a costly part of program creation). Simultaneously, ANGLE deferred Vulkan pipeline creation to draw time, which causes hitching. In this change, a handful of Vulkan pipelines are precreated at link time; those at least that are sure to create different blobs in the pipeline cache (different spec consts or SPIR-V generation). These pipelines are created in the program executable's cache. The cache is then merged into the shared renderer cache (for potential blob reuse by other programs). With this, two goals are achieved: - Most pipelines created at draw time hit the pipeline cache, avoiding costly compilation. - When the program binary is retrieved, the contents of the program executable's pipeline cache is also returned. On reload, the cache is recovered, resulting in faster startup. Bug: angleproject:5881 Change-Id: I46c5451a7d0b16dffd40e44015e094640886880b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3671977 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9e47438f 2022-06-07T16:34:18 Vulkan: Fix program creation crash Due to two CLs going in at the same time. Bug: angleproject:7366 Change-Id: I8638b95eefd379abbc64f3b52e87b67f25e1ad52 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3693829 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Amirali Abdolrashidi 3b988fef 2022-06-01T10:54:03 Vulkan: Remove enableLineRasterEmulation * Removed the Bresenham line raster emulation specialization constant, along with related variables and functions. Bug: angleproject:7366 Change-Id: If17c8ce9b459ad801bae8e887e5674bd9a3ff2bf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3680860 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi ce3c0fe9 2022-06-06T12:09:45 Vulkan: Make depth-correction uniform controlled This change makes sure SPIR-V transformations are not required for depth correction, having the number of potential pipelines. Bug: angleproject:5881 Change-Id: If3f66b34bdd1127ae588cbc822ea7cf01fa8621f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3691801 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi a9516865 2022-06-01T22:48:04 Vulkan: Output cache look up feedback in pipeline graph Bug: angleproject:6565 Change-Id: I12bb9ab5756860de9ba26d6b4a9429a78b65df39 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3686029 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 53ec886e 2022-05-30T16:49:11 Vulkan: Externally synchronize the pipeline cache In preparation for a future change that requires this as it may perform pipeline cache merges during creation of pipelines. Bug: angleproject:5881 Change-Id: Ic7921b781aa773ae23b60a0bb6fa2111b1fc401e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3679479 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 9f4b9c65 2022-05-18T14:39:18 Vulkan: Refactor command buffer retain calls. This removes "getResourceUseList" from the command buffers, and instead we pass around the command buffer helpers. Since future CLs will change the way we track resources, this provides for a more stable interface for tracking. Bug: angleproject:5664 Change-Id: I7118788570eaa3c0ddb6d5ef523e050ad7be00ad Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3645814 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 98c2e169 2022-05-20T16:17:49 Vulkan: Reduce pre-rotation spec const to bool The specialization constant now only dictates whether x and y should be swapped. The complete 8 possible states of rotation and y-flip are achieved by using this swap in combination with a driver uniform for x and y flip. Swapping is still a specialization constant to avoid degrading performance of dFdx/dFdy which otherwise would need both to be evaluated instead of one. On platforms which don't support pre-rotation, the specialization constant will never change and driver uniforms entirely govern y-flip. On platforms that do support pre-rotation, only two variations of the pipeline are needed. Bug: angleproject:7366 Change-Id: I73f84e89fa9349d2098fa5b21573aee57d93a30c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3663151 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi fea19567 2022-05-17T17:44:06 Vulkan: Remove removeEarlyFragmentTestsOpt flag * Removed removeEarlyFragmentTestsOptimization and the related SPIRV transformation and variables. * Removed mUsesEarlyFragmentTestsOptimization. * Removed SH_EARLY_FRAGMENT_TESTS_OPTIMIZATION. * Merged updateUsesEarlyFragmentTestsOptimization() into updateFragmentInoutRange(). Bug: angleproject:7347 Change-Id: I7299bd4e8ab5363e5cf06eb48419d4f469106e12 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3648217 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill 21ad9b3c 2022-04-07T09:57:26 Vulkan: Add generic descriptors for DS cache. With the new design, the descriptor set cache keys include all identifying information needed to reconstruct the update descriptor sets calls except the specific resource handles. The places for the resource handles are held by serials intead. When we miss the cache, we no longer need a second step to then construct the update calls, and can build the update calls directly from the key structures in combination with a list of resource handles. Bug: angleproject:6776 Change-Id: If1660a557585a75e9aa2560d6a38c56b62f555c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3484981 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d8d396db 2022-04-07T09:57:25 Vulkan: Add shared descriptor set caches. This allows programs with the same sets of descriptors to share descriptor sets. Currently there is no cache eviction. This CL adds a new "Meta" class to manage the descriptor set caches. Each shared descriptor pool is unique to a descriptor set layout. The descriptor set cache is moved into the pool class. Now every instance of a descriptor pool in ANGLE has easy access to a descriptor set cache as well. Bug: angleproject:6776 Change-Id: I06982e0349f5a87e4578e769fa356ce8e7ab49f0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3424660 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill ff8a9f6a 2022-04-14T15:15:16 Vulkan: Renaming "ShaderBuffers" to "ShaderResources". This will match the functionality as we expand the descriptor set cache to non-buffer resources. Bug: angleproject:6776 Change-Id: I5597d074beea7d3b464802a2db9bcc2fcf84ca6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3583359 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill b2a1f0d2 2022-04-14T07:58:32 Track total vs per-frame descriptor set counters. This will give more consistent measurements for descriptor set caches and descriptor set allocations. Bug: angleproject:6776 Change-Id: I584b8807ad19f8393ae54cc1d88b319c8f7f9f39 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3584636 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 55c21842 2022-04-14T05:04:15 Vulkan: Use flat array lookups for shader variables. The array lookups we use after link now are simple array lookups and no longer use string hashing queries. This will make the descriptor cache indexing much faster after the cache key redesign. Bug: angleproject:4524 Change-Id: If19e3a4aa57c415f33c69172dd76c10a207e3264 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3580979 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill bddb944b 2022-04-14T05:04:09 Vulkan: Prep variable info map to remove hashing. The removes all the string-based query APIs from the program executable descriptor set init. The new APIs still use string-keyed maps but will be switched out with non-hashed maps in a future CL. Bug: angleproject:4524 Change-Id: I427efb3ebcf22d5fbdf6d20679bbdaa23cd2dc94 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3573077 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 4b381f41 2022-04-08T09:20:45 Vulkan: Fix descriptorSet perf counter values. Some counters were getting reset in multiple places, which could result in queries returning zero counts. Fix this by consolidating per-frame counter resets. Also updates how we compute cache hit/miss counters. This results in correct and consistent counts for cache accesses. Also includes a fix to not update the overlay when there are no enabled widgets. Also does away with some of the object- specific perf counters that were made to track descriptor set allocations. Bug: angleproject:6776 Change-Id: I769c715986defc50f0cfd0d997c338d34174e9f0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3573389 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e8ee847d 2022-02-23T12:25:39 Vulkan: Add UpdateDescriptorSetsBuilder. This helper class encapsulates the vkUpdateDescriptorSets caching. As part of the refactor, we switch passing a ContextVk to passing a vk::Context with some mutable variables. This helps encapsulate ContextVk. Since we use the perf counters in many places, this CL moves the perf counters to vk::Context, so we can access them everywhere. Refactoring change only. Bug: angleproject:6776 Change-Id: Id529962b2f425bece6f9b3bd0cd1698c692e58cb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3484980 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mohan Maiya f9ade9fb 2022-02-18T15:08:54 Vulkan: Add feature to create pipeline during glLinkProgram Creating the pipeline will trigger the compilation of shaders to byte code thus warming up Vulkan shader caches. Typically most apps call into glLinkPrograms during app loadtime and the goal is to improve cache hit rate and reduce CPU workload during game play. Bug: angleproject:7046 Test: ProgramBinary*CreatePipelineDuringLink* Change-Id: I71351d45a9aa84e220ca38503735e94cff1dcf98 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3478354 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Jamie Madill ef17f38a 2022-03-01T10:15:26 Vulkan: Add overlay widget for cache key size. Bug: angleproject:6776 Change-Id: I35ab18bc5919129b2decf58d541499f771140e47 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3472754 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill ee96a461 2022-02-22T12:23:06 Vulkan: Fix missing empty buffer descriptor. This could happen for SSBOs and UBOs when the shader renders without a bound buffer, and robustness enabled. Bug: angleproject:6707 Change-Id: I993f2489aca47f07068908858c83afa78c9e0402 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3484979 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Auto-Submit: Jamie Madill <jmadill@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Roman Lavrov <romanl@google.com>