Skip to content

Commit

Permalink
add support for roundingmoderte capability
Browse files Browse the repository at this point in the history
  • Loading branch information
rjodinchr committed Jun 28, 2023
1 parent 8e03635 commit 6b8869e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ void cvk_device::init_vulkan_properties(VkInstance instance) {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT;
m_subgroup_properties.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES;
m_float_controls_properties.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES;

//--- Get maxMemoryAllocationSize for figuring out the max single buffer
// allocation size and default init when the extension is not supported
Expand All @@ -71,6 +73,8 @@ void cvk_device::init_vulkan_properties(VkInstance instance) {
m_subgroup_properties),
VER_EXT_PROP(VK_MAKE_VERSION(1, 1, 0), nullptr,
m_maintenance3_properties),
VER_EXT_PROP(VK_MAKE_VERSION(1, 2, 0), nullptr,
m_float_controls_properties),
};
#undef VER_EXT_PROP

Expand Down Expand Up @@ -1038,6 +1042,12 @@ bool cvk_device::supports_capability(spv::Capability capability) const {
return supports_non_uniform_decoration();
case spv::CapabilityPhysicalStorageBufferAddresses:
return m_features_buffer_device_address.bufferDeviceAddress;
case spv::CapabilityRoundingModeRTE:
return m_float_controls_properties.shaderRoundingModeRTEFloat32 &&
(m_float_controls_properties.shaderRoundingModeRTEFloat16 ||
!m_features_float16_int8.shaderFloat16) &&
(m_float_controls_properties.shaderRoundingModeRTEFloat64 ||
!m_features.features.shaderFloat64);
// Capabilities that have not yet been mapped to Vulkan features:
default:
cvk_warn_fn("Capability %d not yet mapped to a feature.", capability);
Expand Down
1 change: 1 addition & 0 deletions src/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ struct cvk_device : public _cl_device_id,
m_features_vulkan_memory_model{};
VkPhysicalDeviceBufferDeviceAddressFeaturesKHR
m_features_buffer_device_address{};
VkPhysicalDeviceFloatControlsProperties m_float_controls_properties{};

VkDevice m_dev;
std::vector<const char*> m_vulkan_device_extensions;
Expand Down

0 comments on commit 6b8869e

Please sign in to comment.