From daeda3e1f8d92a57f350b735337aff62cb7797ac Mon Sep 17 00:00:00 2001 From: David Neto Date: Mon, 15 Jul 2019 11:02:20 -0400 Subject: [PATCH] Fix Float16 validation for 16bt storage tests * Refactor interface functions to avoid arithmetic capabilities * new string template Components: Vulkan VK-GL-CTS issue: 1874 Affects: dEQP-VK.spirv_assembly.instruction.graphics.16bit_storage.* dEQP-VK.spirv_assembly.instruction.graphics.indexing.* Change-Id: I05198eedb59a545785a65026847885ea7fae85bf (cherry picked from commit 6d615d59eab72e305f1f5da2b2e1dda1b48ea108) --- .../spirv_assembly/vktSpvAsm16bitStorageTests.cpp | 241 ++++++++------------- .../vktSpvAsmGraphicsShaderTestUtil.cpp | 24 +- .../spirv_assembly/vktSpvAsmIndexingTests.cpp | 1 + 3 files changed, 99 insertions(+), 167 deletions(-) diff --git a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsm16bitStorageTests.cpp b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsm16bitStorageTests.cpp index 7248f07..4dad8c7 100644 --- a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsm16bitStorageTests.cpp +++ b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsm16bitStorageTests.cpp @@ -48,6 +48,7 @@ #include "vktSpvAsmComputeShaderCase.hpp" #include "vktSpvAsmComputeShaderTestUtil.hpp" #include "vktSpvAsmGraphicsShaderTestUtil.hpp" +#include "vktSpvAsmUtils.hpp" #include "vktTestCaseUtil.hpp" #include "vktTestGroupUtil.hpp" @@ -3637,6 +3638,7 @@ void addGraphics16BitStorageInputOutputFloat32To16Group (tcu::TestCaseGroup* tes struct Case { const char* name; + const char* interfaceOpCall; const char* interfaceOpFunc; const char* postInterfaceOp; const char* postInterfaceOpGeom; @@ -3652,12 +3654,8 @@ void addGraphics16BitStorageInputOutputFloat32To16Group (tcu::TestCaseGroup* tes { { // Scalar cases "scalar", - // Passthrough interface_op_func - "%interface_op_func = OpFunction %f16 None %f16_f32_function\n" - " %io_param1 = OpFunctionParameter %f32\n" - " %entry = OpLabel\n" - " OpReturnValue %f16_0\n" - " OpFunctionEnd\n", + "OpFConvert %f16", + "", " %ret0 = OpFConvert %f16 %IF_input_val\n" " OpStore %IF_output %ret0\n", @@ -3678,8 +3676,7 @@ void addGraphics16BitStorageInputOutputFloat32To16Group (tcu::TestCaseGroup* tes " %op_a3f16 = OpTypePointer Output %a3f16\n" "%f16_f32_function = OpTypeFunction %f16 %f32\n" " %a3f32 = OpTypeArray %f32 %c_i32_3\n" - " %ip_a3f32 = OpTypePointer Input %a3f32\n" - " %f16_0 = OpConstant %f16 0\n", + " %ip_a3f32 = OpTypePointer Input %a3f32\n", "f32", "f16", @@ -3689,11 +3686,8 @@ void addGraphics16BitStorageInputOutputFloat32To16Group (tcu::TestCaseGroup* tes { // Vector cases "vector", - "%interface_op_func = OpFunction %v2f16 None %v2f16_v2f32_function\n" - " %io_param1 = OpFunctionParameter %v2f32\n" - " %entry = OpLabel\n" - " OpReturnValue %v2f16_0\n" - " OpFunctionEnd\n", + "OpFConvert %v2f16", + "", " %ret0 = OpFConvert %v2f16 %IF_input_val\n" " OpStore %IF_output %ret0\n", @@ -3715,9 +3709,7 @@ void addGraphics16BitStorageInputOutputFloat32To16Group (tcu::TestCaseGroup* tes " %op_a3v2f16 = OpTypePointer Output %a3v2f16\n" "%v2f16_v2f32_function = OpTypeFunction %v2f16 %v2f32\n" " %a3v2f32 = OpTypeArray %v2f32 %c_i32_3\n" - " %ip_a3v2f32 = OpTypePointer Input %a3v2f32\n" - " %f16_0 = OpConstant %f16 0\n" - " %v2f16_0 = OpConstantComposite %v2f16 %f16_0 %f16_0\n", + " %ip_a3v2f32 = OpTypePointer Input %a3v2f32\n", "v2f32", "v2f16", @@ -3732,6 +3724,7 @@ void addGraphics16BitStorageInputOutputFloat32To16Group (tcu::TestCaseGroup* tes for (deUint32 caseIdx = 0; caseIdx < DE_LENGTH_OF_ARRAY(cases); ++caseIdx) for (deUint32 rndModeIdx = 0; rndModeIdx < DE_LENGTH_OF_ARRAY(rndModes); ++rndModeIdx) { + fragments["interface_op_call"] = cases[caseIdx].interfaceOpCall; fragments["interface_op_func"] = cases[caseIdx].interfaceOpFunc; fragments["post_interface_op_frag"] = cases[caseIdx].postInterfaceOp; fragments["post_interface_op_vert"] = cases[caseIdx].postInterfaceOp; @@ -3794,6 +3787,7 @@ void addGraphics16BitStorageInputOutputFloat16To32Group (tcu::TestCaseGroup* tes struct Case { const char* name; + const char* interfaceOpCall; const char* interfaceOpFunc; const char* preMain; const char* inputType; @@ -3807,12 +3801,8 @@ void addGraphics16BitStorageInputOutputFloat16To32Group (tcu::TestCaseGroup* tes { // Scalar cases "scalar", - "%interface_op_func = OpFunction %f32 None %f32_f16_function\n" - " %io_param1 = OpFunctionParameter %f16\n" - " %entry = OpLabel\n" - " %ret = OpFConvert %f32 %io_param1\n" - " OpReturnValue %ret\n" - " OpFunctionEnd\n", + "OpFConvert %f32", + "", " %f16 = OpTypeFloat 16\n" " %ip_f16 = OpTypePointer Input %f16\n" @@ -3830,12 +3820,8 @@ void addGraphics16BitStorageInputOutputFloat16To32Group (tcu::TestCaseGroup* tes { // Vector cases "vector", - "%interface_op_func = OpFunction %v2f32 None %v2f32_v2f16_function\n" - " %io_param1 = OpFunctionParameter %v2f16\n" - " %entry = OpLabel\n" - " %ret = OpFConvert %v2f32 %io_param1\n" - " OpReturnValue %ret\n" - " OpFunctionEnd\n", + "OpFConvert %v2f32", + "", " %f16 = OpTypeFloat 16\n" " %v2f16 = OpTypeVector %f16 2\n" @@ -3858,6 +3844,7 @@ void addGraphics16BitStorageInputOutputFloat16To32Group (tcu::TestCaseGroup* tes for (deUint32 caseIdx = 0; caseIdx < DE_LENGTH_OF_ARRAY(cases); ++caseIdx) { + fragments["interface_op_call"] = cases[caseIdx].interfaceOpCall; fragments["interface_op_func"] = cases[caseIdx].interfaceOpFunc; fragments["pre_main"] = cases[caseIdx].preMain; @@ -3906,6 +3893,7 @@ void addGraphics16BitStorageInputOutputFloat16To16Group (tcu::TestCaseGroup* tes struct Case { const char* name; + const char* interfaceOpCall; const char* interfaceOpFunc; const char* preMain; const char* inputType; @@ -3919,12 +3907,8 @@ void addGraphics16BitStorageInputOutputFloat16To16Group (tcu::TestCaseGroup* tes { // Scalar cases "scalar", - "%interface_op_func = OpFunction %f16 None %f16_f16_function\n" - " %io_param1 = OpFunctionParameter %f16\n" - " %entry = OpLabel\n" - " %ret = OpCopyObject %f16 %io_param1\n" - " OpReturnValue %ret\n" - " OpFunctionEnd\n", + "OpCopyObject %f16", + "", " %f16 = OpTypeFloat 16\n" " %ip_f16 = OpTypePointer Input %f16\n" @@ -3942,12 +3926,8 @@ void addGraphics16BitStorageInputOutputFloat16To16Group (tcu::TestCaseGroup* tes { // Vector cases "vector", - "%interface_op_func = OpFunction %v2f16 None %v2f16_v2f16_function\n" - " %io_param1 = OpFunctionParameter %v2f16\n" - " %entry = OpLabel\n" - " %ret = OpCopyObject %v2f16 %io_param1\n" - " OpReturnValue %ret\n" - " OpFunctionEnd\n", + "OpCopyObject %v2f16", + "", " %f16 = OpTypeFloat 16\n" " %v2f16 = OpTypeVector %f16 2\n" @@ -3967,6 +3947,7 @@ void addGraphics16BitStorageInputOutputFloat16To16Group (tcu::TestCaseGroup* tes for (deUint32 caseIdx = 0; caseIdx < DE_LENGTH_OF_ARRAY(cases); ++caseIdx) { + fragments["interface_op_call"] = cases[caseIdx].interfaceOpCall; fragments["interface_op_func"] = cases[caseIdx].interfaceOpFunc; fragments["pre_main"] = cases[caseIdx].preMain; @@ -4195,7 +4176,6 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, TestDefinition testDef void addGraphics16BitStorageInputOutputFloat16To16x2Group (tcu::TestCaseGroup* testGroup) { - map fragments; RGBA defaultColors[4]; SpecConstants noSpecConstants; PushConstants noPushConstants; @@ -4274,7 +4254,6 @@ void addGraphics16BitStorageInputOutputInt16To16x2Group (tcu::TestCaseGroup* tes SpecConstants noSpecConstants; PushConstants noPushConstants; vector extensions; - map noFragments; GraphicsResources noResources; StageToSpecConstantMap specConstantMap; VulkanFeatures requiredFeatures; @@ -4292,6 +4271,7 @@ void addGraphics16BitStorageInputOutputInt16To16x2Group (tcu::TestCaseGroup* tes extensions.push_back("VK_KHR_16bit_storage"); requiredFeatures.ext16BitStorage = EXT16BITSTORAGEFEATURES_INPUT_OUTPUT; + requiredFeatures.coreFeatures.shaderInt16 = DE_TRUE; const struct { @@ -4321,7 +4301,7 @@ void addGraphics16BitStorageInputOutputInt16To16x2Group (tcu::TestCaseGroup* tes const InstanceContext& instanceContext = createInstanceContext(pipelineStages, defaultColors, outputColors, - noFragments, + fragments, specConstantMap, noPushConstants, noResources, @@ -4368,13 +4348,10 @@ void addGraphics16BitStorageInputOutputInt32To16Group (tcu::TestCaseGroup* testG getDefaultColors(defaultColors); - const StringTemplate scalarInterfaceOpFunc( - "%interface_op_func = OpFunction %${type16} None %${type16}_${type32}_function\n" - " %io_param1 = OpFunctionParameter %${type32}\n" - " %entry = OpLabel\n" - " %ret = ${convert} %${type16} %io_param1\n" - " OpReturnValue %ret\n" - " OpFunctionEnd\n"); + const StringTemplate scalarInterfaceOpCall( + "${convert} %${type16}"); + + const StringTemplate scalarInterfaceOpFunc(""); const StringTemplate scalarPreMain( " %${type16} = OpTypeInt 16 ${signed}\n" @@ -4385,13 +4362,10 @@ void addGraphics16BitStorageInputOutputInt32To16Group (tcu::TestCaseGroup* testG " %a3${type32} = OpTypeArray %${type32} %c_i32_3\n" " %ip_a3${type32} = OpTypePointer Input %a3${type32}\n"); - const StringTemplate vecInterfaceOpFunc( - "%interface_op_func = OpFunction %${type16} None %${type16}_${type32}_function\n" - " %io_param1 = OpFunctionParameter %${type32}\n" - " %entry = OpLabel\n" - " %ret = ${convert} %${type16} %io_param1\n" - " OpReturnValue %ret\n" - " OpFunctionEnd\n"); + const StringTemplate vecInterfaceOpCall( + "${convert} %${type16}"); + + const StringTemplate vecInterfaceOpFunc(""); const StringTemplate vecPreMain( " %i16 = OpTypeInt 16 1\n" @@ -4408,6 +4382,7 @@ void addGraphics16BitStorageInputOutputInt32To16Group (tcu::TestCaseGroup* testG struct Case { const char* name; + const StringTemplate& interfaceOpCall; const StringTemplate& interfaceOpFunc; const StringTemplate& preMain; const char* type32; @@ -4420,13 +4395,14 @@ void addGraphics16BitStorageInputOutputInt32To16Group (tcu::TestCaseGroup* testG Case cases[] = { - {"scalar_sint", scalarInterfaceOpFunc, scalarPreMain, "i32", "i16", "1", "OpSConvert", 4, 1}, - {"scalar_uint", scalarInterfaceOpFunc, scalarPreMain, "u32", "u16", "0", "OpUConvert", 4, 1}, - {"vector_sint", vecInterfaceOpFunc, vecPreMain, "v4i32", "v4i16", "1", "OpSConvert", 4 * 4, 4}, - {"vector_uint", vecInterfaceOpFunc, vecPreMain, "v4u32", "v4u16", "0", "OpUConvert", 4 * 4, 4}, + {"scalar_sint", scalarInterfaceOpCall, scalarInterfaceOpFunc, scalarPreMain, "i32", "i16", "1", "OpSConvert", 4, 1}, + {"scalar_uint", scalarInterfaceOpCall, scalarInterfaceOpFunc, scalarPreMain, "u32", "u16", "0", "OpUConvert", 4, 1}, + {"vector_sint", vecInterfaceOpCall, vecInterfaceOpFunc, vecPreMain, "v4i32", "v4i16", "1", "OpSConvert", 4 * 4, 4}, + {"vector_uint", vecInterfaceOpCall, vecInterfaceOpFunc, vecPreMain, "v4u32", "v4u16", "0", "OpUConvert", 4 * 4, 4}, }; VulkanFeatures requiredFeatures; + requiredFeatures.coreFeatures.shaderInt16 = DE_TRUE; requiredFeatures.ext16BitStorage = EXT16BITSTORAGEFEATURES_INPUT_OUTPUT; for (deUint32 caseIdx = 0; caseIdx < DE_LENGTH_OF_ARRAY(cases); ++caseIdx) @@ -4439,6 +4415,7 @@ void addGraphics16BitStorageInputOutputInt32To16Group (tcu::TestCaseGroup* testG specs["convert"] = cases[caseIdx].opcode; fragments["pre_main"] = cases[caseIdx].preMain.specialize(specs); + fragments["interface_op_call"] = cases[caseIdx].interfaceOpCall.specialize(specs); fragments["interface_op_func"] = cases[caseIdx].interfaceOpFunc.specialize(specs); fragments["input_type"] = cases[caseIdx].type32; fragments["output_type"] = cases[caseIdx].type16; @@ -4508,13 +4485,10 @@ void addGraphics16BitStorageInputOutputInt16To32Group (tcu::TestCaseGroup* testG getDefaultColors(defaultColors); - const StringTemplate scalarIfOpFunc ( - "%interface_op_func = OpFunction %${type32} None %${type32}_${type16}_function\n" - " %io_param1 = OpFunctionParameter %${type16}\n" - " %entry = OpLabel\n" - " %ret = ${convert} %${type32} %io_param1\n" - " OpReturnValue %ret\n" - " OpFunctionEnd\n"); + const StringTemplate scalarIfOpCall ( + "${convert} %${type32}"); + + const StringTemplate scalarIfOpFunc (""); const StringTemplate scalarPreMain ( " %${type16} = OpTypeInt 16 ${signed}\n" @@ -4525,13 +4499,10 @@ void addGraphics16BitStorageInputOutputInt16To32Group (tcu::TestCaseGroup* testG " %a3${type32} = OpTypeArray %${type32} %c_i32_3\n" " %op_a3${type32} = OpTypePointer Output %a3${type32}\n"); - const StringTemplate vecIfOpFunc ( - "%interface_op_func = OpFunction %${type32} None %${type32}_${type16}_function\n" - " %io_param1 = OpFunctionParameter %${type16}\n" - " %entry = OpLabel\n" - " %ret = ${convert} %${type32} %io_param1\n" - " OpReturnValue %ret\n" - " OpFunctionEnd\n"); + const StringTemplate vecIfOpCall ( + "${convert} %${type32}"); + + const StringTemplate vecIfOpFunc (""); const StringTemplate vecPreMain ( " %i16 = OpTypeInt 16 1\n" @@ -4548,6 +4519,7 @@ void addGraphics16BitStorageInputOutputInt16To32Group (tcu::TestCaseGroup* testG struct Case { const char* name; + const StringTemplate& interfaceOpCall; const StringTemplate& interfaceOpFunc; const StringTemplate& preMain; const char* type32; @@ -4560,13 +4532,14 @@ void addGraphics16BitStorageInputOutputInt16To32Group (tcu::TestCaseGroup* testG Case cases[] = { - {"scalar_sint", scalarIfOpFunc, scalarPreMain, "i32", "i16", "1", "OpSConvert", 4, 1}, - {"scalar_uint", scalarIfOpFunc, scalarPreMain, "u32", "u16", "0", "OpUConvert", 4, 1}, - {"vector_sint", vecIfOpFunc, vecPreMain, "v4i32", "v4i16", "1", "OpSConvert", 4 * 4, 4}, - {"vector_uint", vecIfOpFunc, vecPreMain, "v4u32", "v4u16", "0", "OpUConvert", 4 * 4, 4}, + {"scalar_sint", scalarIfOpCall, scalarIfOpFunc, scalarPreMain, "i32", "i16", "1", "OpSConvert", 4, 1}, + {"scalar_uint", scalarIfOpCall, scalarIfOpFunc, scalarPreMain, "u32", "u16", "0", "OpUConvert", 4, 1}, + {"vector_sint", vecIfOpCall, vecIfOpFunc, vecPreMain, "v4i32", "v4i16", "1", "OpSConvert", 4 * 4, 4}, + {"vector_uint", vecIfOpCall, vecIfOpFunc, vecPreMain, "v4u32", "v4u16", "0", "OpUConvert", 4 * 4, 4}, }; VulkanFeatures requiredFeatures; + requiredFeatures.coreFeatures.shaderInt16 = DE_TRUE; requiredFeatures.ext16BitStorage = EXT16BITSTORAGEFEATURES_INPUT_OUTPUT; for (deUint32 caseIdx = 0; caseIdx < DE_LENGTH_OF_ARRAY(cases); ++caseIdx) @@ -4579,6 +4552,7 @@ void addGraphics16BitStorageInputOutputInt16To32Group (tcu::TestCaseGroup* testG specs["convert"] = cases[caseIdx].opcode; fragments["pre_main"] = cases[caseIdx].preMain.specialize(specs); + fragments["interface_op_call"] = cases[caseIdx].interfaceOpCall.specialize(specs); fragments["interface_op_func"] = cases[caseIdx].interfaceOpFunc.specialize(specs); fragments["input_type"] = cases[caseIdx].type16; fragments["output_type"] = cases[caseIdx].type32; @@ -4637,13 +4611,10 @@ void addGraphics16BitStorageInputOutputInt16To16Group (tcu::TestCaseGroup* testG getDefaultColors(defaultColors); - const StringTemplate scalarIfOpFunc ( - "%interface_op_func = OpFunction %${type16} None %${type16}_${type16}_function\n" - " %io_param1 = OpFunctionParameter %${type16}\n" - " %entry = OpLabel\n" - " %ret = OpCopyObject %${type16} %io_param1\n" - " OpReturnValue %ret\n" - " OpFunctionEnd\n"); + const StringTemplate scalarIfOpCall ( + "OpCopyObject %${type16}"); + + const StringTemplate scalarIfOpFunc (""); const StringTemplate scalarPreMain ( " %${type16} = OpTypeInt 16 ${signed}\n" @@ -4654,13 +4625,10 @@ void addGraphics16BitStorageInputOutputInt16To16Group (tcu::TestCaseGroup* testG " %op_${type16} = OpTypePointer Output %${type16}\n" " %op_a3${type16} = OpTypePointer Output %a3${type16}\n"); - const StringTemplate vecIfOpFunc ( - "%interface_op_func = OpFunction %${type16} None %${type16}_${type16}_function\n" - " %io_param1 = OpFunctionParameter %${type16}\n" - " %entry = OpLabel\n" - " %ret = OpCopyObject %${type16} %io_param1\n" - " OpReturnValue %ret\n" - " OpFunctionEnd\n"); + const StringTemplate vecIfOpCall ( + "OpCopyObject %${type16}"); + + const StringTemplate vecIfOpFunc (""); const StringTemplate vecPreMain ( " %i16 = OpTypeInt 16 1\n" @@ -4677,6 +4645,7 @@ void addGraphics16BitStorageInputOutputInt16To16Group (tcu::TestCaseGroup* testG struct Case { const char* name; + const StringTemplate& interfaceOpCall; const StringTemplate& interfaceOpFunc; const StringTemplate& preMain; const char* type16; @@ -4687,10 +4656,10 @@ void addGraphics16BitStorageInputOutputInt16To16Group (tcu::TestCaseGroup* testG Case cases[] = { - {"scalar_sint", scalarIfOpFunc, scalarPreMain, "i16", "1", 4, 1}, - {"scalar_uint", scalarIfOpFunc, scalarPreMain, "u16", "0", 4, 1}, - {"vector_sint", vecIfOpFunc, vecPreMain, "v4i16", "1", 4 * 4, 4}, - {"vector_uint", vecIfOpFunc, vecPreMain, "v4u16", "0", 4 * 4, 4}, + {"scalar_sint", scalarIfOpCall, scalarIfOpFunc, scalarPreMain, "i16", "1", 4, 1}, + {"scalar_uint", scalarIfOpCall, scalarIfOpFunc, scalarPreMain, "u16", "0", 4, 1}, + {"vector_sint", vecIfOpCall, vecIfOpFunc, vecPreMain, "v4i16", "1", 4 * 4, 4}, + {"vector_uint", vecIfOpCall, vecIfOpFunc, vecPreMain, "v4u16", "0", 4 * 4, 4}, }; for (deUint32 caseIdx = 0; caseIdx < DE_LENGTH_OF_ARRAY(cases); ++caseIdx) @@ -4701,6 +4670,7 @@ void addGraphics16BitStorageInputOutputInt16To16Group (tcu::TestCaseGroup* testG specs["signed"] = cases[caseIdx].sign; fragments["pre_main"] = cases[caseIdx].preMain.specialize(specs); + fragments["interface_op_call"] = cases[caseIdx].interfaceOpCall.specialize(specs); fragments["interface_op_func"] = cases[caseIdx].interfaceOpFunc.specialize(specs); fragments["input_type"] = cases[caseIdx].type16; fragments["output_type"] = cases[caseIdx].type16; @@ -6732,12 +6702,10 @@ void addGraphics16BitStorageInputOutputFloat16To64Group (tcu::TestCaseGroup* tes float64Data.push_back(deFloat16To64(float16Data[numIdx])); extensions.push_back("VK_KHR_16bit_storage"); - extensions.push_back("VK_KHR_shader_float16_int8"); fragments["capability"] = "OpCapability StorageInputOutput16\n" - "OpCapability Float64\n" - "OpCapability Float16\n"; + "OpCapability Float64\n"; fragments["extension"] = "OpExtension \"SPV_KHR_16bit_storage\"\n"; getDefaultColors(defaultColors); @@ -6745,6 +6713,7 @@ void addGraphics16BitStorageInputOutputFloat16To64Group (tcu::TestCaseGroup* tes struct Case { const char* name; + const char* interfaceOpCall; const char* interfaceOpFunc; const char* preMain; const char* inputType; @@ -6758,12 +6727,8 @@ void addGraphics16BitStorageInputOutputFloat16To64Group (tcu::TestCaseGroup* tes { // Scalar cases "scalar", - "%interface_op_func = OpFunction %f64 None %f64_f16_function\n" - " %io_param1 = OpFunctionParameter %f16\n" - " %entry = OpLabel\n" - " %ret = OpFConvert %f64 %io_param1\n" - " OpReturnValue %ret\n" - " OpFunctionEnd\n", + "OpFConvert %f64", + "", " %f16 = OpTypeFloat 16\n" " %f64 = OpTypeFloat 64\n" @@ -6784,12 +6749,8 @@ void addGraphics16BitStorageInputOutputFloat16To64Group (tcu::TestCaseGroup* tes { // Vector cases "vector", - "%interface_op_func = OpFunction %v2f64 None %v2f64_v2f16_function\n" - " %io_param1 = OpFunctionParameter %v2f16\n" - " %entry = OpLabel\n" - " %ret = OpFConvert %v2f64 %io_param1\n" - " OpReturnValue %ret\n" - " OpFunctionEnd\n", + "OpFConvert %v2f64", + "", " %f16 = OpTypeFloat 16\n" " %v2f16 = OpTypeVector %f16 2\n" @@ -6817,10 +6778,10 @@ void addGraphics16BitStorageInputOutputFloat16To64Group (tcu::TestCaseGroup* tes requiredFeatures.coreFeatures.shaderFloat64 = DE_TRUE; requiredFeatures.ext16BitStorage = EXT16BITSTORAGEFEATURES_INPUT_OUTPUT; - requiredFeatures.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; for (deUint32 caseIdx = 0; caseIdx < DE_LENGTH_OF_ARRAY(cases); ++caseIdx) { + fragments["interface_op_call"] = cases[caseIdx].interfaceOpCall; fragments["interface_op_func"] = cases[caseIdx].interfaceOpFunc; fragments["pre_main"] = cases[caseIdx].preMain; @@ -6856,8 +6817,7 @@ void addGraphics16BitStorageUniformFloat16To64Group (tcu::TestCaseGroup* testGro const deUint32 numDataPoints = 256; RGBA defaultColors[4]; const StringTemplate capabilities ("OpCapability ${cap}\n" - "OpCapability Float64\n" - "OpCapability Float16\n"); + "OpCapability Float64\n"); vector float16Data = getFloat16s(rnd, numDataPoints); struct ConstantIndex @@ -6875,7 +6835,6 @@ void addGraphics16BitStorageUniformFloat16To64Group (tcu::TestCaseGroup* testGro }; extensions.push_back("VK_KHR_16bit_storage"); - extensions.push_back("VK_KHR_shader_float16_int8"); fragments["extension"] = "OpExtension \"SPV_KHR_16bit_storage\""; @@ -6988,7 +6947,6 @@ void addGraphics16BitStorageUniformFloat16To64Group (tcu::TestCaseGroup* testGro VulkanFeatures features = get16BitStorageFeatures(CAPABILITIES[capIdx].name); features.coreFeatures.shaderFloat64 = DE_TRUE; - features.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, testGroup, features); } @@ -7110,7 +7068,6 @@ void addGraphics16BitStorageUniformFloat16To64Group (tcu::TestCaseGroup* testGro VulkanFeatures features = get16BitStorageFeatures(CAPABILITIES[capIdx].name); features.coreFeatures.shaderFloat64 = DE_TRUE; - features.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, testGroup, features); } @@ -7228,7 +7185,6 @@ void addGraphics16BitStorageUniformFloat16To64Group (tcu::TestCaseGroup* testGro VulkanFeatures features = get16BitStorageFeatures(CAPABILITIES[capIdx].name); features.coreFeatures.shaderFloat64 = DE_TRUE; - features.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, testGroup, features); } @@ -7253,16 +7209,13 @@ void addGraphics16BitStoragePushConstantFloat16To64Group (tcu::TestCaseGroup* te float64Data.push_back(deFloat16To64(float16Data[numIdx])); extensions.push_back("VK_KHR_16bit_storage"); - extensions.push_back("VK_KHR_shader_float16_int8"); requiredFeatures.coreFeatures.shaderFloat64 = DE_TRUE; requiredFeatures.ext16BitStorage = EXT16BITSTORAGEFEATURES_PUSH_CONSTANT; - requiredFeatures.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; fragments["capability"] = "OpCapability StoragePushConstant16\n" - "OpCapability Float64\n" - "OpCapability Float16\n"; + "OpCapability Float64\n"; fragments["extension"] = "OpExtension \"SPV_KHR_16bit_storage\""; @@ -7457,7 +7410,6 @@ void addCompute16bitStorageUniform64To16Group (tcu::TestCaseGroup* group) "OpCapability Shader\n" "OpCapability ${capability}\n" "OpCapability Float64\n" - "OpCapability Float16\n" "OpExtension \"SPV_KHR_16bit_storage\"\n" "OpMemoryModel Logical GLSL450\n" "OpEntryPoint GLCompute %main \"main\" %id\n" @@ -7638,11 +7590,9 @@ void addCompute16bitStorageUniform64To16Group (tcu::TestCaseGroup* group) spec.outputs.push_back(BufferSp(new Float16Buffer(float16DummyData))); spec.extensions.push_back("VK_KHR_16bit_storage"); - spec.extensions.push_back("VK_KHR_shader_float16_int8"); spec.requestedVulkanFeatures = get16BitStorageFeatures(CAPABILITIES[capIdx].name); spec.requestedVulkanFeatures.coreFeatures.shaderFloat64 = VK_TRUE; - spec.requestedVulkanFeatures.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; group->addChild(new SpvAsmComputeShaderCase(testCtx, testName.c_str(), testName.c_str(), spec)); } @@ -7660,13 +7610,11 @@ void addGraphics16BitStorageUniformFloat64To16Group (tcu::TestCaseGroup* testGro vector float64Data = getFloat64s(rnd, numDataPoints); vector float16DummyData (numDataPoints, 0); const StringTemplate capabilities ("OpCapability Float64\n" - "OpCapability Float16\n" "OpCapability ${cap}\n"); // We use a custom verifyIO to check the result via computing directly from inputs; the contents in outputs do not matter. resources.outputs.push_back(Resource(BufferSp(new Float16Buffer(float16DummyData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)); extensions.push_back("VK_KHR_16bit_storage"); - extensions.push_back("VK_KHR_shader_float16_int8"); fragments["extension"] = "OpExtension \"SPV_KHR_16bit_storage\""; @@ -7773,7 +7721,6 @@ void addGraphics16BitStorageUniformFloat64To16Group (tcu::TestCaseGroup* testGro features = get16BitStorageFeatures(CAPABILITIES[capIdx].name); features.coreFeatures.shaderFloat64 = DE_TRUE; - features.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, testGroup, features); @@ -7874,7 +7821,6 @@ void addGraphics16BitStorageUniformFloat64To16Group (tcu::TestCaseGroup* testGro features = get16BitStorageFeatures(CAPABILITIES[capIdx].name); features.coreFeatures.shaderFloat64 = DE_TRUE; - features.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, testGroup, features); } @@ -7994,7 +7940,6 @@ void addGraphics16BitStorageUniformFloat64To16Group (tcu::TestCaseGroup* testGro features = get16BitStorageFeatures(CAPABILITIES[capIdx].name); features.coreFeatures.shaderFloat64 = DE_TRUE; - features.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, testGroup, features); } @@ -8011,11 +7956,9 @@ void addGraphics16BitStorageInputOutputFloat64To16Group (tcu::TestCaseGroup* tes vector float64Data = getFloat64s(rnd, numDataPoints); extensions.push_back("VK_KHR_16bit_storage"); - extensions.push_back("VK_KHR_shader_float16_int8"); fragments["capability"] = "OpCapability StorageInputOutput16\n" - "OpCapability Float16\n" "OpCapability Float64\n"; fragments["extension"] = "OpExtension \"SPV_KHR_16bit_storage\"\n"; @@ -8047,6 +7990,7 @@ void addGraphics16BitStorageInputOutputFloat64To16Group (tcu::TestCaseGroup* tes struct Case { const char* name; + const char* interfaceOpCall; const char* interfaceOpFunc; const char* postInterfaceOp; const char* postInterfaceOpGeom; @@ -8063,11 +8007,9 @@ void addGraphics16BitStorageInputOutputFloat64To16Group (tcu::TestCaseGroup* tes { // Scalar cases "scalar", - "%interface_op_func = OpFunction %f16 None %f16_f64_function\n" - " %io_param1 = OpFunctionParameter %f64\n" - " %entry = OpLabel\n" - " OpReturnValue %f16_0\n" - " OpFunctionEnd\n", + "OpFConvert %f16", + + "", " %ret0 = OpFConvert %f16 %IF_input_val\n" " OpStore %IF_output %ret0\n", @@ -8090,8 +8032,7 @@ void addGraphics16BitStorageInputOutputFloat64To16Group (tcu::TestCaseGroup* tes "%f16_f64_function = OpTypeFunction %f16 %f64\n" " %a3f64 = OpTypeArray %f64 %c_i32_3\n" " %ip_a3f64 = OpTypePointer Input %a3f64\n" - " %ip_f64 = OpTypePointer Input %f64\n" - " %f16_0 = OpConstant %f16 0\n", + " %ip_f64 = OpTypePointer Input %f64\n", "f64", "f16", @@ -8101,11 +8042,9 @@ void addGraphics16BitStorageInputOutputFloat64To16Group (tcu::TestCaseGroup* tes { // Vector cases "vector", - "%interface_op_func = OpFunction %v2f16 None %v2f16_v2f64_function\n" - " %io_param1 = OpFunctionParameter %v2f64\n" - " %entry = OpLabel\n" - " OpReturnValue %v2f16_0\n" - " OpFunctionEnd\n", + "OpFConvert %v2f16", + + "", " %ret0 = OpFConvert %v2f16 %IF_input_val\n" " OpStore %IF_output %ret0\n", @@ -8130,9 +8069,7 @@ void addGraphics16BitStorageInputOutputFloat64To16Group (tcu::TestCaseGroup* tes "%v2f16_v2f64_function = OpTypeFunction %v2f16 %v2f64\n" " %a3v2f64 = OpTypeArray %v2f64 %c_i32_3\n" " %ip_a3v2f64 = OpTypePointer Input %a3v2f64\n" - " %ip_v2f64 = OpTypePointer Input %v2f64\n" - " %f16_0 = OpConstant %f16 0\n" - " %v2f16_0 = OpConstantComposite %v2f16 %f16_0 %f16_0\n", + " %ip_v2f64 = OpTypePointer Input %v2f64\n", "v2f64", "v2f16", @@ -8145,12 +8082,12 @@ void addGraphics16BitStorageInputOutputFloat64To16Group (tcu::TestCaseGroup* tes requiredFeatures.coreFeatures.shaderFloat64 = DE_TRUE; requiredFeatures.ext16BitStorage = EXT16BITSTORAGEFEATURES_INPUT_OUTPUT; - requiredFeatures.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; for (deUint32 caseIdx = 0; caseIdx < DE_LENGTH_OF_ARRAY(cases); ++caseIdx) for (deUint32 rndModeIdx = 0; rndModeIdx < DE_LENGTH_OF_ARRAY(rndModes); ++rndModeIdx) { fragments["interface_op_func"] = cases[caseIdx].interfaceOpFunc; + fragments["interface_op_call"] = cases[caseIdx].interfaceOpCall; fragments["post_interface_op_frag"] = cases[caseIdx].postInterfaceOp; fragments["post_interface_op_vert"] = cases[caseIdx].postInterfaceOp; fragments["post_interface_op_geom"] = cases[caseIdx].postInterfaceOpGeom; @@ -8197,7 +8134,6 @@ void addCompute16bitStorageUniform16To64Group (tcu::TestCaseGroup* group) const StringTemplate shaderTemplate ( "OpCapability Shader\n" "OpCapability Float64\n" - "OpCapability Float16\n" "OpCapability ${capability}\n" "OpExtension \"SPV_KHR_16bit_storage\"\n" "OpMemoryModel Logical GLSL450\n" @@ -8412,11 +8348,9 @@ void addCompute16bitStorageUniform16To64Group (tcu::TestCaseGroup* group) spec.outputs.push_back(Resource(BufferSp(new Float64Buffer(cTypes[tyIdx].useConstantIndex ? float64DataConstIdx : float64Data)))); spec.extensions.push_back("VK_KHR_16bit_storage"); - spec.extensions.push_back("VK_KHR_shader_float16_int8"); spec.requestedVulkanFeatures = get16BitStorageFeatures(CAPABILITIES[capIdx].name); spec.requestedVulkanFeatures.coreFeatures.shaderFloat64 = VK_TRUE; - spec.requestedVulkanFeatures.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; group->addChild(new SpvAsmComputeShaderCase(testCtx, testName.c_str(), testName.c_str(), spec)); } @@ -8433,7 +8367,6 @@ void addCompute16bitStoragePushConstant16To64Group (tcu::TestCaseGroup* group) "OpCapability Shader\n" "OpCapability StoragePushConstant16\n" "OpCapability Float64\n" - "OpCapability Float16\n" "OpExtension \"SPV_KHR_16bit_storage\"\n" "OpMemoryModel Logical GLSL450\n" "OpEntryPoint GLCompute %main \"main\" %id\n" @@ -8581,11 +8514,9 @@ void addCompute16bitStoragePushConstant16To64Group (tcu::TestCaseGroup* group) spec.outputs.push_back(BufferSp(new Float64Buffer(float64Data))); spec.extensions.push_back("VK_KHR_16bit_storage"); - spec.extensions.push_back("VK_KHR_shader_float16_int8"); spec.requestedVulkanFeatures.coreFeatures.shaderFloat64 = VK_TRUE; spec.requestedVulkanFeatures.ext16BitStorage = EXT16BITSTORAGEFEATURES_PUSH_CONSTANT; - spec.requestedVulkanFeatures.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; group->addChild(new SpvAsmComputeShaderCase(testCtx, testName.c_str(), testName.c_str(), spec)); } diff --git a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp index ae8a41f..7810c40 100644 --- a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp +++ b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp @@ -1008,12 +1008,8 @@ map passthruInterface (const IFDataType& data_type) map fragments = passthruFragments(); const string functype = string("%") + var_type + "_" + var_type + "_function"; - fragments["interface_op_func"] = - string("%interface_op_func = OpFunction %") + var_type + " None " + functype + "\n" - " %io_param1 = OpFunctionParameter %" + var_type + "\n" - " %IF_label = OpLabel\n" - " OpReturnValue %io_param1\n" - " OpFunctionEnd\n"; + fragments["interface_op_call"] = "OpCopyObject %" + var_type; + fragments["interface_op_func"] = ""; fragments["input_type"] = var_type; fragments["output_type"] = var_type; fragments["pre_main"] = ""; @@ -1087,7 +1083,7 @@ map fillInterfacePlaceholderVert (void) "OpDecorate %IF_output Location 2\n"; fragments["IF_carryforward"] = "%IF_input_val = OpLoad %${input_type} %IF_input\n" - " %IF_result = OpFunctionCall %${output_type} %interface_op_func %IF_input_val\n" + " %IF_result = ${interface_op_call} %IF_input_val\n" " OpStore %IF_output %IF_result\n"; // Make sure the rest still need to be instantialized. @@ -1098,6 +1094,7 @@ map fillInterfacePlaceholderVert (void) fragments["decoration"] = "${decoration:opt}"; fragments["pre_main"] = "${pre_main:opt}"; fragments["testfun"] = "${testfun}"; + fragments["interface_op_call"] = "${interface_op_call}"; fragments["interface_op_func"] = "${interface_op_func}"; fragments["post_interface_op_vert"] = "${post_interface_op_vert:opt}"; @@ -1124,7 +1121,7 @@ map fillInterfacePlaceholderFrag (void) "OpDecorate %IF_output Location 1\n"; // Fragment shader should write to location #1. fragments["IF_carryforward"] = "%IF_input_val = OpLoad %${input_type} %IF_input\n" - " %IF_result = OpFunctionCall %${output_type} %interface_op_func %IF_input_val\n" + " %IF_result = ${interface_op_call} %IF_input_val\n" " OpStore %IF_output %IF_result\n"; // Make sure the rest still need to be instantialized. @@ -1135,6 +1132,7 @@ map fillInterfacePlaceholderFrag (void) fragments["decoration"] = "${decoration:opt}"; fragments["pre_main"] = "${pre_main:opt}"; fragments["testfun"] = "${testfun}"; + fragments["interface_op_call"] = "${interface_op_call}"; fragments["interface_op_func"] = "${interface_op_func}"; fragments["post_interface_op_frag"] = "${post_interface_op_frag:opt}"; @@ -1169,9 +1167,9 @@ map fillInterfacePlaceholderTessCtrl (void) "%IF_input_val0 = OpLoad %${input_type} %IF_input_ptr0\n" "%IF_input_val1 = OpLoad %${input_type} %IF_input_ptr1\n" "%IF_input_val2 = OpLoad %${input_type} %IF_input_ptr2\n" - "%IF_input_res0 = OpFunctionCall %${output_type} %interface_op_func %IF_input_val0\n" - "%IF_input_res1 = OpFunctionCall %${output_type} %interface_op_func %IF_input_val1\n" - "%IF_input_res2 = OpFunctionCall %${output_type} %interface_op_func %IF_input_val2\n" + "%IF_input_res0 = ${interface_op_call} %IF_input_val0\n" + "%IF_input_res1 = ${interface_op_call} %IF_input_val1\n" + "%IF_input_res2 = ${interface_op_call} %IF_input_val2\n" "OpStore %IF_output_ptr0 %IF_input_res0\n" "OpStore %IF_output_ptr1 %IF_input_res1\n" "OpStore %IF_output_ptr2 %IF_input_res2\n"; @@ -1185,6 +1183,7 @@ map fillInterfacePlaceholderTessCtrl (void) fragments["decoration_tessc"] = "${decoration_tessc:opt}"; fragments["pre_main"] = "${pre_main:opt}"; fragments["testfun"] = "${testfun}"; + fragments["interface_op_call"] = "${interface_op_call}"; fragments["interface_op_func"] = "${interface_op_func}"; fragments["post_interface_op_tessc"] = "${post_interface_op_tessc:opt}"; @@ -1213,7 +1212,7 @@ map fillInterfacePlaceholderTessEvalGeom (void) // Only get the first value since all three values are the same anyway. " %IF_input_ptr0 = OpAccessChain %ip_${input_type} %IF_input %c_i32_0\n" " %IF_input_val0 = OpLoad %${input_type} %IF_input_ptr0\n" - " %IF_input_res0 = OpFunctionCall %${output_type} %interface_op_func %IF_input_val0\n" + " %IF_input_res0 = ${interface_op_call} %IF_input_val0\n" "OpStore %IF_output %IF_input_res0\n"; // Make sure the rest still need to be instantialized. @@ -1224,6 +1223,7 @@ map fillInterfacePlaceholderTessEvalGeom (void) fragments["decoration"] = "${decoration:opt}"; fragments["pre_main"] = "${pre_main:opt}"; fragments["testfun"] = "${testfun}"; + fragments["interface_op_call"] = "${interface_op_call}"; fragments["interface_op_func"] = "${interface_op_func}"; fragments["post_interface_op_tesse"] = "${post_interface_op_tesse:opt}"; fragments["post_interface_op_geom"] = "${post_interface_op_geom:opt}"; diff --git a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmIndexingTests.cpp b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmIndexingTests.cpp index c7661be..fd1a4b0 100644 --- a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmIndexingTests.cpp +++ b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmIndexingTests.cpp @@ -531,6 +531,7 @@ void addGraphicsOutputComponentIndexingTests (tcu::TestCaseGroup* testGroup) " %ip_a3u32 = OpTypePointer Input %a3u32\n" "%v4f32_u32_function = OpTypeFunction %v4f32 %u32\n"; + fragments["interface_op_call"] = "OpFunctionCall %v4f32 %interface_op_func"; fragments["interface_op_func"] = "%interface_op_func = OpFunction %v4f32 None %v4f32_u32_function\n" " %io_param1 = OpFunctionParameter %u32\n" -- 2.7.4