Implement buffer atomic fmin/fmax instructions (#3123)

This commit is contained in:
Marcin Mikołajczyk
2025-06-20 02:37:29 +02:00
committed by GitHub
parent 612f340292
commit 423254692a
15 changed files with 99 additions and 5 deletions

View File

@@ -281,6 +281,8 @@ bool Instance::CreateDevice() {
if (shader_atomic_float2) {
shader_atomic_float2_features =
feature_chain.get<vk::PhysicalDeviceShaderAtomicFloat2FeaturesEXT>();
LOG_INFO(Render_Vulkan, "- shaderBufferFloat32AtomicMinMax: {}",
shader_atomic_float2_features.shaderBufferFloat32AtomicMinMax);
LOG_INFO(Render_Vulkan, "- shaderImageFloat32AtomicMinMax: {}",
shader_atomic_float2_features.shaderImageFloat32AtomicMinMax);
}
@@ -433,6 +435,8 @@ bool Instance::CreateDevice() {
.legacyVertexAttributes = true,
},
vk::PhysicalDeviceShaderAtomicFloat2FeaturesEXT{
.shaderBufferFloat32AtomicMinMax =
shader_atomic_float2_features.shaderBufferFloat32AtomicMinMax,
.shaderImageFloat32AtomicMinMax =
shader_atomic_float2_features.shaderImageFloat32AtomicMinMax,
},

View File

@@ -165,6 +165,13 @@ public:
return amd_shader_trinary_minmax;
}
/// Returns true when the shaderBufferFloat32AtomicMinMax feature of
/// VK_EXT_shader_atomic_float2 is supported.
bool IsShaderAtomicFloatBuffer32MinMaxSupported() const {
return shader_atomic_float2 &&
shader_atomic_float2_features.shaderBufferFloat32AtomicMinMax;
}
/// Returns true when the shaderImageFloat32AtomicMinMax feature of
/// VK_EXT_shader_atomic_float2 is supported.
bool IsShaderAtomicFloatImage32MinMaxSupported() const {

View File

@@ -216,6 +216,8 @@ PipelineCache::PipelineCache(const Instance& instance_, Scheduler& scheduler_,
.supports_trinary_minmax = instance_.IsAmdShaderTrinaryMinMaxSupported(),
// TODO: Emitted bounds checks cause problems with phi control flow; needs to be fixed.
.supports_robust_buffer_access = true, // instance_.IsRobustBufferAccess2Supported(),
.supports_buffer_fp32_atomic_min_max =
instance_.IsShaderAtomicFloatBuffer32MinMaxSupported(),
.supports_image_fp32_atomic_min_max = instance_.IsShaderAtomicFloatImage32MinMaxSupported(),
.supports_workgroup_explicit_memory_layout =
instance_.IsWorkgroupMemoryExplicitLayoutSupported(),