1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
|
/*
* Copyright (c) 2023-2025 The Khronos Group Inc.
* Copyright (c) 2023-2025 Valve Corporation
* Copyright (c) 2023-2025 LunarG, Inc.
* Copyright (c) 2023-2025 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
#include "../framework/layer_validation_tests.h"
#include "../framework/pipeline_helper.h"
class NegativeShaderCooperativeVector : public VkLayerTest {
public:
void SetupConvertCooperativeVectorMatrixNVTest();
void SetupCmdConvertCooperativeVectorMatrixNVTest();
void RunSPIRVTest(const char *expected_error, const char *shaderBody, uint32_t count = 1);
VkConvertCooperativeVectorMatrixInfoNV info;
size_t dstSize;
uint8_t src[16 * 32 * 4], dst[16 * 32 * 4];
vkt::Buffer src_buffer, dst_buffer;
};
void NegativeShaderCooperativeVector::SetupConvertCooperativeVectorMatrixNVTest() {
SetTargetApiVersion(VK_API_VERSION_1_3);
AddRequiredExtensions(VK_NV_COOPERATIVE_VECTOR_EXTENSION_NAME);
AddRequiredExtensions(VK_EXT_SHADER_REPLICATED_COMPOSITES_EXTENSION_NAME);
AddRequiredExtensions(VK_EXT_SHADER_FLOAT8_EXTENSION_NAME);
AddRequiredFeature(vkt::Feature::vulkanMemoryModel);
AddRequiredFeature(vkt::Feature::storageBuffer8BitAccess);
AddRequiredFeature(vkt::Feature::shaderInt8);
AddRequiredFeature(vkt::Feature::shaderFloat16);
AddRequiredFeature(vkt::Feature::shaderFloat64);
AddRequiredFeature(vkt::Feature::shaderReplicatedComposites);
AddRequiredFeature(vkt::Feature::bufferDeviceAddress);
AddRequiredFeature(vkt::Feature::cooperativeVector);
AddRequiredFeature(vkt::Feature::cooperativeVectorTraining);
RETURN_IF_SKIP(Init());
// initialize info to reasonable values
info = vku::InitStructHelper();
dstSize = 16 * 32 * 2;
info.srcSize = 16 * 32 * 2;
info.srcData.hostAddress = nullptr;
info.pDstSize = &dstSize;
info.dstData.hostAddress = nullptr;
info.srcComponentType = VK_COMPONENT_TYPE_FLOAT16_KHR;
info.dstComponentType = VK_COMPONENT_TYPE_FLOAT16_KHR;
info.numRows = 16;
info.numColumns = 32;
info.srcLayout = VK_COOPERATIVE_VECTOR_MATRIX_LAYOUT_ROW_MAJOR_NV;
info.srcStride = 64;
info.dstLayout = VK_COOPERATIVE_VECTOR_MATRIX_LAYOUT_ROW_MAJOR_NV;
info.dstStride = 64;
info.srcData.hostAddress = src;
info.dstData.hostAddress = dst;
}
void NegativeShaderCooperativeVector::SetupCmdConvertCooperativeVectorMatrixNVTest() {
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
src_buffer = vkt::Buffer(*m_device, 16 * 32 * 4, VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, vkt::device_address);
dst_buffer = vkt::Buffer(*m_device, 16 * 32 * 4, VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, vkt::device_address);
info.srcData.deviceAddress = src_buffer.Address();
info.dstData.deviceAddress = dst_buffer.Address();
m_command_buffer.Begin();
}
TEST_F(NegativeShaderCooperativeVector, HostConvertDstAddressNull) {
TEST_DESCRIPTION("vkConvertCooperativeVectorMatrixNV - dst address should also be null");
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
info.srcData.hostAddress = nullptr;
m_errorMonitor->SetDesiredError("VUID-vkConvertCooperativeVectorMatrixNV-pInfo-10073");
vk::ConvertCooperativeVectorMatrixNV(*m_device, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, HostConvertSrcTooSmall) {
TEST_DESCRIPTION("vkConvertCooperativeVectorMatrixNV - src size is too small");
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
info.srcSize--;
m_errorMonitor->SetDesiredError("VUID-vkConvertCooperativeVectorMatrixNV-pInfo-10074");
vk::ConvertCooperativeVectorMatrixNV(*m_device, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, HostConvertDstTooSmall) {
TEST_DESCRIPTION("vkConvertCooperativeVectorMatrixNV - dst size is too small");
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
dstSize--;
m_errorMonitor->SetDesiredError("VUID-vkConvertCooperativeVectorMatrixNV-pInfo-10075");
vk::ConvertCooperativeVectorMatrixNV(*m_device, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, HostConvertOverlap) {
TEST_DESCRIPTION("vkConvertCooperativeVectorMatrixNV - detect overlapping ranges");
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
info.dstData.hostAddress = &src[info.srcSize - 1];
m_errorMonitor->SetDesiredError("VUID-vkConvertCooperativeVectorMatrixNV-pInfo-10076");
vk::ConvertCooperativeVectorMatrixNV(*m_device, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, HostConvertSrcStrideTooSmall) {
TEST_DESCRIPTION("vkConvertCooperativeVectorMatrixNV - src stride too small");
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
info.srcStride = 62;
m_errorMonitor->SetDesiredError("VUID-VkConvertCooperativeVectorMatrixInfoNV-srcLayout-10077");
vk::ConvertCooperativeVectorMatrixNV(*m_device, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, HostConvertSrcStrideUnaligned) {
TEST_DESCRIPTION("vkConvertCooperativeVectorMatrixNV - src stride unaligned");
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
info.srcStride = 65;
info.srcSize = 65 * 16;
m_errorMonitor->SetDesiredError("VUID-VkConvertCooperativeVectorMatrixInfoNV-srcLayout-10077");
vk::ConvertCooperativeVectorMatrixNV(*m_device, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, HostConvertDstStrideTooSmall) {
TEST_DESCRIPTION("vkConvertCooperativeVectorMatrixNV - dst stride too small");
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
info.dstStride = 62;
m_errorMonitor->SetDesiredError("VUID-VkConvertCooperativeVectorMatrixInfoNV-dstLayout-10078");
vk::ConvertCooperativeVectorMatrixNV(*m_device, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, HostConvertDstStrideUnaligned) {
TEST_DESCRIPTION("vkConvertCooperativeVectorMatrixNV - dst stride unaligned");
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
info.dstStride = 65;
dstSize = 65 * 16;
m_errorMonitor->SetDesiredError("VUID-VkConvertCooperativeVectorMatrixInfoNV-dstLayout-10078");
vk::ConvertCooperativeVectorMatrixNV(*m_device, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, HostConvertSrcComponentUnsupported) {
TEST_DESCRIPTION("vkConvertCooperativeVectorMatrixNV - src component unsupported");
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
info.srcComponentType = VK_COMPONENT_TYPE_SINT32_KHR;
info.srcStride = 32 * 4;
info.srcSize = 16 * 32 * 4;
m_errorMonitor->SetDesiredError("VUID-VkConvertCooperativeVectorMatrixInfoNV-srcComponentType-10081");
vk::ConvertCooperativeVectorMatrixNV(*m_device, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, HostConvertUnsupportedConversion) {
TEST_DESCRIPTION("vkConvertCooperativeVectorMatrixNV - unsupported conversion");
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
info.srcComponentType = VK_COMPONENT_TYPE_FLOAT_E4M3_NV;
info.dstComponentType = VK_COMPONENT_TYPE_FLOAT_E5M2_NV;
info.srcLayout = VK_COOPERATIVE_VECTOR_MATRIX_LAYOUT_INFERENCING_OPTIMAL_NV;
info.dstLayout = VK_COOPERATIVE_VECTOR_MATRIX_LAYOUT_INFERENCING_OPTIMAL_NV;
m_errorMonitor->SetDesiredError("VUID-VkConvertCooperativeVectorMatrixInfoNV-srcComponentType-10081");
vk::ConvertCooperativeVectorMatrixNV(*m_device, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, HostConvertUnsupportedFP8Layout) {
TEST_DESCRIPTION("vkConvertCooperativeVectorMatrixNV - unsupported fp8 layout");
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
info.dstComponentType = VK_COMPONENT_TYPE_FLOAT_E4M3_NV;
m_errorMonitor->SetDesiredError("VUID-VkConvertCooperativeVectorMatrixInfoNV-dstComponentType-10082");
vk::ConvertCooperativeVectorMatrixNV(*m_device, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, HostConvertUnsupportedMatrixType) {
TEST_DESCRIPTION("vkConvertCooperativeVectorMatrixNV - unsupported matrix type");
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
info.srcComponentType = VK_COMPONENT_TYPE_SINT32_KHR;
info.srcStride = 32 * 4;
info.srcSize = 16 * 32 * 4;
info.dstComponentType = VK_COMPONENT_TYPE_SINT32_KHR;
info.dstStride = 32 * 4;
dstSize = 16 * 32 * 4;
m_errorMonitor->SetDesiredError("VUID-VkConvertCooperativeVectorMatrixInfoNV-srcComponentType-10079");
m_errorMonitor->SetDesiredError("VUID-VkConvertCooperativeVectorMatrixInfoNV-dstComponentType-10080");
vk::ConvertCooperativeVectorMatrixNV(*m_device, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, DeviceConvertUnalignedSrcAddress) {
TEST_DESCRIPTION("vkCmdConvertCooperativeVectorMatrixNV - unaligned src address");
RETURN_IF_SKIP(SetupCmdConvertCooperativeVectorMatrixNVTest());
info.srcData.deviceAddress++;
m_errorMonitor->SetDesiredError("VUID-vkCmdConvertCooperativeVectorMatrixNV-pInfo-10084");
vk::CmdConvertCooperativeVectorMatrixNV(m_command_buffer, 1, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, DeviceConvertUnalignedDstAddress) {
TEST_DESCRIPTION("vkCmdConvertCooperativeVectorMatrixNV - unaligned dst address");
RETURN_IF_SKIP(SetupCmdConvertCooperativeVectorMatrixNVTest());
info.dstData.deviceAddress++;
m_errorMonitor->SetDesiredError("VUID-vkCmdConvertCooperativeVectorMatrixNV-pInfo-10085");
vk::CmdConvertCooperativeVectorMatrixNV(m_command_buffer, 1, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, DeviceConvertSrcTooSmall) {
TEST_DESCRIPTION("vkCmdConvertCooperativeVectorMatrixNV - src too small");
RETURN_IF_SKIP(SetupCmdConvertCooperativeVectorMatrixNVTest());
info.srcSize--;
m_errorMonitor->SetDesiredError("VUID-vkCmdConvertCooperativeVectorMatrixNV-pInfo-10086");
vk::CmdConvertCooperativeVectorMatrixNV(m_command_buffer, 1, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, DeviceConvertDstTooSmall) {
TEST_DESCRIPTION("vkCmdConvertCooperativeVectorMatrixNV - dst too small");
RETURN_IF_SKIP(SetupCmdConvertCooperativeVectorMatrixNVTest());
dstSize--;
m_errorMonitor->SetDesiredError("VUID-vkCmdConvertCooperativeVectorMatrixNV-pInfo-10087");
vk::CmdConvertCooperativeVectorMatrixNV(m_command_buffer, 1, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, DeviceConvertOverlap) {
TEST_DESCRIPTION("vkCmdConvertCooperativeVectorMatrixNV - overlapping ranges");
RETURN_IF_SKIP(SetupCmdConvertCooperativeVectorMatrixNVTest());
VkConvertCooperativeVectorMatrixInfoNV infos[2] = {info, info};
infos[1].srcData.deviceAddress += 64;
infos[1].dstData.deviceAddress = infos[0].srcData.deviceAddress + infos[1].srcSize;
m_errorMonitor->SetDesiredError("VUID-vkCmdConvertCooperativeVectorMatrixNV-None-10088");
vk::CmdConvertCooperativeVectorMatrixNV(m_command_buffer, 2, infos);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, DeviceConvertSrcAddressInvalid) {
TEST_DESCRIPTION("vkCmdConvertCooperativeVectorMatrixNV - src not from a buffer");
RETURN_IF_SKIP(SetupCmdConvertCooperativeVectorMatrixNVTest());
info.srcData.deviceAddress = 64;
m_errorMonitor->SetDesiredError("VUID-vkCmdConvertCooperativeVectorMatrixNV-pInfo-10083");
vk::CmdConvertCooperativeVectorMatrixNV(m_command_buffer, 1, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, DeviceConvertDstAddressInvalid) {
TEST_DESCRIPTION("vkCmdConvertCooperativeVectorMatrixNV - dst not from a buffer");
RETURN_IF_SKIP(SetupCmdConvertCooperativeVectorMatrixNVTest());
info.dstData.deviceAddress = 64;
m_errorMonitor->SetDesiredError("VUID-vkCmdConvertCooperativeVectorMatrixNV-pInfo-10083");
vk::CmdConvertCooperativeVectorMatrixNV(m_command_buffer, 1, &info);
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, DeviceConvertUnsupportedMatrixType) {
TEST_DESCRIPTION("vkCmdConvertCooperativeVectorMatrixNV - unsupported matrix type");
RETURN_IF_SKIP(SetupCmdConvertCooperativeVectorMatrixNVTest());
info.srcComponentType = VK_COMPONENT_TYPE_SINT32_KHR;
info.srcStride = 32 * 4;
info.srcSize = 16 * 32 * 4;
info.dstComponentType = VK_COMPONENT_TYPE_SINT32_KHR;
info.dstStride = 32 * 4;
dstSize = 16 * 32 * 4;
m_errorMonitor->SetDesiredError("VUID-VkConvertCooperativeVectorMatrixInfoNV-srcComponentType-10079");
m_errorMonitor->SetDesiredError("VUID-VkConvertCooperativeVectorMatrixInfoNV-dstComponentType-10080");
vk::CmdConvertCooperativeVectorMatrixNV(m_command_buffer, 1, &info);
m_errorMonitor->VerifyFound();
}
void NegativeShaderCooperativeVector::RunSPIRVTest(const char *expected_error, const char *shaderBody, uint32_t count) {
RETURN_IF_SKIP(SetupConvertCooperativeVectorMatrixNVTest());
std::string shader_source = std::string(R"(
#version 450
#extension GL_NV_cooperative_vector : enable
#extension GL_KHR_shader_subgroup_basic : enable
#extension GL_KHR_memory_scope_semantics : enable
#extension GL_EXT_shader_explicit_arithmetic_types : enable
layout(set=0, binding=0) buffer Buf { uint8_t x[]; } b;
shared uint8_t sh[128];
void main() {
)") + std::string(shaderBody) +
std::string(R"(
}
)");
CreateComputePipelineHelper pipe(*this);
pipe.cs_ = VkShaderObj(this, shader_source.c_str(), VK_SHADER_STAGE_COMPUTE_BIT, SPV_ENV_VULKAN_1_3);
pipe.dsl_bindings_ = {{0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}};
m_errorMonitor->SetDesiredError(expected_error, count);
pipe.CreateComputePipeline();
m_errorMonitor->VerifyFound();
}
TEST_F(NegativeShaderCooperativeVector, SPIRVTooManyComponents) {
TEST_DESCRIPTION("Validate Cooperative Vector SPIR-V environment rules.");
RunSPIRVTest("VUID-RuntimeSpirv-maxCooperativeVectorComponents-10094",
R"(
coopvecNV<float16_t, 9999> A = coopvecNV<float16_t, 9999>(0);
)");
}
TEST_F(NegativeShaderCooperativeVector, SPIRVUnsupportedComponentType) {
TEST_DESCRIPTION("Validate Cooperative Vector SPIR-V environment rules.");
RunSPIRVTest("VUID-RuntimeSpirv-OpTypeCooperativeVector-10095",
R"(
coopvecNV<float64_t, 16> A = coopvecNV<float64_t, 16>(0);
)");
}
TEST_F(NegativeShaderCooperativeVector, SPIRVMatMulAddParams) {
TEST_DESCRIPTION("Validate Cooperative Vector SPIR-V environment rules.");
RunSPIRVTest("VUID-RuntimeSpirv-OpCooperativeVectorMatrixMulNV-10089",
R"(
coopvecNV<float16_t, 16> A;
coopvecNV<float16_t, 32> R;
coopVecMatMulAddNV(R, A, gl_ComponentTypeFloat16NV, b.x, 0, gl_ComponentTypeFloat64NV, b.x, 0, gl_ComponentTypeFloat16NV, 32, 16, gl_CooperativeVectorMatrixLayoutInferencingOptimalNV, false, 0);
)");
}
TEST_F(NegativeShaderCooperativeVector, SPIRVMatMulParams) {
TEST_DESCRIPTION("Validate Cooperative Vector SPIR-V environment rules.");
RunSPIRVTest("VUID-RuntimeSpirv-OpCooperativeVectorMatrixMulNV-10089",
R"(
coopvecNV<float16_t, 16> A;
coopvecNV<float16_t, 32> R;
coopVecMatMulNV(R, A, gl_ComponentTypeFloat16NV, b.x, 0, gl_ComponentTypeFloat64NV, 32, 16, gl_CooperativeVectorMatrixLayoutInferencingOptimalNV, false, 0);
)");
}
TEST_F(NegativeShaderCooperativeVector, SPIRVMatMulParamsInt) {
TEST_DESCRIPTION("Validate Cooperative Vector SPIR-V environment rules.");
RunSPIRVTest("VUID-RuntimeSpirv-OpCooperativeVectorMatrixMulNV-10089",
R"(
coopvecNV<int8_t, 16> A;
coopvecNV<uint32_t, 32> R;
coopVecMatMulNV(R, A, gl_ComponentTypeSignedInt8NV, b.x, 0, gl_ComponentTypeSignedInt8NV, 32, 16, gl_CooperativeVectorMatrixLayoutInferencingOptimalNV, false, 0);
)");
}
TEST_F(NegativeShaderCooperativeVector, SPIRVFP8Layout) {
TEST_DESCRIPTION("Validate Cooperative Vector SPIR-V environment rules.");
RunSPIRVTest("VUID-RuntimeSpirv-OpCooperativeVectorMatrixMulNV-10090",
R"(
coopvecNV<float16_t, 16> A;
coopvecNV<float16_t, 32> R;
coopVecMatMulAddNV(R, A, gl_ComponentTypeFloatE4M3NV, b.x, 0, gl_ComponentTypeFloatE4M3NV, b.x, 0, gl_ComponentTypeFloat16NV, 32, 16, gl_CooperativeVectorMatrixLayoutRowMajorNV, false, 0);
)");
}
TEST_F(NegativeShaderCooperativeVector, SPIRVReduceSumType) {
TEST_DESCRIPTION("Validate Cooperative Vector SPIR-V environment rules.");
RunSPIRVTest("VUID-RuntimeSpirv-OpCooperativeVectorReduceSumAccumulateNV-10092",
R"(
coopvecNV<int32_t, 16> A;
coopVecReduceSumAccumulateNV(A, b.x, 0);
)");
}
TEST_F(NegativeShaderCooperativeVector, SPIRVReduceSumStorageClass) {
TEST_DESCRIPTION("Validate Cooperative Vector SPIR-V environment rules.");
RunSPIRVTest("VUID-RuntimeSpirv-OpCooperativeVectorReduceSumAccumulateNV-10092",
R"(
coopvecNV<float16_t, 16> A;
coopVecReduceSumAccumulateNV(A, sh, 0);
)");
}
TEST_F(NegativeShaderCooperativeVector, SPIRVOuterProductType) {
TEST_DESCRIPTION("Validate Cooperative Vector SPIR-V environment rules.");
RunSPIRVTest("VUID-RuntimeSpirv-OpCooperativeVectorOuterProductAccumulateNV-10093",
R"(
coopvecNV<float32_t, 16> A;
coopvecNV<float32_t, 16> B;
coopVecOuterProductAccumulateNV(A, B, b.x, 0, 0, gl_CooperativeVectorMatrixLayoutTrainingOptimalNV, gl_ComponentTypeFloat16NV);
)",
2);
}
TEST_F(NegativeShaderCooperativeVector, SPIRVOuterProductInterpretation) {
TEST_DESCRIPTION("Validate Cooperative Vector SPIR-V environment rules.");
RunSPIRVTest("VUID-RuntimeSpirv-OpCooperativeVectorOuterProductAccumulateNV-10093",
R"(
coopvecNV<float16_t, 16> A;
coopvecNV<float16_t, 16> B;
coopVecOuterProductAccumulateNV(A, B, b.x, 0, 0, gl_CooperativeVectorMatrixLayoutTrainingOptimalNV, gl_ComponentTypeFloat64NV);
)");
}
TEST_F(NegativeShaderCooperativeVector, SPIRVOuterProductLayout) {
TEST_DESCRIPTION("Validate Cooperative Vector SPIR-V environment rules.");
RunSPIRVTest("VUID-RuntimeSpirv-OpCooperativeVectorOuterProductAccumulateNV-10093",
R"(
coopvecNV<float16_t, 16> A;
coopVecOuterProductAccumulateNV(A, A, b.x, 0, 0, gl_CooperativeVectorMatrixLayoutInferencingOptimalNV, gl_ComponentTypeFloat16NV);
)");
}
TEST_F(NegativeShaderCooperativeVector, SPIRVOuterProductStorageClass) {
TEST_DESCRIPTION("Validate Cooperative Vector SPIR-V environment rules.");
RunSPIRVTest("VUID-RuntimeSpirv-OpCooperativeVectorOuterProductAccumulateNV-10093",
R"(
coopvecNV<float16_t, 16> A;
coopVecOuterProductAccumulateNV(A, A, sh, 0, 0, gl_CooperativeVectorMatrixLayoutTrainingOptimalNV, gl_ComponentTypeFloat16NV);
)");
}
|