summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-01-12 18:30:47 -0600
committerJason Ekstrand <[email protected]>2019-04-19 19:56:42 +0000
commitbd56ce8ce5045a181b9fc8a7f24251931e343f9c (patch)
tree250c3278fa9472917f8590845af273c4f810c104 /src/intel/vulkan
parent79fb0d27f3ab41fec88acbe24bc3163a42c0715c (diff)
anv: Implement VK_KHR_shader_atomic_int64
Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r--src/intel/vulkan/anv_device.c8
-rw-r--r--src/intel/vulkan/anv_extensions.py2
-rw-r--r--src/intel/vulkan/anv_nir_apply_pipeline_layout.c12
-rw-r--r--src/intel/vulkan/anv_pipeline.c1
4 files changed, 21 insertions, 2 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index de56926d935..d56e3593353 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1051,6 +1051,14 @@ void anv_GetPhysicalDeviceFeatures2(
break;
}
+ case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES_KHR: {
+ VkPhysicalDeviceShaderAtomicInt64FeaturesKHR *features = (void *)ext;
+ features->shaderBufferInt64Atomics =
+ pdevice->info.gen >= 9 && pdevice->use_softpin;
+ features->shaderSharedInt64Atomics = VK_FALSE;
+ break;
+ }
+
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES: {
VkPhysicalDeviceShaderDrawParametersFeatures *features = (void *)ext;
features->shaderDrawParameters = true;
diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py
index 9d398f16cd3..d937e4e4524 100644
--- a/src/intel/vulkan/anv_extensions.py
+++ b/src/intel/vulkan/anv_extensions.py
@@ -104,6 +104,8 @@ EXTENSIONS = [
Extension('VK_KHR_relaxed_block_layout', 1, True),
Extension('VK_KHR_sampler_mirror_clamp_to_edge', 1, True),
Extension('VK_KHR_sampler_ycbcr_conversion', 1, True),
+ Extension('VK_KHR_shader_atomic_int64', 1,
+ 'device->info.gen >= 9 && device->use_softpin'),
Extension('VK_KHR_shader_draw_parameters', 1, True),
Extension('VK_KHR_shader_float16_int8', 1, 'device->info.gen >= 8'),
Extension('VK_KHR_storage_buffer_storage_class', 1, True),
diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
index 356a56e47bb..9d25b9420fc 100644
--- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
+++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
@@ -253,7 +253,7 @@ build_index_offset_for_deref(nir_deref_instr *deref,
}
static bool
-try_lower_direct_buffer_intrinsic(nir_intrinsic_instr *intrin,
+try_lower_direct_buffer_intrinsic(nir_intrinsic_instr *intrin, bool is_atomic,
struct apply_pipeline_layout_state *state)
{
nir_builder *b = &state->builder;
@@ -262,6 +262,12 @@ try_lower_direct_buffer_intrinsic(nir_intrinsic_instr *intrin,
if (deref->mode != nir_var_mem_ssbo)
return false;
+ /* 64-bit atomics only support A64 messages so we can't lower them to the
+ * index+offset model.
+ */
+ if (is_atomic && nir_dest_bit_size(intrin->dest) == 64)
+ return false;
+
if (!nir_deref_find_descriptor(deref, state))
return false;
@@ -286,6 +292,8 @@ lower_direct_buffer_access(nir_function_impl *impl,
switch (intrin->intrinsic) {
case nir_intrinsic_load_deref:
case nir_intrinsic_store_deref:
+ try_lower_direct_buffer_intrinsic(intrin, false, state);
+ break;
case nir_intrinsic_deref_atomic_add:
case nir_intrinsic_deref_atomic_imin:
case nir_intrinsic_deref_atomic_umin:
@@ -299,7 +307,7 @@ lower_direct_buffer_access(nir_function_impl *impl,
case nir_intrinsic_deref_atomic_fmin:
case nir_intrinsic_deref_atomic_fmax:
case nir_intrinsic_deref_atomic_fcomp_swap:
- try_lower_direct_buffer_intrinsic(intrin, state);
+ try_lower_direct_buffer_intrinsic(intrin, true, state);
break;
case nir_intrinsic_get_buffer_size: {
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index b0ed2187376..09abf4e85fd 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -147,6 +147,7 @@ anv_shader_compile_to_nir(struct anv_device *device,
.int8 = pdevice->info.gen >= 8,
.int16 = pdevice->info.gen >= 8,
.int64 = pdevice->info.gen >= 8,
+ .int64_atomics = pdevice->info.gen >= 9 && pdevice->use_softpin,
.min_lod = true,
.multiview = true,
.physical_storage_buffer_address = pdevice->has_a64_buffer_access,