mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
anv: Add support for compiling OpenCL-style kernels
v2: remove unused definitions Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Acked-by: Caio Oliveira <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16970>
This commit is contained in:
parent
6ad1a5b57a
commit
eb249f125d
2 changed files with 35 additions and 2 deletions
|
|
@ -91,7 +91,9 @@ anv_shader_bin_create(struct anv_device *device,
|
|||
VK_MULTIALLOC_DECL(&ma, struct anv_pipeline_binding, surface_to_descriptor,
|
||||
bind_map->surface_count);
|
||||
VK_MULTIALLOC_DECL(&ma, struct anv_pipeline_binding, sampler_to_descriptor,
|
||||
bind_map->sampler_count);
|
||||
bind_map->sampler_count);
|
||||
VK_MULTIALLOC_DECL(&ma, struct brw_kernel_arg_desc, kernel_args,
|
||||
bind_map->kernel_arg_count);
|
||||
|
||||
if (!vk_multialloc_alloc(&ma, &device->vk.alloc,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE))
|
||||
|
|
@ -176,6 +178,9 @@ anv_shader_bin_create(struct anv_device *device,
|
|||
typed_memcpy(sampler_to_descriptor, bind_map->sampler_to_descriptor,
|
||||
bind_map->sampler_count);
|
||||
shader->bind_map.sampler_to_descriptor = sampler_to_descriptor;
|
||||
typed_memcpy(kernel_args, bind_map->kernel_args,
|
||||
bind_map->kernel_arg_count);
|
||||
shader->bind_map.kernel_args = kernel_args;
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
|
@ -219,12 +224,20 @@ anv_shader_bin_serialize(struct vk_pipeline_cache_object *object,
|
|||
sizeof(shader->bind_map.push_sha1));
|
||||
blob_write_uint32(blob, shader->bind_map.surface_count);
|
||||
blob_write_uint32(blob, shader->bind_map.sampler_count);
|
||||
if (shader->stage == MESA_SHADER_KERNEL) {
|
||||
uint32_t packed = (uint32_t)shader->bind_map.kernel_args_size << 16 |
|
||||
(uint32_t)shader->bind_map.kernel_arg_count;
|
||||
blob_write_uint32(blob, packed);
|
||||
}
|
||||
blob_write_bytes(blob, shader->bind_map.surface_to_descriptor,
|
||||
shader->bind_map.surface_count *
|
||||
sizeof(*shader->bind_map.surface_to_descriptor));
|
||||
blob_write_bytes(blob, shader->bind_map.sampler_to_descriptor,
|
||||
shader->bind_map.sampler_count *
|
||||
sizeof(*shader->bind_map.sampler_to_descriptor));
|
||||
blob_write_bytes(blob, shader->bind_map.kernel_args,
|
||||
shader->bind_map.kernel_arg_count *
|
||||
sizeof(*shader->bind_map.kernel_args));
|
||||
blob_write_bytes(blob, shader->bind_map.push_ranges,
|
||||
sizeof(shader->bind_map.push_ranges));
|
||||
|
||||
|
|
@ -265,18 +278,26 @@ anv_shader_bin_deserialize(struct vk_device *vk_device,
|
|||
if (xfb_size)
|
||||
xfb_info = blob_read_bytes(blob, xfb_size);
|
||||
|
||||
struct anv_pipeline_bind_map bind_map;
|
||||
struct anv_pipeline_bind_map bind_map = {};
|
||||
blob_copy_bytes(blob, bind_map.surface_sha1, sizeof(bind_map.surface_sha1));
|
||||
blob_copy_bytes(blob, bind_map.sampler_sha1, sizeof(bind_map.sampler_sha1));
|
||||
blob_copy_bytes(blob, bind_map.push_sha1, sizeof(bind_map.push_sha1));
|
||||
bind_map.surface_count = blob_read_uint32(blob);
|
||||
bind_map.sampler_count = blob_read_uint32(blob);
|
||||
if (stage == MESA_SHADER_KERNEL) {
|
||||
uint32_t packed = blob_read_uint32(blob);
|
||||
bind_map.kernel_args_size = (uint16_t)(packed >> 16);
|
||||
bind_map.kernel_arg_count = (uint16_t)packed;
|
||||
}
|
||||
bind_map.surface_to_descriptor = (void *)
|
||||
blob_read_bytes(blob, bind_map.surface_count *
|
||||
sizeof(*bind_map.surface_to_descriptor));
|
||||
bind_map.sampler_to_descriptor = (void *)
|
||||
blob_read_bytes(blob, bind_map.sampler_count *
|
||||
sizeof(*bind_map.sampler_to_descriptor));
|
||||
bind_map.kernel_args = (void *)
|
||||
blob_read_bytes(blob, bind_map.kernel_arg_count *
|
||||
sizeof(*bind_map.kernel_args));
|
||||
blob_copy_bytes(blob, bind_map.push_ranges, sizeof(bind_map.push_ranges));
|
||||
|
||||
if (blob->overrun)
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
#include "dev/intel_device_info.h"
|
||||
#include "blorp/blorp.h"
|
||||
#include "compiler/brw_compiler.h"
|
||||
#include "compiler/brw_kernel.h"
|
||||
#include "compiler/brw_rt.h"
|
||||
#include "ds/intel_driver_ds.h"
|
||||
#include "util/bitset.h"
|
||||
|
|
@ -2781,9 +2782,12 @@ struct anv_pipeline_bind_map {
|
|||
|
||||
uint32_t surface_count;
|
||||
uint32_t sampler_count;
|
||||
uint16_t kernel_args_size;
|
||||
uint16_t kernel_arg_count;
|
||||
|
||||
struct anv_pipeline_binding * surface_to_descriptor;
|
||||
struct anv_pipeline_binding * sampler_to_descriptor;
|
||||
struct brw_kernel_arg_desc * kernel_args;
|
||||
|
||||
struct anv_push_range push_ranges[4];
|
||||
};
|
||||
|
|
@ -3079,6 +3083,14 @@ anv_pipeline_finish(struct anv_pipeline *pipeline,
|
|||
struct anv_device *device,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
||||
struct anv_kernel {
|
||||
#ifndef NDEBUG
|
||||
const char *name;
|
||||
#endif
|
||||
struct anv_shader_bin *bin;
|
||||
const struct gen_l3_config *l3_config;
|
||||
};
|
||||
|
||||
struct anv_format_plane {
|
||||
enum isl_format isl_format:16;
|
||||
struct isl_swizzle swizzle;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue