/
Pipeline Cache Object Pipeline Cache Object

Pipeline Cache Object - PDF document

nicole
nicole . @nicole
Follow
359 views
Uploaded On 2021-06-07

Pipeline Cache Object - PPT Presentation

2016 Seoul DevU Bill Licea Kane Engineer Senior Staff Qualcomm Technologies Inc 2016 10 21 Our application requires many many many Pipeline State Objects Creation time is a huge issue ID: 837465

cache pipeline device create pipeline cache create device state pipelinecache const info result qualcomm pipelinecachecreateinfo graphicspipelinecreateinfo vkpipelinecache creating objects

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "Pipeline Cache Object" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

1 2016 Seoul DevU Pipeline Cache Object B
2016 Seoul DevU Pipeline Cache Object Bill Licea - Kane Engineer, Senior Staff Qualcomm Technologies, Inc. 2016 - 10 - 21 “ Our application requires many many many Pipeline State Objects. Creation time is a huge issue!” 3 Epic Games ProtoStar Create Pipeline State Objects Create Time Percentage Compile 42% Link 56% Other 2% Pipeline State Objects Create Time Percentage 4 Compile and Link

2 Redundancy Epic Games ProtoStar Unique
Redundancy Epic Games ProtoStar Unique 38% Redundant 62% Compile Unique 54% Redundant 46% Link 5 Compile and Link Redundancy Epic Games ProtoStar Unique 38% Redundant 62% Compile Unique 54% Redundant 46% Link 6 Possible Solutions? • Reduce number of Pipeline State Objects “ We can’t do much of that. Maybe if there was more dynamic state? Maybe if pipeline stages didn’t have to be

3 linked together?” 8 Possible Solution
linked together?” 8 Possible Solutions? • Group together similar Pipeline State Objects “ That helps some. But we have many many many different shaders , so it is hard to group similar pipeline state objects together.” 10 Possible Solutions? • Cache prior Pipeline State Objects “ That might work. Tell me more.” 12 Pipeline Cache 1 Creating a Pipeline State Object without a P

4 ipeline Cache 3 Storing and Loading a
ipeline Cache 3 Storing and Loading a Pipeline Cache 2 Creating a Pipeline State Object WITH a Pipeline Cache 13 Pipeline Cache 1 Creating a Pipeline State Object without a Pipeline Cache 3 Storing and Loading a Pipeline Cache 2 Creating a Pipeline State Object WITH a Pipeline Cache 14 W ithout Pipeline Cache Creating a Graphics Pipeline VkResult result ; VkGraphicsPipelineCreateInf

5 o graphicsPipelineCreateInfo = {}; graph
o graphicsPipelineCreateInfo = {}; graphicsPipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO ; // (set up any additional create info ...) VkPipeline pipeline ; result = vkCreateGraphicsPipelines ( device , // VkDevice device VK_NULL_HANDLE , // VkPipelineCache pipelineCache 1, // uint32_t

6 createInfoCount & g
createInfoCount & graphicsPipelineCreateInfo , // const VkGraphicsPipelineCreateInfo * pCreateInfos nullptr , // const VkAllocationCallbacks * pAllocator & pipeline ); // VkPipeline * pPipelines 15 W ithout Pipeline Cache Creating a Graphics Pipeline VkResult result ; VkGraphicsPipelineCreat

7 eInfo graphicsPipelineCreateInfo = {}; g
eInfo graphicsPipelineCreateInfo = {}; graphicsPipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO ; // (set up any additional create info...) VkPipeline pipeline ; result = vkCreateGraphicsPipelines ( device , // VkDevice device VK_NULL_HANDLE , // VkPipelineCache pipelineCache 1, // uint32_t

8 createInfoCount & g
createInfoCount & graphicsPipelineCreateInfo , // const VkGraphicsPipelineCreateInfo * pCreateInfos nullptr , // const VkAllocationCallbacks * pAllocator & pipeline ); // VkPipeline * pPipelines 16 Epic Games ProtoStar Pipeline State Objects Create Time Percentage 0% 10% 20% 30% 40% 50% 60%

9 70% 80% 90% 100% Without Cache Pipeline
70% 80% 90% 100% Without Cache Pipeline State Objects Create Time Percentage (normalized to “Without Cache”) Compile Link Driver Overhead Cache Overhead 17 Pipeline Cache 1 Creating a Pipeline State Object without a Pipeline Cache 3 Storing and Loading a Pipeline Cache 2 Creating a Pipeline State Object WITH a Pipeline Cache 18 Creating a Pipeline Cache VkResult result ; static VkPip

10 elineCache pipelineCache ; VkPipelineCac
elineCache pipelineCache ; VkPipelineCacheCreateInfo pipelineCacheCreateInfo = {}; pipelineCacheCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO ; // (set up any additional create info ...) result = vkCreatePipelineCache ( device , // VkDevice device, & pipelineCacheCreateInfo , // const VkPipelineCacheCreateInfo * pCreateInfo , nu

