Skip to content
Closed
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
5 changes: 5 additions & 0 deletions backends/vulkan/runtime/graph/ComputeGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ ComputeGraph::ComputeGraph(GraphConfig config)
config_.execute_threshold_node_count = 128;
config_.execute_initial_threshold_node_count = 64;
}

// Check if the underlying GPU can access accelerated integer dot product
// instructions
can_use_int8_dot_product_ =
context_->adapter_ptr()->supports_int8_dot_product();
}

ComputeGraph::~ComputeGraph() {
Expand Down
8 changes: 8 additions & 0 deletions backends/vulkan/runtime/graph/ComputeGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ class ComputeGraph final {
// config.execute_threshold_node_count.
size_t execute_threshold_node_count_ = 0;

// Whether the underlying GPU support accelerated integer dot product
// extensions
bool can_use_int8_dot_product_ = false;

public:
//
// Accessors
Expand Down Expand Up @@ -1013,6 +1017,10 @@ class ComputeGraph final {
return execute_count_;
}

inline bool can_use_int8_dot_product() const {
return can_use_int8_dot_product_;
}

/*
* Check whether the GPU supports 8 bit buffers.
*/
Expand Down
109 changes: 109 additions & 0 deletions backends/vulkan/runtime/vk_api/Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ VkDevice create_logical_device(
extension_list_top = &shader_float16_int8_types;
#endif /* VK_KHR_shader_float16_int8 */

#ifdef VK_KHR_shader_integer_dot_product
VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR
shader_int_dot_product_features{
physical_device.shader_int_dot_product_features};
shader_int_dot_product_features.pNext = extension_list_top;
extension_list_top = &shader_int_dot_product_features;
#endif /* VK_KHR_shader_integer_dot_product */

device_create_info.pNext = extension_list_top;

VkDevice handle = nullptr;
Expand Down Expand Up @@ -401,6 +409,107 @@ std::string Adapter::stringize() const {
#endif /* VK_KHR_shader_float16_int8 */
ss << " }" << std::endl;

#ifdef VK_KHR_shader_integer_dot_product
ss << " Shader Integer Dot Product Features {" << std::endl;
PRINT_PROP(
physical_device_.shader_int_dot_product_features,
shaderIntegerDotProduct);
ss << " }" << std::endl;

ss << " Shader Integer Dot Product Properties {" << std::endl;
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct8BitUnsignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct8BitSignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct8BitMixedSignednessAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct4x8BitPackedUnsignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct4x8BitPackedSignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct4x8BitPackedMixedSignednessAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct16BitUnsignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct16BitSignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct16BitMixedSignednessAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct32BitUnsignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct32BitSignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct32BitMixedSignednessAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct64BitUnsignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct64BitSignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProduct64BitMixedSignednessAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating8BitUnsignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating8BitSignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating16BitUnsignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating16BitSignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating32BitUnsignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating32BitSignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating64BitUnsignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating64BitSignedAccelerated);
PRINT_PROP(
physical_device_.shader_int_dot_product_properties,
integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated);
ss << " }" << std::endl;
#endif /* VK_KHR_shader_integer_dot_product */

const VkPhysicalDeviceMemoryProperties& mem_props =
physical_device_.memory_properties;

Expand Down
9 changes: 9 additions & 0 deletions backends/vulkan/runtime/vk_api/Adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ class Adapter final {
#endif /* VK_KHR_shader_float16_int8 */
}

inline bool supports_int8_dot_product() {
#ifdef VK_KHR_shader_integer_dot_product
return physical_device_.shader_int_dot_product_features
.shaderIntegerDotProduct == VK_TRUE;
#else
return false;
#endif /* VK_KHR_shader_integer_dot_product */
}

inline bool supports_int16_shader_types() {
return physical_device_.supports_int16_shader_types;
}
Expand Down
13 changes: 13 additions & 0 deletions backends/vulkan/runtime/vk_api/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ PhysicalDevice::PhysicalDevice(VkPhysicalDevice physical_device_handle)
shader_float16_int8_types{
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR},
#endif /* VK_KHR_shader_float16_int8 */
#ifdef VK_KHR_shader_integer_dot_product
shader_int_dot_product_features{
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES_KHR},
shader_int_dot_product_properties{
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES_KHR},
#endif
queue_families{},
num_compute_queues(0),
supports_int16_shader_types(false),
Expand Down Expand Up @@ -77,6 +83,13 @@ PhysicalDevice::PhysicalDevice(VkPhysicalDevice physical_device_handle)
extension_list_top = &shader_float16_int8_types;
#endif /* VK_KHR_shader_float16_int8 */

#ifdef VK_KHR_shader_integer_dot_product
shader_int_dot_product_features.pNext = extension_list_top;
extension_list_top = &shader_int_dot_product_features;
shader_int_dot_product_properties.pNext = extension_list_top;
extension_list_top = &shader_int_dot_product_properties;
#endif /* VK_KHR_shader_integer_dot_product */

features2.pNext = extension_list_top;

vkGetPhysicalDeviceFeatures2(handle, &features2);
Expand Down
6 changes: 6 additions & 0 deletions backends/vulkan/runtime/vk_api/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ struct PhysicalDevice final {
#ifdef VK_KHR_shader_float16_int8
VkPhysicalDeviceShaderFloat16Int8Features shader_float16_int8_types;
#endif /* VK_KHR_shader_float16_int8 */
#ifdef VK_KHR_shader_integer_dot_product
VkPhysicalDeviceShaderIntegerDotProductFeatures
shader_int_dot_product_features;
VkPhysicalDeviceShaderIntegerDotProductProperties
shader_int_dot_product_properties;
#endif /* VK_KHR_shader_integer_dot_product */

// Available GPU queues
std::vector<VkQueueFamilyProperties> queue_families;
Expand Down
2 changes: 1 addition & 1 deletion backends/vulkan/runtime/vk_api/QueryPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ std::string QueryPool::generate_string_report() {

std::stringstream ss;

int kernel_name_w = 40;
int kernel_name_w = 120;
int global_size_w = 25;
int local_size_w = 25;
int duration_w = 25;
Expand Down
Loading