mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-23 12:10:06 +00:00
Update OpenCL capabilities validation (#3149)
* spirv-val: Pipes are no longer required for OpenCL 1.2 EP This was removed from the OpenCL SPIR-V Environment Specification via https://github.com/KhronosGroup/OpenCL-Docs/pull/56. * spirv-val: Sort headers according to clang-format * spirv-val: Groups capability is required since OpenCL 2.0
This commit is contained in:
parent
b25ee93c2b
commit
2796840d20
@ -14,8 +14,6 @@
|
||||
|
||||
// Validates OpCapability instruction.
|
||||
|
||||
#include "source/val/validate.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
@ -23,6 +21,7 @@
|
||||
#include "source/diagnostic.h"
|
||||
#include "source/opcode.h"
|
||||
#include "source/val/instruction.h"
|
||||
#include "source/val/validate.h"
|
||||
#include "source/val/validation_state.h"
|
||||
|
||||
namespace spvtools {
|
||||
@ -166,7 +165,6 @@ bool IsSupportGuaranteedOpenCL_1_2(uint32_t capability, bool embedded_profile) {
|
||||
switch (capability) {
|
||||
case SpvCapabilityAddresses:
|
||||
case SpvCapabilityFloat16Buffer:
|
||||
case SpvCapabilityGroups:
|
||||
case SpvCapabilityInt16:
|
||||
case SpvCapabilityInt8:
|
||||
case SpvCapabilityKernel:
|
||||
@ -175,8 +173,6 @@ bool IsSupportGuaranteedOpenCL_1_2(uint32_t capability, bool embedded_profile) {
|
||||
return true;
|
||||
case SpvCapabilityInt64:
|
||||
return !embedded_profile;
|
||||
case SpvCapabilityPipes:
|
||||
return embedded_profile;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -187,6 +183,7 @@ bool IsSupportGuaranteedOpenCL_2_0(uint32_t capability, bool embedded_profile) {
|
||||
switch (capability) {
|
||||
case SpvCapabilityDeviceEnqueue:
|
||||
case SpvCapabilityGenericPointer:
|
||||
case SpvCapabilityGroups:
|
||||
case SpvCapabilityPipes:
|
||||
return true;
|
||||
}
|
||||
|
@ -2288,11 +2288,30 @@ OpMemoryModel Physical64 OpenCL
|
||||
"Embedded Profile"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateCapability, OpenCL12EmbeddedNoLongerEnabledByCapability) {
|
||||
const std::string spirv = R"(
|
||||
OpCapability Kernel
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Pipes
|
||||
OpMemoryModel Physical64 OpenCL
|
||||
%u32 = OpTypeInt 32 0
|
||||
)" + std::string(kVoidFVoid);
|
||||
|
||||
CompileSuccessfully(spirv, SPV_ENV_OPENCL_EMBEDDED_1_2);
|
||||
EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY,
|
||||
ValidateInstructions(SPV_ENV_OPENCL_EMBEDDED_1_2));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
HasSubstr("Capability Pipes is not allowed by OpenCL 1.2 "
|
||||
"Embedded Profile"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateCapability, OpenCL20FullCapability) {
|
||||
const std::string spirv = R"(
|
||||
OpCapability Kernel
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Groups
|
||||
OpCapability Pipes
|
||||
OpMemoryModel Physical64 OpenCL
|
||||
%u32 = OpTypeInt 32 0
|
||||
|
Loading…
Reference in New Issue
Block a user