aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_pipeline_cache.c
Commit message (Collapse)AuthorAgeFilesLines
* anv: fix uninitialized variable accessLionel Landwerlin2020-07-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Found with valgrind : ==415016== Conditional jump or move depends on uninitialised value(s) ==415016== at 0x513C22B: anv_cache_lock (anv_pipeline_cache.c:346) ==415016== by 0x513C2A0: anv_pipeline_cache_search (anv_pipeline_cache.c:364) ==415016== by 0x50E7C88: lookup_blorp_shader (anv_blorp.c:38) ==415016== by 0x5D20A98: blorp_params_get_clear_kernel (blorp_clear.c:60) ==415016== by 0x5D23EFD: blorp_ccs_ambiguate (blorp_clear.c:1358) ==415016== by 0x50EDE25: anv_image_ccs_op (anv_blorp.c:1882) ==415016== by 0x555D92F: transition_color_buffer (genX_cmd_buffer.c:1179) ==415016== by 0x5598B71: cmd_buffer_begin_subpass (genX_cmd_buffer.c:5060) ==415016== by 0x559AB00: gen9_CmdBeginRenderPass (genX_cmd_buffer.c:5772) ==415016== by 0x11DACE: begin_render_pass (vr-test.c:375) ==415016== by 0x11DF55: set_state (vr-test.c:529) ==415016== by 0x11F7A1: clear (vr-test.c:1228) v2: Don't break external sync feature Signed-off-by: Lionel Landwerlin <[email protected]> Acked-by: Jason Ekstrand <[email protected]> Reviewed-by: Ivan Briano <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5823>
* anv: support externally synchronized pipeline cachesIván Briano2020-06-171-13/+30
| | | | | | | | Implement the VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT_EXT bits of the VK_EXT_pipeline_creation_cache_control extension. Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5136>
* vulkan,anv: Add a base object struct typeJason Ekstrand2020-05-041-0/+4
| | | | | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Acked-by: Kristian H. Kristensen <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4690>
* vulkan,anv: Add a common base object type for VkDeviceJason Ekstrand2020-05-041-4/+4
| | | | | | | | | | | | We should keep this very minimal; I don't know that we need to go all struct gl_context on it. However, this gives us at least a tiny base on which we can start building some common functionality. Reviewed-by: Lionel Landwerlin <[email protected]> Acked-by: Kristian H. Kristensen <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4690>
* anv: Keep the shader stage in anv_shader_binCaio Marcelo de Oliveira Filho2020-03-121-6/+18
| | | | | | | | | This will be used to decouple the logic flush_descriptor_sets() from the position in the shader array, allowing us to store just the shaders needed for each pipeline. Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4040>
* anv: stop storing prog param data into shader blobsLionel Landwerlin2020-03-071-13/+4
| | | | | | | | | We have no use for this data in Anv. Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Jason EKstrand <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3517> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3517>
* anv: Drop separate chipset_id fieldsJason Ekstrand2020-01-201-2/+2
| | | | | | | | This already exists in gen_device_info. There's no reason to keep duplicate copies. Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3461>
* anv: Drop the instance pointer from anv_deviceJason Ekstrand2020-01-201-2/+2
| | | | | | | | | There are very few times when we actually want to fetch the instance from the anv_device. We can put up with a bit of pain there in exchange for strongly discouraging people from doing this in general. Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3461>
* anv: Add an anv_physical_device field to anv_deviceJason Ekstrand2020-01-201-5/+4
| | | | | | | | | | | | Having to always pull the physical device from the instance has been annoying for almost as long as the driver has existed. It also won't work in a world where we ever have more than one physical device. This commit adds a new field called "physical" to anv_device and switches every location where we use device->instance->physicalDevice to use the new field instead. Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3461>
* anv: More carefully dirty state in BindPipelineJason Ekstrand2019-11-181-0/+9
| | | | | | | | | | | | | | | Instead of blindly dirtying descriptors and push constants the moment we see a pipeline change, check to see if it actually changes the bind layout or push constant layout. This doubles the runtime performance of one CPU-limited example running with the Dawn WebGPU implementation when running on my laptop. NOTE: This effectively reverts beca63c6c07. While it was a nice optimization, it was based on prog_data and we can't do that anymore once we start allowing the same binding table to be used with multiple different pipelines. Reviewed-by: Lionel Landwerlin <[email protected]>
* anv: Pre-compute push ranges for graphics pipelinesJason Ekstrand2019-11-181-0/+3
| | | | | | | | | It turns off that emitting push constants is one of the hottest paths in the driver and ANY work we do there costs us. By pre-computing things a bit ahead of time, we shave 5% off the runtime of a CPU-limited example running with the Dawn WebGPU implementation. Reviewed-by: Lionel Landwerlin <[email protected]>
* nir: add a strip parameter to nir_serializeMarek Olšák2019-10-101-1/+1
| | | | | | | so that drivers don't have to call nir_strip manually. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* Move blob from compiler/ to util/Jason Ekstrand2019-09-191-1/+1
| | | | | | | | There's nothing whatsoever compiler-specific about it other than that's currently where it's used. Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* anv: Record shader compile stats in the pipeline cacheJason Ekstrand2019-08-121-2/+25
| | | | | | We're going to want these to be available regardless of caching. Reviewed-by: Lionel Landwerlin <[email protected]>
* anv: Put image params in the descriptor set buffer on gen8 and earlierJason Ekstrand2019-04-191-2/+0
| | | | | | | | | | | | This is really where they belong; not push constants. The one downside here is that we can't push them anymore for compute shaders. However, that's a general problem and we should figure out how to push descriptor sets for compute shaders. This lets us bump MAX_IMAGES to 64 on BDW and earlier platforms because we no longer have to worry about push constant overhead limits. Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* anv: don't use default pipeline cache for hits for ↵Lionel Landwerlin2019-04-101-1/+1
| | | | | | | | | | | | | VK_EXT_pipeline_creation_feedback If the user didn't provide a pipeline cache and we're using the default internal pipeline cache, then we shouldn't consider a cache hit for VK_EXT_pipeline_creation_feedback as the application did not provide a cache. Signed-off-by: Lionel Landwerlin <[email protected]> Fixes: 6601e5d6fc68cd ("anv: implement VK_EXT_pipeline_creation_feedback") Reviewed-by: Jason Ekstrand <[email protected]>
* anv: implement VK_EXT_pipeline_creation_feedbackLionel Landwerlin2019-03-201-2/+7
| | | | | | | | | | | | | | | | | | An extension reporting cache hit in the user supplied pipeline cache as well as timing information for creating the pipelines & stages. v2: Don't consider no cache for cache hits (Jason) Rework duration accumulation (Jason) v3: Fold feedback creation writing into pipeline compile functions (Jason/Lionel) v4: Get cache hit information from anv_device_search_for_kernel() (Jason) Only set cache hit from the whole pipeline if all stages also have that bit (Lionel) v5: Always user_cache_hit in anv_device_search_for_kernel() (Jason) Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* anv: call blob_finish when done with itTapani Pälli2019-03-071-0/+3
| | | | | | | | | | | | | | | | | Fixes leaks from anv_device_upload_nir: ==7345== 8,192 bytes in 2 blocks are definitely lost in loss record 24 of 24 ==7345== at 0x4C2ED78: malloc (vg_replace_malloc.c:308) ==7345== by 0x4C31393: realloc (vg_replace_malloc.c:836) ==7345== by 0x54E0848: grow_to_fit (blob.c:67) ==7345== by 0x54E0BE5: blob_reserve_bytes (blob.c:166) ==7345== by 0x54E0C7C: blob_reserve_intptr (blob.c:186) ==7345== by 0x54704A7: nir_serialize (nir_serialize.c:1091) ==7345== by 0x512F97D: anv_device_upload_nir (anv_pipeline_cache.c:756) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* anv: Count image param entries rather than imagesJason Ekstrand2019-03-051-2/+2
| | | | | | | | | This is what we're actually storing in the descriptor set and consuming when we bind surface states. This commit renames image_count to image_param_count a few places and moves the decision to not count image params on gen9+ into anv_descriptor_set.c when we build the layout. Reviewed-by: Lionel Landwerlin <[email protected]>
* anv: use anv_shader_bin_write_to_blob()'s return valueEric Engestrom2019-02-201-3/+1
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* anv: anv: refactor error handling in anv_shader_bin_write_to_blob()Tapani Pälli2019-02-201-28/+26
| | | | | | | | | | v2: blob manages error state internally, just return true if errors did not occur (Jason) CID: 1442546 Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* anv: Add pipeline cache support for xfb_infoJason Ekstrand2019-01-221-6/+42
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* anv/pipeline_cache: free NIR shader cacheIago Toral Quiroga2019-01-141-0/+7
| | | | | Fixes: f6aa9f718516 'anv/pipeline_cache: Add support for caching NIR' Reviewed-by: Lionel Landwerlin <[email protected]>
* anv/pipeline_cache: fix incorrect guards for NIR cacheIago Toral Quiroga2019-01-111-2/+3
| | | | | Fixes: f6aa9f718516 'anv/pipeline_cache: Add support for caching NIR' Reviewed-by: Lionel Landwerlin <[email protected]>
* anv/pipeline_cache: Add support for caching NIRJason Ekstrand2019-01-101-0/+100
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* util: use C99 declaration in the for-loop hash_table_foreach() macroEric Engestrom2018-10-251-3/+0
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* anv/pipeline: honor the pipeline_cache_enabled run-time flagIago Toral Quiroga2018-07-091-1/+1
| | | | | | v2: merge both conditions to reduce the diff (Lionel) Reviewed-by: Lionel Landwerlin <[email protected]>
* anv: Add support for the on-disk shader cacheJason Ekstrand2018-07-021-11/+87
| | | | | | | | | | | The Vulkan API provides a mechanism for applications to cache their own shaders and manage on-disk pipeline caching themselves. Generally, this is what I would recommend to application developers and I've resisted implementing driver-side transparent caching in the Vulkan driver for a long time. However, not all applications do this and, for some use-cases, it's just not practical. Reviewed-by: Timothy Arceri <[email protected]>
* anv/pipeline_cache: Add a _locked suffix to a functionJason Ekstrand2018-07-021-14/+15
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* anv: Add device-level helpers for searching for and uploading kernelsJason Ekstrand2018-07-021-0/+34
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* anv: Use a default pipeline cache if none is specifiedJason Ekstrand2018-07-021-10/+2
| | | | | | | | If a client is dumb enough to not specify a pipeline cache, give it a default. We have to create one anyway for blorp so we may as well let the client cache shaders in it. Reviewed-by: Timothy Arceri <[email protected]>
* anv: Add support for shader constant data to the pipeline cacheJason Ekstrand2018-07-021-0/+27
| | | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* blob: Use intptr_t instead of ssize_tJason Ekstrand2017-10-131-1/+1
| | | | | | | | | | | ssize_t is a GNU extension and is not available on Windows or MacOS. Instead, we use intptr_t which should be effectively equivalent and is part of the C standard. This should fix the Windows and Mac OS builds. Fixes: 3af1c829891a4530682bce113fdd512d4f2de3c6 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103253 Reviewed-by: Jose Fonseca <[email protected]> Tested-by: Vinson Lee <[email protected]>
* i965: Store image_param in brw_context instead of prog_dataJason Ekstrand2017-10-121-4/+2
| | | | | | | | | | This burns an extra 10k of memory or so in the case where you don't have any images. However, if you have several shaders which use images, this should be much less memory. It also gets rid of a part of prog_data that really has nothing to do with the compiler. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* anv/pipeline_cache: Rework to use multialloc and blobJason Ekstrand2017-10-121-157/+141
| | | | | | | | | This gets rid of all of our hand-rolled size calculation and serialization code and replaces it with safe "standards" that are used elsewhere in anv and mesa. This should be significantly safer than rolling our own. Reviewed-by: Jordan Justen <[email protected]>
* anv: Move shader hashing to anv_pipelineJason Ekstrand2017-05-031-27/+0
| | | | | | | | | | Shader hashing is very closely related to shader compilation. Putting them right next to each other in anv_pipeline makes it easier to verify that we're actually hashing everything we need to be hashing. The only real change (other than the order of hashing) is that we now hash in the shader stage. Reviewed-by: Iago Toral Quiroga <[email protected]>
* anv/physical_device: Rename uuid to pipeline_cache_uuidJason Ekstrand2017-04-271-2/+2
| | | | | | | We're about to have more UUIDs for different things so this one really needs to be properly labeled. Reviewed-by: Chad Versace <[email protected]>
* anv: do not try to ref/unref NULL shadersIago Toral Quiroga2017-03-161-1/+4
| | | | | | | | | | | | | | | This situation can happen if we failed to allocate memory for the shader. v2: - We shouldn't see NULL shaders in anv_shader_bin_ref so we should not check for that (Jason). Make sure that callers don't attempt to call this function with a NULL shader and assert that this never happens (Iago). v3: - All callers to anv_shader_bin_unref seem to check for NULL before calling, so just assert that it is not NULL (Topi) Reviewed-by: Topi Pohjolainen <[email protected]>
* util/sha1: rework _mesa_sha1_{init,final}Emil Velikov2017-03-151-9/+9
| | | | | | | | | | | | Rather than having an extra memory allocation [that we currently do not and act accordingly] just make the API take an pointer to a stack allocated instance. This and follow-up steps will effectively make the _mesa_sha1_foo simple define/inlines around their SHA1 counterparts. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Grazvydas Ignotas <[email protected]>
* anv: Store UUID in physical device.Emil Velikov2016-11-281-4/+4
| | | | | | | | | Port of an equivalent commit for radv. v2: Move the call just after MMAP_VERSION (Ken). Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* anv: Handle null in all destructorsJason Ekstrand2016-11-161-0/+3
| | | | | | | | | | This fixes a bunch of new CTS tests which look for exactly this. Even in the cases where we just call vk_free to free a CPU data structure, we still handle NULL explicitly. This way we're less likely to forget to handle NULL later should we actually do something less trivial. Cc: "13.0" <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* anv/pipeline: Properly cache prog_data::paramJason Ekstrand2016-11-021-11/+32
| | | | | | | | | | | Before we were caching the prog data but we weren't doing anything with brw_stage_prog_data::param so anything with push constants wasn't getting cached properly. This commit fixes that. Signed-off-by: Jason Ekstrand <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98012 Reviewed-by: Timothy Arceri <[email protected]> Cc: "13.0" <[email protected]>
* anv/pipeline: Put actual pointers in anv_shader_binJason Ekstrand2016-11-021-26/+16
| | | | | | | | | | | | | | | While we can simply calculate offsets to get to things such as the prog_data and the key, it's much more user-friendly if there are just pointers. Also, it's a bit more fool-proof. While we're at it, we rework the pipeline cache API to use the brw_stage_prog_data type directly. Signed-off-by: Jason Ekstrand <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98012 Reviewed-by: Topi Pohjolainen <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Cc: "13.0" <[email protected]>
* anv: move to using vk_alloc helpers.Dave Airlie2016-10-191-4/+4
| | | | | | | This moves all the alloc/free in anv to the generic helpers. Acked-by: Jason Ekstrand <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* anv: pipeline cache: fix return value of vkGetPipelineCacheDataLionel Landwerlin2016-10-071-2/+5
| | | | | | | | | | | | | | | | | According to the spec - 9.6. Pipeline Cache : If pDataSize is less than the maximum size that can be retrieved by the pipeline cache, at most pDataSize bytes will be written to pData, and vkGetPipelineCacheData will return VK_INCOMPLETE. Fixes the following test from Vulkan CTS : dEQP-VK.pipeline.cache.pipeline_from_incomplete_get_data.vertex_stage_fragment_stage dEQP-VK.pipeline.cache.pipeline_from_incomplete_get_data.vertex_stage_geometry_stage_fragment_stage dEQP-VK.pipeline.cache.misc_tests.invalid_size_test Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* anv: Rework pipeline cachingJason Ekstrand2016-08-301-312/+192
| | | | | | | | | | | | | | | | | | | The original pipeline cache the Kristian wrote was based on a now-false premise that the shaders can be stored in the pipeline cache. The Vulkan 1.0 spec explicitly states that the pipeline cache object is transiant and you are allowed to delete it after using it to create a pipeline with no ill effects. As nice as Kristian's design was, it doesn't jive with the expectation provided by the Vulkan spec. The new pipeline cache uses reference-counted anv_shader_bin objects that are backed by a large state pool. The cache itself is just a hash table mapping keys hashes to anv_shader_bin objects. This has the added advantage of removing one more hand-rolled hash table from mesa. Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97476 Acked-by: Kristian Høgsberg Kristensen <[email protected]>
* anv: Add a struct for storing a compiled shaderJason Ekstrand2016-08-301-0/+110
| | | | | | | | | | | | | | | | This new anv_shader_bin struct stores the compiled kernel (as an anv_state) as well as all of the metadata that is generated at shader compile time. The struct is very similar to the old cache_entry struct except that it is reference counted and stores the actual pipeline_bind_map. Similarly to cache_entry, much of the actual data is floating-size and stored after the main struct. Unlike cache_entry, which was storred in GPU-accessable memory, the storage for anv_shader_bin kernels comes from a state pool. The struct itself is reference-counted so that it can be used by multiple pipelines at a time without fear of allocation issues. Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]> Acked-by: Kristian Høgsberg Kristensen <[email protected]>
* anv: Include the pipeline layout in the shader hashJason Ekstrand2016-08-241-0/+5
| | | | | | | | | | | | The pipeline layout affects shader compilation because it is what determines binding table locations as well as whether or not a particular buffer has dynamic offsets. Since this affects the generated shader, it needs to be in the hash. This fixes a bunch of CTS tests now that the CTS is using a pipeline cache. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Cc: "12.0" <[email protected]>
* anv/pipeline_cache: Allow for an zero-sized cacheJason Ekstrand2016-06-101-1/+4
| | | | | | | This gets ANV_ENABLE_PIPELINE_CACHE=false working again. Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]>
* anv/pipeline: Add support for caching the push constant mapJason Ekstrand2016-06-061-4/+29
| | | | | Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>