upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/vulkan13_features_test.cpp
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-27 05:48:33 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-27 05:48:33 -0500
commit0513e00b07eaf9cd5a5cfc715d4c1bf4f3688341 (patch)
tree2cee9b392cdcc90cede63fc9e9ba3ba7238a15a2 /runtime/test/vulkan13_features_test.cpp
parentf0c8c17cc6589e8701189c0ed869e41013bb2966 (diff)
rdna2spirv: the 4x8-bit dot products as SPV_KHR_integer_dot_product
v_dot4_i32_i8, v_dot4c_i32_i8, v_dot4_u32_u8 and v_dot4c_u32_u8 become one OpSDot / OpUDot on the packed bytes plus OpIAdd for the addend, and OpSDotAccSat / OpUDotAccSat under clamp (both saturate the addend plus the exact sum, as the hardware does). op_sel halves are put together into one dword first. RADV did not re-form v_dot4 from the old expansion (four extracts, multiplies and adds each), which made the FidelityFX upscaler passes ALU bound. --integer-dot-fallback keeps the expansion for a device without shaderIntegerDotProduct (required by Vulkan 1.3): vk_subgroup_info.py reports integer_dot_product and make_game.py turns the flag on where it is false. The runtime and vk_pipeline_check enable the feature where the device has it; the interpreters of the semantic tests run the new ops. Tested: tests/semantic/test_packed_dot4.py (new fixtures), the translator suite, tools/dot_diff.py on the four ops, a wave32 GPU program on the Radeon iGPU (gfx1036) and the RX 7900 XTX against the gfx1036-measured words, RADV statistics of the upscaler passes (docs/design.md row). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/vulkan13_features_test.cpp')
-rw-r--r--runtime/test/vulkan13_features_test.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/runtime/test/vulkan13_features_test.cpp b/runtime/test/vulkan13_features_test.cpp
index c9795ade5..489b2eb81 100644
--- a/runtime/test/vulkan13_features_test.cpp
+++ b/runtime/test/vulkan13_features_test.cpp
@@ -26,6 +26,7 @@ struct FakeDevice {
26 VkBool32 synchronization2 = VK_FALSE; 26 VkBool32 synchronization2 = VK_FALSE;
27 VkBool32 subgroup_size_control = VK_FALSE; 27 VkBool32 subgroup_size_control = VK_FALSE;
28 VkBool32 compute_full_subgroups = VK_FALSE; 28 VkBool32 compute_full_subgroups = VK_FALSE;
29 VkBool32 integer_dot_product = VK_FALSE;
29 VkBool32 eds = VK_FALSE; 30 VkBool32 eds = VK_FALSE;
30 VkBool32 eds2 = VK_FALSE; 31 VkBool32 eds2 = VK_FALSE;
31 int features2_calls = 0; 32 int features2_calls = 0;
@@ -65,6 +66,7 @@ VKAPI_ATTR void VKAPI_CALL fake_get_features2(VkPhysicalDevice, VkPhysicalDevice
65 f->synchronization2 = g_device->synchronization2; 66 f->synchronization2 = g_device->synchronization2;
66 f->subgroupSizeControl = g_device->subgroup_size_control; 67 f->subgroupSizeControl = g_device->subgroup_size_control;
67 f->computeFullSubgroups = g_device->compute_full_subgroups; 68 f->computeFullSubgroups = g_device->compute_full_subgroups;
69 f->shaderIntegerDotProduct = g_device->integer_dot_product;
68 break; 70 break;
69 } 71 }
70 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR: 72 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR:
@@ -127,6 +129,28 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL fake_get_device_proc(VkDevice, const ch
127} // namespace 129} // namespace
128 130
129int main() { 131int main() {
132 // shaderIntegerDotProduct (the translator's OpSDot / OpUDot) is enabled where a 1.3 device has it.
133 {
134 FakeDevice dev;
135 dev.dynamic_rendering = VK_TRUE;
136 dev.synchronization2 = VK_TRUE;
137 dev.integer_dot_product = VK_TRUE;
138 g_device = &dev;
139 Vulkan13Features v13;
140 v13.query(VK_NULL_HANDLE, VK_API_VERSION_1_3, fake_get_features2, nullptr);
141 EXPECT(v13.integer_dot_product);
142 Vulkan13Features chosen;
143 chosen.choose(v13);
144 EXPECT(chosen.integer_dot_product);
145 VkBaseOutStructure tail{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, nullptr};
146 const auto* enable13 = static_cast<const VkPhysicalDeviceVulkan13Features*>(chosen.enable(&tail));
147 EXPECT(enable13->shaderIntegerDotProduct == VK_TRUE);
148 // A 1.2 device goes without (make_game.py translates for it with --integer-dot-fallback).
149 Vulkan13Features v12;
150 v12.query(VK_NULL_HANDLE, VK_API_VERSION_1_2, fake_get_features2, nullptr);
151 EXPECT(!v12.integer_dot_product);
152 }
153
130 // Vulkan 1.3 core device: queries VkPhysicalDeviceVulkan13Features without enumerating extensions. 154 // Vulkan 1.3 core device: queries VkPhysicalDeviceVulkan13Features without enumerating extensions.
131 { 155 {
132 FakeDevice dev; 156 FakeDevice dev;
@@ -152,6 +176,7 @@ int main() {
152 EXPECT(enable13->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES); 176 EXPECT(enable13->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES);
153 EXPECT(enable13->dynamicRendering == VK_TRUE && enable13->synchronization2 == VK_TRUE); 177 EXPECT(enable13->dynamicRendering == VK_TRUE && enable13->synchronization2 == VK_TRUE);
154 EXPECT(enable13->subgroupSizeControl == VK_TRUE && enable13->computeFullSubgroups == VK_FALSE); 178 EXPECT(enable13->subgroupSizeControl == VK_TRUE && enable13->computeFullSubgroups == VK_FALSE);
179 EXPECT(!v13.integer_dot_product && enable13->shaderIntegerDotProduct == VK_FALSE);
155 EXPECT(enable13->pNext == &tail); 180 EXPECT(enable13->pNext == &tail);
156 181
157 // Inserting a later feature struct through next() places it between enable13 and tail. 182 // Inserting a later feature struct through next() places it between enable13 and tail.