11 llptr , //
llptr , // const VkAllocationCallbacks * pAllocator , & pipelineCache ); // VkPipelineCache * pPipelineCache ); // continued... 19 Creating a Pipeline Cache VkResult result ; static VkPipelineCache pipelineCache ; VkPipelineCacheCreateInfo pipelineCacheCreateInfo = {}; pipelineCacheCreateInfo.sType = VK_STRUCTURE_TYPE

12 _PIPELINE_CACHE_CREATE_INFO ; // (set up
_PIPELINE_CACHE_CREATE_INFO ; // (set up any additional create info ...) result = vkCreatePipelineCache ( device , // VkDevice device, & pipelineCacheCreateInfo , // const VkPipelineCacheCreateInfo * pCreateInfo , nullptr , // const VkAllocationCallbacks * pAllocator , & pipelineCache ); /

13 / VkPipelineCache *
/ VkPipelineCache * pPipelineCache ); // continued... 20 WITH Pipeline Cache Creating a Graphics Pipeline // ...continued VkGraphicsPipelineCreateInfo graphicsPipelineCreateInfo = {}; graphicsPipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO ; // (set up any additional create info ...) VkPipeline pipeline ; result = vkCreateGraphicsPipelines ( device

14 , // VkDevice
, // VkDevice device pipelineCache , // VkPipelineCache pipelineCache 1, // uint32_t createInfoCount & graphicsPipelineCreateInfo , // const VkGraphicsPipelineCreateInfo * pCreateInfos nullptr , // const VkAllocationCallbacks * pAllocator & pipeline );

15 // VkPipeline *
// VkPipeline * pPipelines 21 WITH Pipeline Cache Creating a Graphics Pipeline // ... continued VkGraphicsPipelineCreateInfo graphicsPipelineCreateInfo = {}; graphicsPipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO ; // (set up any additional create info ...) VkPipeline pipeline ; result = vkCreateGraphicsPipelines ( device ,

16 // VkDevice dev
// VkDevice device pipelineCache , // VkPipelineCache pipelineCache 1, // uint32_t createInfoCount & graphicsPipelineCreateInfo , // const VkGraphicsPipelineCreateInfo * pCreateInfos nullptr , // const VkAllocationCallbacks * pAllocator & pipeline );

17 // VkPipeline *
// VkPipeline * pPipelines 22 WITH Pipeline Cache Creating a Graphics Pipeline // ...continued VkGraphicsPipelineCreateInfo graphicsPipelineCreateInfo = {}; graphicsPipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO ; // (set up any additional create info ...) VkPipeline pipeline ; result = vkCreateGraphicsPipelines ( device ,

18 // VkDevice device
// VkDevice device pipelineCache , // VkPipelineCache pipelineCache 1, // uint32_t createInfoCount & graphicsPipelineCreateInfo , // const VkGraphicsPipelineCreateInfo * pCreateInfos nullptr , // const VkAllocationCallbacks * pAllocator & pipeline );

19 // VkPipeline *
// VkPipeline * pPipelines 23 Epic Games ProtoStar Pipeline State Objects Create Time Percentage 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% Without Cache With Cache Pipeline State Objects Create Time Percentage (normalized to “Without Cache”) Compile Link Driver Overhead Cache Overhead 24 Pipeline Cache 1 Creating a Pipeline State Object without a Pipe

