mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 08:19:02 +00:00
New spirv_new test case OpSpecConstant (#719)
* New spirv_new test case OpSpecConstant OpSpecConstantTrue OpSpecConstantfalse * Register test case with minimal OpenCL version * Specialization constant - add files uint/int cases * Specialization constants - fix second build program * Fix changes clang format. * spirv_new - Make functions visible outside of main * Fix clang format issues * Fix int/uint 32 bit cases * Fix minimal required version for test_op_spec_constant * Remove not needed OpName. Update binaries * Fix code format * Remove op_spec_constant_int cases in spirv_new tests * op_spec_constant - add simplified spirv files * no redundant OpUConvert OpSConvert * no redundant OpName * instead of buffers scalar variable * op_spec_constant - refactor to address review issues * avoid using program that has already kernel program attached * remove not used buffer * Simplified test case - instead of buffers use scalar variable * spirv_new - remove spec_const duplicated cases (singed versions) * spirv_new - set clSetProgramSpecializationConstant before clBuildProgram * Test spirv_new - fix spec const after rebase * Test spirv_new - fix spec const set min version for bool type tests
This commit is contained in:
committed by
GitHub
parent
afa2fcca96
commit
41cd9c6d98
@@ -1,14 +1,16 @@
|
||||
/******************************************************************
|
||||
Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved.
|
||||
|
||||
This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc.
|
||||
This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed in whole or in part to
|
||||
third parties, and may not be reproduced, republished, distributed, transmitted, displayed,
|
||||
broadcast or otherwise exploited in any manner without the express prior written permission
|
||||
of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce,
|
||||
disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe,
|
||||
in whole or in part other than under the terms of the Khronos Adopters Agreement
|
||||
or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient.
|
||||
This code is protected by copyright laws and contains material proprietary to
|
||||
the Khronos Group, Inc. This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not
|
||||
be disclosed in whole or in part to third parties, and may not be reproduced,
|
||||
republished, distributed, transmitted, displayed, broadcast or otherwise
|
||||
exploited in any manner without the express prior written permission of Khronos
|
||||
Group. The receipt or possession of this code does not convey any rights to
|
||||
reproduce, disclose, or distribute its contents, or to manufacture, use, or sell
|
||||
anything that it may describe, in whole or in part other than under the terms of
|
||||
the Khronos Adopters Agreement or Khronos Conformance Test Source License
|
||||
Agreement as executed between Khronos and the recipient.
|
||||
******************************************************************/
|
||||
|
||||
#pragma once
|
||||
@@ -24,16 +26,17 @@ or Khronos Conformance Test Source License Agreement as executed between Khronos
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define SPIRV_CHECK_ERROR(err, fmt, ...) do { \
|
||||
if (err == CL_SUCCESS) break; \
|
||||
log_error("%s(%d): Error %d\n" fmt "\n", \
|
||||
__FILE__, __LINE__, err, ##__VA_ARGS__); \
|
||||
return -1; \
|
||||
} while(0)
|
||||
#define SPIRV_CHECK_ERROR(err, fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
if (err == CL_SUCCESS) break; \
|
||||
log_error("%s(%d): Error %d\n" fmt "\n", __FILE__, __LINE__, err, \
|
||||
##__VA_ARGS__); \
|
||||
return -1; \
|
||||
} while (0)
|
||||
|
||||
|
||||
class baseTestClass
|
||||
{
|
||||
class baseTestClass {
|
||||
public:
|
||||
baseTestClass() {}
|
||||
virtual basefn getFunction() = 0;
|
||||
@@ -45,54 +48,53 @@ private:
|
||||
std::vector<test_definition> testDefinitions;
|
||||
|
||||
public:
|
||||
|
||||
static spirvTestsRegistry& getInstance();
|
||||
static spirvTestsRegistry &getInstance();
|
||||
|
||||
test_definition *getTestDefinitions();
|
||||
|
||||
size_t getNumTests();
|
||||
|
||||
void addTestClass(baseTestClass *test, const char *testName);
|
||||
void addTestClass(baseTestClass *test, const char *testName,
|
||||
Version version);
|
||||
spirvTestsRegistry() {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
T* createAndRegister(const char *name)
|
||||
template <typename T> T *createAndRegister(const char *name, Version version)
|
||||
{
|
||||
T *testClass = new T();
|
||||
spirvTestsRegistry::getInstance().addTestClass((baseTestClass *)testClass, name);
|
||||
spirvTestsRegistry::getInstance().addTestClass((baseTestClass *)testClass,
|
||||
name, version);
|
||||
return testClass;
|
||||
}
|
||||
|
||||
#define TEST_SPIRV_FUNC(name) \
|
||||
extern int test_##name(cl_device_id deviceID, \
|
||||
cl_context context, \
|
||||
cl_command_queue queue, \
|
||||
int num_elements); \
|
||||
class test_##name##_class : public baseTestClass \
|
||||
{ \
|
||||
private: \
|
||||
basefn fn; \
|
||||
\
|
||||
public: \
|
||||
test_##name##_class() : fn(test_##name) \
|
||||
{ \
|
||||
} \
|
||||
basefn getFunction() \
|
||||
{ \
|
||||
return fn; \
|
||||
} \
|
||||
}; \
|
||||
test_##name##_class *var_##name = \
|
||||
createAndRegister<test_##name##_class>(#name); \
|
||||
int test_##name(cl_device_id deviceID, \
|
||||
cl_context context, \
|
||||
cl_command_queue queue, \
|
||||
int num_elements)
|
||||
#define TEST_SPIRV_FUNC_VERSION(name, version) \
|
||||
extern int test_##name(cl_device_id deviceID, cl_context context, \
|
||||
cl_command_queue queue, int num_elements); \
|
||||
class test_##name##_class : public baseTestClass { \
|
||||
private: \
|
||||
basefn fn; \
|
||||
\
|
||||
public: \
|
||||
test_##name##_class(): fn(test_##name) {} \
|
||||
basefn getFunction() { return fn; } \
|
||||
}; \
|
||||
test_##name##_class *var_##name = \
|
||||
createAndRegister<test_##name##_class>(#name, version); \
|
||||
int test_##name(cl_device_id deviceID, cl_context context, \
|
||||
cl_command_queue queue, int num_elements)
|
||||
|
||||
std::vector<unsigned char> readSPIRV(const char *file_name);
|
||||
#define TEST_SPIRV_FUNC(name) TEST_SPIRV_FUNC_VERSION(name, Version(2, 1))
|
||||
|
||||
int get_program_with_il(clProgramWrapper &prog,
|
||||
const cl_device_id deviceID,
|
||||
const cl_context context,
|
||||
const char *prog_name);
|
||||
struct spec_const
|
||||
{
|
||||
spec_const(cl_int id = 0, size_t sizet = 0, const void *value = NULL)
|
||||
: spec_id(id), spec_size(sizet), spec_value(value){};
|
||||
cl_int spec_id;
|
||||
size_t spec_size;
|
||||
const void *spec_value;
|
||||
};
|
||||
|
||||
int get_program_with_il(clProgramWrapper &prog, const cl_device_id deviceID,
|
||||
const cl_context context, const char *prog_name,
|
||||
spec_const spec_const_def = spec_const());
|
||||
std::vector<unsigned char> readSPIRV(const char *file_name);
|
||||
Reference in New Issue
Block a user