Skip to content

Introduce no_volk buck targets #6910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions backends/vulkan/runtime/vk_api/Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,15 @@ VkDevice create_logical_device(
#ifdef VK_ANDROID_external_memory_android_hardware_buffer
VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME,
#endif /* VK_ANDROID_external_memory_android_hardware_buffer */
#ifdef VK_KHR_16bit_storage
VK_KHR_16BIT_STORAGE_EXTENSION_NAME,
#endif /* VK_KHR_16bit_storage */
#ifdef VK_KHR_8bit_storage
VK_KHR_8BIT_STORAGE_EXTENSION_NAME,
#endif /* VK_KHR_8bit_storage */
#ifdef VK_KHR_shader_float16_int8
VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME,
#endif /* VK_KHR_shader_float16_int8 */
};

std::vector<const char*> enabled_device_extensions;
Expand Down Expand Up @@ -240,6 +246,7 @@ std::string Adapter::stringize() const {
PRINT_PROP_VEC3(limits, maxComputeWorkGroupSize);
ss << " }" << std::endl;

#ifdef VK_KHR_16bit_storage
ss << " 16bit Storage Features {" << std::endl;
PRINT_PROP(physical_device_.shader_16bit_storage, storageBuffer16BitAccess);
PRINT_PROP(
Expand All @@ -248,18 +255,23 @@ std::string Adapter::stringize() const {
PRINT_PROP(physical_device_.shader_16bit_storage, storagePushConstant16);
PRINT_PROP(physical_device_.shader_16bit_storage, storageInputOutput16);
ss << " }" << std::endl;
#endif /* VK_KHR_16bit_storage */

#ifdef VK_KHR_8bit_storage
ss << " 8bit Storage Features {" << std::endl;
PRINT_PROP(physical_device_.shader_8bit_storage, storageBuffer8BitAccess);
PRINT_PROP(
physical_device_.shader_8bit_storage, uniformAndStorageBuffer8BitAccess);
PRINT_PROP(physical_device_.shader_8bit_storage, storagePushConstant8);
ss << " }" << std::endl;
#endif /* VK_KHR_8bit_storage */

#ifdef VK_KHR_shader_float16_int8
ss << " Shader 16bit and 8bit Features {" << std::endl;
PRINT_PROP(physical_device_.shader_float16_int8_types, shaderFloat16);
PRINT_PROP(physical_device_.shader_float16_int8_types, shaderInt8);
ss << " }" << std::endl;
#endif /* VK_KHR_shader_float16_int8 */

const VkPhysicalDeviceMemoryProperties& mem_props =
physical_device_.memory_properties;
Expand Down
16 changes: 16 additions & 0 deletions backends/vulkan/runtime/vk_api/Adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,37 @@ class Adapter final {
// Physical Device Features

inline bool supports_16bit_storage_buffers() {
#ifdef VK_KHR_16bit_storage
return physical_device_.shader_16bit_storage.storageBuffer16BitAccess ==
VK_TRUE;
#else
return false;
#endif /* VK_KHR_16bit_storage */
}

inline bool supports_8bit_storage_buffers() {
#ifdef VK_KHR_8bit_storage
return physical_device_.shader_8bit_storage.storageBuffer8BitAccess ==
VK_TRUE;
#else
return false;
#endif /* VK_KHR_8bit_storage */
}

inline bool supports_float16_shader_types() {
#ifdef VK_KHR_shader_float16_int8
return physical_device_.shader_float16_int8_types.shaderFloat16 == VK_TRUE;
#else
return false;
#endif /* VK_KHR_shader_float16_int8 */
}

inline bool supports_int8_shader_types() {
#ifdef VK_KHR_shader_float16_int8
return physical_device_.shader_float16_int8_types.shaderInt8 == VK_TRUE;
#else
return false;
#endif /* VK_KHR_shader_float16_int8 */
}

inline bool supports_int16_shader_types() {
Expand Down
34 changes: 32 additions & 2 deletions backends/vulkan/runtime/vk_api/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,27 @@ PhysicalDevice::PhysicalDevice(VkPhysicalDevice physical_device_handle)
: handle(physical_device_handle),
properties{},
memory_properties{},
#ifdef VK_KHR_16bit_storage
extension_features(&shader_16bit_storage),
shader_16bit_storage{
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES},
#else
extension_features{nullptr},
#endif /* VK_KHR_16bit_storage */
#ifdef VK_KHR_8bit_storage
shader_8bit_storage{
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES},
#endif /* VK_KHR_8bit_storage */
#ifdef VK_KHR_shader_float16_int8
shader_float16_int8_types{
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR},
#endif /* VK_KHR_shader_float16_int8 */
queue_families{},
num_compute_queues(0),
supports_int16_shader_types(false),
has_unified_memory(false),
has_timestamps(properties.limits.timestampComputeAndGraphics),
timestamp_period(properties.limits.timestampPeriod),
extension_features(&shader_16bit_storage) {
timestamp_period(properties.limits.timestampPeriod) {
// Extract physical device properties
vkGetPhysicalDeviceProperties(handle, &properties);
vkGetPhysicalDeviceMemoryProperties(handle, &memory_properties);
Expand All @@ -43,10 +51,32 @@ PhysicalDevice::PhysicalDevice(VkPhysicalDevice physical_device_handle)
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2};

// Create linked list to query availability of extensions

#ifdef VK_KHR_16bit_storage
features2.pNext = &shader_16bit_storage;
#elif defined(VK_KHR_8bit_storage)
features2.pNext = &shader_8bit_storage;
#elif defined(VK_KHR_shader_float16_int8)
features2.pNext = &shader_float16_int8_types;
#endif /* VK_KHR_16bit_storage */

#if defined(VK_KHR_16bit_storage) && defined(VK_KHR_8bit_storage)
shader_16bit_storage.pNext = &shader_8bit_storage;
#elif defined(VK_KHR_16bit_storage) && defined(VK_KHR_shader_float16_int8)
shader_16bit_storage.pNext = &shader_float16_int8_types;
#elif defined(VK_KHR_16bit_storage)
shader_16bit_storage.pNext = nullptr;
#endif

#if defined(VK_KHR_8bit_storage) && defined(VK_KHR_shader_float16_int8)
shader_8bit_storage.pNext = &shader_float16_int8_types;
#elif defined(VK_KHR_8bit_storage)
shader_8bit_storage.pNext = nullptr;
#endif

#ifdef VK_KHR_shader_float16_int8
shader_float16_int8_types.pNext = nullptr;
#endif

vkGetPhysicalDeviceFeatures2(handle, &features2);

Expand Down
13 changes: 10 additions & 3 deletions backends/vulkan/runtime/vk_api/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,20 @@ struct PhysicalDevice final {
// Properties obtained from Vulkan
VkPhysicalDeviceProperties properties;
VkPhysicalDeviceMemoryProperties memory_properties;

// Head of the linked list of extensions to be requested
void* extension_features;

// Additional features available from extensions
#ifdef VK_KHR_16bit_storage
VkPhysicalDevice16BitStorageFeatures shader_16bit_storage;
#endif /* VK_KHR_16bit_storage */
#ifdef VK_KHR_8bit_storage
VkPhysicalDevice8BitStorageFeatures shader_8bit_storage;
#endif /* VK_KHR_8bit_storage */
#ifdef VK_KHR_shader_float16_int8
VkPhysicalDeviceShaderFloat16Int8Features shader_float16_int8_types;
#endif /* VK_KHR_shader_float16_int8 */

// Available GPU queues
std::vector<VkQueueFamilyProperties> queue_families;
Expand All @@ -40,9 +50,6 @@ struct PhysicalDevice final {
bool has_timestamps;
float timestamp_period;

// Head of the linked list of extensions to be requested
void* extension_features{nullptr};

explicit PhysicalDevice(VkPhysicalDevice);
};

Expand Down
Loading
Loading