20 line Cache 3 Storing and Loading a Pip
line Cache 3 Storing and Loading a Pipeline Cache 2 Creating a Pipeline State Object WITH a Pipeline Cache 25 Get Pipeline Cache Data VkResult result ; size_t pipelineCacheSize ; unsigned char pipelineCacheData [ MAX_PIPELINE_CACHE_STORE ]; result = vkGetPipelineCacheData ( device , // VkDevice device pipelineCache , // VkPipelineCache p

21 ipelineCache & pipelineCacheSize ,
ipelineCache & pipelineCacheSize , // size_t * pDataSize nullptr ); // void* pData pipelineCacheSize = min ( pipelineCacheSize , MAX_PIPELINE_CACHE_STORE ); result = vkGetPipelineCacheData ( device , // VkDevice device pipelineCache , // VkP

22 ipelineCache pipelineCache & pipelineCac
ipelineCache pipelineCache & pipelineCacheSize , // size_t * pDataSize & pipelineCacheData [0]); // void* pData int storeResult = storeToStorage ( pipelinecacheSize , & pipelineCacheData [0]); 26 WITH initial data Create Pipeline Cache VkResult result ; static VkPipelineCache pipelineCache ; VkPipeline

23 CacheCreateInfo pipelineCacheCreateInfo
CacheCreateInfo pipelineCacheCreateInfo = {}; size_t pipelineCacheSize ; unsigned char pipelineCacheData [ MAX_PIPELINE_CACHE_STORE ]; int loadResult = loadFromStorage ( MAX_PIPELINE_CACHE_STORE , & pipelineCacheSize , & pipelineCacheData [0]); pipelineCacheCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO ; // (set up any additional create info ...) pipelineCacheCreateInfo.initialD

24 ataSize = pipelineCacheSize ; pipelineC
ataSize = pipelineCacheSize ; pipelineCacheCreateInfo.pInitialData = & pipelineCacheData [0]; result = vkCreatePipelineCache ( device , // VkDevice device, & pipelineCacheCreateInfo , // const VkPipelineCacheCreateInfo * pCreateInfo , nullptr , // const VkAllocationCallbacks * pAllocator , & pipelineCache );

25 // VkPipelineCache
// VkPipelineCache * pPipelineCache ); 27 WITH initial data Create Pipeline Cache VkResult result ; static VkPipelineCache pipelineCache ; VkPipelineCacheCreateInfo pipelineCacheCreateInfo = {}; size_t pipelineCacheSize ; unsigned char pipelineCacheData [ MAX_PIPELINE_CACHE_STORE ]; int loadResult = l oadFromStorage ( MAX_PIPELINE_CACHE_STORE , & pipelineCa

26 cheSize , & pipelineCacheData [0 ]); pip
cheSize , & pipelineCacheData [0 ]); pipelineCacheCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO ; // (set up any additional create info...) pipelineCacheCreateInfo.initialDataSize = pipelineCacheSize ; pipelineCacheCreateInfo.pInitialData = & pipelineCacheData [0]; result = vkCreatePipelineCache ( device , // VkDevice device, & pipelineCacheCreat

27 eInfo , // const VkPipelin
eInfo , // const VkPipelineCacheCreateInfo * pCreateInfo , nullptr , // const VkAllocationCallbacks * pAllocator , & pipelineCache ); // VkPipelineCache * pPipelineCache ); 28 Epic Games ProtoStar Pipeline State Objects Create Time 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% Without Cache With Cache

28 With Initialized Cache Pipeline State Ob
With Initialized Cache Pipeline State Objects Create Time Percentage (normalized to “Without Cache”) Compile Link Driver Overhead Cache Overhead Pipeline Cache Object is internally synchronized Applications MAY access a pipeline cache from multiple threads without external synchronization BUT - Host access to Pipeline Cache object MUST be externally synchronized 30 Pipeline Cache Header Off

29 set Size Description 0 4 length in bytes
set Size Description 0 4 length in bytes of the entire pipeline cache header written as a stream of bytes, with the least significant byte first 4 4 a VkPipelineCacheHeaderVersion value written as a stream of bytes, with the least significant byte first 8 4 a vendor ID equal to VkPhysicalDeviceProperties :: vendorID written as a stream of bytes, with the least significant byte first 12 4 a devic

30 e ID equal to VkPhysicalDevicePropertie
e ID equal to VkPhysicalDeviceProperties :: deviceID written as a stream of bytes, with the least significant byte first 16 VK_UUID_SIZE a pipeline cache ID equal to VkPhysicalDeviceProperties :: pipelineCacheUUID 31 Summary • Using a pipeline cache is easy • Using a pipeline cache reduces redundant compiles and links • Saving and loading a pipeline cache may reduce compile and link to first

31 application use ◦ Local storage on de
application use ◦ Local storage on device required ◦ Cache may be invalidated by OS updates and/or Driver updates • Storing a cache in the cloud is an option • Wi - Fi or Cellular Data required Qualcomm ® Snapdragon ™ SDK for Android A product of Qualcomm Technologies, Inc. www.qualcomm.com/software/snapdragon - sdk - android Acknowledgements Dan Archard Engineer, Principal ACG Qualcomm

32 Technologies, Inc. Epic Games Vulkan Wor
Technologies, Inc. Epic Games Vulkan Working Group Follow us on: For more information, visit us at: www.qualcomm.com & www.qualcomm.com/blog Nothing in these materials is an offer to sell any of the components or devices referenced herein. ©2016 Qualcomm Technologies, Inc. and/or its affiliated companies. All Rights Reserved. Qualcomm and Snapdragon are trademarks of Qualcomm Incorporated, regis

33 tered in the United States and other cou
tered in the United States and other countries. Other products and brand names may be trademarks or registered trademarks of their respective owners. References in this presentation to “Qualcomm” may mean Qualcomm Incorporated, Qualcomm Technologies, Inc., and/or other subsi dia ries or business units within the Qualcomm corporate structure, as applicable. Qualcomm Incorporated includes Qualcom

34 m’s licensing business, QTL, and the
m’s licensing business, QTL, and the vast majority of its patent portfolio. Qualcomm Technologies, Inc., a wholly - owned subsidiary of Qualcomm Incorpora ted, operates, along with its subsidiaries, substantially all of Qualcomm’s engineering, research and development functions, and s ubs tantially all of its product and services businesses, including its semiconductor business, QCT. Thank you