mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-24 07:59:01 +00:00
Initial open source release of OpenCL 2.1 CTS.
This commit is contained in:
45
test_conformance/spir/CMakeLists.txt
Normal file
45
test_conformance/spir/CMakeLists.txt
Normal file
@@ -0,0 +1,45 @@
|
||||
function (install_spir_artifacts suite_name)
|
||||
install(FILES "${suite_name}.zip" DESTINATION ${CLConf_OUT_DIR}/spir)
|
||||
endfunction()
|
||||
|
||||
include_directories(${CLConf_SRC_DIR}/test_common)
|
||||
|
||||
clconf_add_executable(
|
||||
test_spir
|
||||
main.cpp
|
||||
datagen.cpp
|
||||
run_build_test.cpp
|
||||
run_services.cpp
|
||||
kernelargs.cpp)
|
||||
|
||||
target_link_libraries(
|
||||
test_spir${CLConf_SUFFIX}
|
||||
miniz${CLConf_SUFFIX}
|
||||
)
|
||||
|
||||
install_spir_artifacts(api)
|
||||
install_spir_artifacts(atomics)
|
||||
install_spir_artifacts(basic)
|
||||
install_spir_artifacts(compile_and_link)
|
||||
install_spir_artifacts(commonfns)
|
||||
install_spir_artifacts(conversions)
|
||||
install_spir_artifacts(geometrics)
|
||||
install_spir_artifacts(enum_values)
|
||||
install_spir_artifacts(half)
|
||||
install_spir_artifacts(kernel_attributes)
|
||||
install_spir_artifacts(kernel_image_methods)
|
||||
install_spir_artifacts(images_kernel_read_write)
|
||||
install_spir_artifacts(images_samplerlessRead)
|
||||
install_spir_artifacts(integer_ops)
|
||||
install_spir_artifacts(math_brute_force)
|
||||
install_spir_artifacts(printf)
|
||||
install_spir_artifacts(profiling)
|
||||
install_spir_artifacts(relationals)
|
||||
install_spir_artifacts(select)
|
||||
install_spir_artifacts(sampler_enumeration)
|
||||
install_spir_artifacts(vec_align)
|
||||
install_spir_artifacts(vec_step)
|
||||
install_spir_artifacts(binary_type)
|
||||
install(FILES "khr.csv" DESTINATION ${CLConf_OUT_DIR}/spir)
|
||||
#Add any other runtime directories you need here.
|
||||
# end of file #
|
||||
45
test_conformance/spir/Makefile
Normal file
45
test_conformance/spir/Makefile
Normal file
@@ -0,0 +1,45 @@
|
||||
ifdef BUILD_WITH_ATF
|
||||
ATF = -framework ATF
|
||||
USE_ATF = -DUSE_ATF
|
||||
endif
|
||||
|
||||
SRCS = main.cpp datagen.cpp kernelargs.cpp run_build_test.cpp run_services.cpp \
|
||||
../../test_common/miniz/miniz.c \
|
||||
../../test_common/harness/testHarness.c \
|
||||
../../test_common/harness/errorHelpers.c \
|
||||
../../test_common/harness/typeWrappers.cpp \
|
||||
../../test_common/harness/mt19937.c \
|
||||
../../test_common/harness/os_helpers.c \
|
||||
../../test_common/harness/kernelHelpers.c
|
||||
|
||||
SOURCES = $(abspath $(SRCS))
|
||||
|
||||
|
||||
LIBPATH += -L/System/Library/Frameworks/OpenCL.framework/Libraries
|
||||
LIBPATH += -L.
|
||||
|
||||
FRAMEWORK = ${SOURCES}
|
||||
HEADERS =
|
||||
TARGET = test_spir
|
||||
INCLUDE =
|
||||
COMPILERFLAGS = -c -Wall -g -Wshorten-64-to-32
|
||||
#COMPILERFLAGS = -c -Wall -g -DUSE_LOCAL_THREADS
|
||||
CC = c++
|
||||
CFLAGS = $(COMPILERFLAGS) $(RC_CFLAGS) ${USE_ATF}
|
||||
CXXFLAGS= $(COMPILERFLAGS) $(RC_CFLAGS) ${USE_ATF}
|
||||
LIBRARIES = -framework OpenCL -framework OpenGL -framework GLUT -framework AppKit ${ATF}
|
||||
|
||||
OBJECTS := ${SOURCES:.c=.o}
|
||||
OBJECTS := ${OBJECTS:.cpp=.o}
|
||||
|
||||
TARGETOBJECT =
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(CC) $(RC_CFLAGS) $(OBJECTS) -o $@ $(LIBPATH) $(LIBRARIES)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET) $(OBJECTS)
|
||||
|
||||
.DEFAULT:
|
||||
@echo The target \"$@\" does not exist in Makefile.
|
||||
BIN
test_conformance/spir/api.zip
Normal file
BIN
test_conformance/spir/api.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/atomics.zip
Normal file
BIN
test_conformance/spir/atomics.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/basic.zip
Normal file
BIN
test_conformance/spir/basic.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/binary_type.zip
Normal file
BIN
test_conformance/spir/binary_type.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/commonfns.zip
Normal file
BIN
test_conformance/spir/commonfns.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/compile_and_link.zip
Normal file
BIN
test_conformance/spir/compile_and_link.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/conversions.zip
Normal file
BIN
test_conformance/spir/conversions.zip
Normal file
Binary file not shown.
644
test_conformance/spir/datagen.cpp
Normal file
644
test_conformance/spir/datagen.cpp
Normal file
@@ -0,0 +1,644 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#include "../../test_common/harness/compat.h"
|
||||
#include "exceptions.h"
|
||||
#include "datagen.h"
|
||||
|
||||
RandomGenerator gRG;
|
||||
|
||||
size_t WorkSizeInfo::getGlobalWorkSize() const
|
||||
{
|
||||
switch( work_dim )
|
||||
{
|
||||
case 1: return global_work_size[0];
|
||||
case 2: return global_work_size[0] * global_work_size[1];
|
||||
case 3: return global_work_size[0] * global_work_size[1] * global_work_size[2];
|
||||
default:
|
||||
throw Exceptions::TestError("wrong work dimention\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* DataGenerator
|
||||
*/
|
||||
|
||||
DataGenerator* DataGenerator::Instance = NULL;
|
||||
|
||||
DataGenerator* DataGenerator::getInstance()
|
||||
{
|
||||
if (!Instance)
|
||||
Instance = new DataGenerator();
|
||||
|
||||
return Instance;
|
||||
}
|
||||
|
||||
DataGenerator::DataGenerator()
|
||||
{
|
||||
#define TYPE_HNDL( type, isBuffer, base_element_size, vector_size, min_value, max_value, Generator) \
|
||||
assert(m_argGenerators.find(type) == m_argGenerators.end()) ; \
|
||||
m_argGenerators[type] = new Generator( isBuffer, vector_size, min_value, max_value);
|
||||
#include "typeinfo.h"
|
||||
#undef TYPE_HNDL
|
||||
}
|
||||
|
||||
DataGenerator::~DataGenerator()
|
||||
{
|
||||
ArgGeneratorsMap::iterator i = m_argGenerators.begin();
|
||||
ArgGeneratorsMap::iterator e = m_argGenerators.end();
|
||||
|
||||
for(; i != e; ++i)
|
||||
{
|
||||
delete i->second;
|
||||
}
|
||||
}
|
||||
|
||||
KernelArgGenerator* DataGenerator::getArgGenerator( const KernelArgInfo& argInfo )
|
||||
{
|
||||
//try to match the full type first
|
||||
ArgGeneratorsMap::iterator i = m_argGenerators.find(argInfo.getTypeName());
|
||||
ArgGeneratorsMap::iterator e = m_argGenerators.end();
|
||||
|
||||
if( i != e )
|
||||
{
|
||||
return i->second;
|
||||
}
|
||||
// search for the proper prefix of the type
|
||||
for(i = m_argGenerators.begin(); i != e; ++i)
|
||||
{
|
||||
if( 0 == argInfo.getTypeName().find(i->first))
|
||||
{
|
||||
return i->second;
|
||||
}
|
||||
}
|
||||
throw Exceptions::TestError(std::string("Can't find the generator for the type ")
|
||||
+ argInfo.getTypeName() + " for argument " + argInfo.getName() + "\n");
|
||||
}
|
||||
|
||||
void DataGenerator::setArgGenerator(const KernelArgInfo& argInfo,
|
||||
KernelArgGenerator* pGen)
|
||||
{
|
||||
m_argGenerators[argInfo.getTypeName()] = pGen;
|
||||
}
|
||||
|
||||
float get_random_float(float low, float high, MTdata d)
|
||||
{
|
||||
float t = (float)((double)genrand_int32(d) / (double)0xFFFFFFFF);
|
||||
return (1.0f - t) * low + t * high;
|
||||
}
|
||||
|
||||
double get_random_double(double low, double high, MTdata d)
|
||||
{
|
||||
cl_ulong u = (cl_ulong) genrand_int32(d) | ((cl_ulong) genrand_int32(d) << 32 );
|
||||
double t = (double) u * MAKE_HEX_DOUBLE( 0x1.0p-64, 0x1, -64);
|
||||
return (1.0f - t) * low + t * high;
|
||||
}
|
||||
|
||||
size_t get_random_size_t(size_t low, size_t high, MTdata d)
|
||||
{
|
||||
enum { N = sizeof(size_t)/sizeof(int) };
|
||||
|
||||
union {
|
||||
int word[N];
|
||||
size_t size;
|
||||
} u;
|
||||
|
||||
for (unsigned i=0; i != N; ++i) {
|
||||
u.word[i] = genrand_int32(d);
|
||||
}
|
||||
|
||||
assert(low <= high && "Invalid random number range specified");
|
||||
size_t range = high - low;
|
||||
|
||||
return (range) ? low + ((u.size - low) % range) : low;
|
||||
}
|
||||
|
||||
size_t get_random_int32(int low, int high, MTdata d)
|
||||
{
|
||||
int v = genrand_int32(d);
|
||||
|
||||
assert(low <= high && "Invalid random number range specified");
|
||||
size_t range = high - low;
|
||||
|
||||
return (range) ? low + ((v - low) % range) : low;
|
||||
}
|
||||
|
||||
/*
|
||||
* KernelArgGeneratorSampler
|
||||
*/
|
||||
KernelArgGeneratorSampler::KernelArgGeneratorSampler(bool isBuffer,
|
||||
size_t vectorSize,
|
||||
int minValue,
|
||||
int maxValue) {
|
||||
initToDefaults();
|
||||
}
|
||||
|
||||
void KernelArgGeneratorSampler::initToDefaults() {
|
||||
m_normalized = false;
|
||||
m_addressingMode = CL_ADDRESS_NONE;
|
||||
m_filterMode = CL_FILTER_NEAREST;
|
||||
}
|
||||
|
||||
KernelArgGeneratorSampler::KernelArgGeneratorSampler() {
|
||||
initToDefaults();
|
||||
|
||||
}
|
||||
|
||||
void KernelArgGeneratorSampler::setNormalized(cl_bool isNormalized)
|
||||
{
|
||||
m_normalized = isNormalized;
|
||||
}
|
||||
|
||||
void KernelArgGeneratorSampler::setAddressingMode(cl_addressing_mode mode)
|
||||
{
|
||||
m_addressingMode = mode;
|
||||
}
|
||||
|
||||
void KernelArgGeneratorSampler::setFiterMode(cl_filter_mode mode)
|
||||
{
|
||||
m_filterMode = mode;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SamplerValuesGenerator.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Static fields initialization.
|
||||
*/
|
||||
cl_bool SamplerValuesGenerator::coordNormalizations[] = {CL_TRUE, CL_FALSE};
|
||||
|
||||
cl_filter_mode SamplerValuesGenerator::filterModes[] = {
|
||||
CL_FILTER_NEAREST,
|
||||
CL_FILTER_LINEAR
|
||||
};
|
||||
|
||||
cl_addressing_mode SamplerValuesGenerator::addressingModes[] = {
|
||||
CL_ADDRESS_NONE,
|
||||
CL_ADDRESS_CLAMP,
|
||||
CL_ADDRESS_CLAMP_TO_EDGE,
|
||||
CL_ADDRESS_REPEAT,
|
||||
CL_ADDRESS_MIRRORED_REPEAT
|
||||
};
|
||||
|
||||
const size_t NUM_NORM_MODES =
|
||||
sizeof(SamplerValuesGenerator::coordNormalizations)/sizeof(cl_bool);
|
||||
|
||||
const size_t NUM_FILTER_MODES =
|
||||
sizeof(SamplerValuesGenerator::filterModes)/sizeof(cl_filter_mode);
|
||||
|
||||
const size_t NUM_ADDR_MODES =
|
||||
sizeof(SamplerValuesGenerator::addressingModes)/sizeof(cl_addressing_mode);
|
||||
|
||||
SamplerValuesGenerator::iterator SamplerValuesGenerator::end()
|
||||
{
|
||||
return iterator(NUM_NORM_MODES-1, NUM_FILTER_MODES-1, NUM_ADDR_MODES-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* A constructor for generating an 'end iterator'.
|
||||
*/
|
||||
SamplerValuesGenerator::iterator::iterator(size_t norm, size_t filter,
|
||||
size_t addressing):
|
||||
m_normIndex(norm), m_filterIndex(filter), m_addressingModeIndex(addressing){}
|
||||
|
||||
/*
|
||||
* A constructor for generating a 'begin iterator'.
|
||||
*/
|
||||
SamplerValuesGenerator::iterator::iterator():
|
||||
m_normIndex(0), m_filterIndex(0), m_addressingModeIndex(0){}
|
||||
|
||||
SamplerValuesGenerator::iterator& SamplerValuesGenerator::iterator::operator ++()
|
||||
{
|
||||
if (incrementIndex(m_normIndex, NUM_NORM_MODES)) return *this;
|
||||
if (incrementIndex(m_filterIndex, NUM_FILTER_MODES)) return *this;
|
||||
if (incrementIndex(m_addressingModeIndex, NUM_ADDR_MODES)) return *this;
|
||||
|
||||
assert(false && "incrementing end iterator!");
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool SamplerValuesGenerator::iterator::incrementIndex(size_t &i,
|
||||
const size_t limit)
|
||||
{
|
||||
i = (i+1) % limit;
|
||||
return i != 0;
|
||||
}
|
||||
|
||||
bool SamplerValuesGenerator::iterator::operator == (const iterator& other) const
|
||||
{
|
||||
return m_normIndex == other.m_normIndex &&
|
||||
m_filterIndex == other.m_filterIndex &&
|
||||
m_addressingModeIndex == other.m_addressingModeIndex;
|
||||
}
|
||||
|
||||
bool SamplerValuesGenerator::iterator::operator != (const iterator& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
cl_bool SamplerValuesGenerator::iterator::getNormalized() const
|
||||
{
|
||||
assert(m_normIndex < NUM_NORM_MODES && "illegal index");
|
||||
return coordNormalizations[m_normIndex];
|
||||
}
|
||||
|
||||
cl_filter_mode SamplerValuesGenerator::iterator::getFilterMode() const
|
||||
{
|
||||
assert(m_filterIndex < NUM_FILTER_MODES && "illegal index");
|
||||
return filterModes[m_filterIndex];
|
||||
}
|
||||
|
||||
cl_addressing_mode SamplerValuesGenerator::iterator::getAddressingMode() const
|
||||
{
|
||||
assert(m_addressingModeIndex < NUM_ADDR_MODES && "illegal index");
|
||||
return addressingModes[m_addressingModeIndex];
|
||||
}
|
||||
|
||||
unsigned SamplerValuesGenerator::iterator::toBitmap() const
|
||||
{
|
||||
unsigned norm, filter, addressingModes;
|
||||
switch (getNormalized())
|
||||
{
|
||||
case CL_TRUE:
|
||||
norm = 8;
|
||||
break;
|
||||
case CL_FALSE:
|
||||
norm = 0;
|
||||
break;
|
||||
default:
|
||||
assert(0 && "invalid normalize value");
|
||||
}
|
||||
|
||||
switch (getFilterMode())
|
||||
{
|
||||
case CL_FILTER_NEAREST:
|
||||
filter = 0;
|
||||
break;
|
||||
case CL_FILTER_LINEAR:
|
||||
filter = 16;
|
||||
break;
|
||||
default:
|
||||
assert(0 && "invalid filter value");
|
||||
}
|
||||
|
||||
switch(getAddressingMode())
|
||||
{
|
||||
case CL_ADDRESS_NONE:
|
||||
addressingModes = 0;
|
||||
break;
|
||||
case CL_ADDRESS_CLAMP:
|
||||
addressingModes = 1;
|
||||
break;
|
||||
case CL_ADDRESS_CLAMP_TO_EDGE:
|
||||
addressingModes = 2;
|
||||
break;
|
||||
case CL_ADDRESS_REPEAT:
|
||||
addressingModes = 3;
|
||||
break;
|
||||
case CL_ADDRESS_MIRRORED_REPEAT:
|
||||
addressingModes = 4;
|
||||
break;
|
||||
default:
|
||||
assert(0 && "invalid filter value");
|
||||
}
|
||||
|
||||
return norm | filter | addressingModes;
|
||||
}
|
||||
|
||||
std::string SamplerValuesGenerator::iterator::toString() const
|
||||
{
|
||||
std::string ret("(");
|
||||
|
||||
switch (getNormalized())
|
||||
{
|
||||
case CL_TRUE:
|
||||
ret.append("Normalized | ");
|
||||
break;
|
||||
case CL_FALSE:
|
||||
ret.append("Not Normalized | ");
|
||||
break;
|
||||
default:
|
||||
assert(0 && "invalid normalize value");
|
||||
}
|
||||
|
||||
switch (getFilterMode())
|
||||
{
|
||||
case CL_FILTER_NEAREST:
|
||||
ret.append("Filter Nearest | ");
|
||||
break;
|
||||
case CL_FILTER_LINEAR:
|
||||
ret.append("Filter Linear | ");
|
||||
break;
|
||||
default:
|
||||
assert(0 && "invalid filter value");
|
||||
}
|
||||
|
||||
switch(getAddressingMode())
|
||||
{
|
||||
case CL_ADDRESS_NONE:
|
||||
ret.append("Address None");
|
||||
break;
|
||||
case CL_ADDRESS_CLAMP:
|
||||
ret.append("Address clamp");
|
||||
break;
|
||||
case CL_ADDRESS_CLAMP_TO_EDGE:
|
||||
ret.append("Address clamp to edge");
|
||||
break;
|
||||
case CL_ADDRESS_REPEAT:
|
||||
ret.append("Address repeat");
|
||||
break;
|
||||
case CL_ADDRESS_MIRRORED_REPEAT:
|
||||
ret.append("Address mirrored repeat");
|
||||
break;
|
||||
default:
|
||||
assert(0 && "invalid filter value");
|
||||
}
|
||||
|
||||
ret.append(")");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* ImageValuesGenerator.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Static fields initialization.
|
||||
*/
|
||||
const char* ImageValuesGenerator::imageTypes[] = {
|
||||
"image1d_array_float",
|
||||
"image1d_array_int",
|
||||
"image1d_array_uint",
|
||||
"image1d_buffer_float",
|
||||
"image1d_buffer_int",
|
||||
"image1d_buffer_uint",
|
||||
"image1d_float",
|
||||
"image1d_int",
|
||||
"image1d_uint",
|
||||
"image2d_array_float",
|
||||
"image2d_array_int",
|
||||
"image2d_array_uint",
|
||||
"image2d_float",
|
||||
"image2d_int",
|
||||
"image2d_uint",
|
||||
"image3d_float",
|
||||
"image3d_int",
|
||||
"image3d_uint"
|
||||
};
|
||||
|
||||
cl_channel_order ImageValuesGenerator::channelOrders[] = {
|
||||
CL_A,
|
||||
CL_R,
|
||||
CL_Rx,
|
||||
CL_RG,
|
||||
CL_RGx,
|
||||
CL_RA,
|
||||
CL_RGB,
|
||||
CL_RGBx,
|
||||
CL_RGBA,
|
||||
CL_ARGB,
|
||||
CL_BGRA,
|
||||
CL_INTENSITY,
|
||||
CL_LUMINANCE,
|
||||
CL_DEPTH,
|
||||
CL_DEPTH_STENCIL
|
||||
};
|
||||
|
||||
const size_t NUM_CHANNEL_ORDERS = sizeof(ImageValuesGenerator::channelOrders)/sizeof(ImageValuesGenerator::channelOrders[0]);
|
||||
const size_t NUM_IMG_TYS = sizeof(ImageValuesGenerator::imageTypes)/sizeof(ImageValuesGenerator::imageTypes[0]);
|
||||
|
||||
ImageValuesGenerator::iterator ImageValuesGenerator::begin()
|
||||
{
|
||||
return ImageValuesGenerator::iterator(this);
|
||||
}
|
||||
|
||||
ImageValuesGenerator::iterator ImageValuesGenerator::end()
|
||||
{
|
||||
return ImageValuesGenerator::iterator(0);
|
||||
}
|
||||
/*
|
||||
* Class Iterator
|
||||
*/
|
||||
ImageValuesGenerator::iterator::iterator(ImageValuesGenerator *pParent):
|
||||
m_parent(pParent), m_channelIndex(0), m_imgTyIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Initializes an 'end' iterator.
|
||||
*/
|
||||
ImageValuesGenerator::iterator::iterator(int):
|
||||
m_parent(NULL),
|
||||
m_channelIndex(NUM_CHANNEL_ORDERS),
|
||||
m_imgTyIndex(NUM_IMG_TYS) {}
|
||||
|
||||
ImageValuesGenerator::iterator& ImageValuesGenerator::iterator::operator ++()
|
||||
{
|
||||
assert(m_channelIndex < NUM_CHANNEL_ORDERS && m_imgTyIndex < NUM_IMG_TYS &&
|
||||
"Attempt to increment an end iterator");
|
||||
|
||||
ImageValuesGenerator::iterator endIter = iterator(0);
|
||||
// Incrementing untill we find the next legal combination, or we reach the
|
||||
// end value.
|
||||
while (incrementIndex(m_channelIndex,NUM_CHANNEL_ORDERS))
|
||||
if (isLegalCombination())
|
||||
return *this;
|
||||
|
||||
// We have reach to this line because last increment caused an 'oveflow'
|
||||
// in data channel order index.
|
||||
if (incrementIndex(m_imgTyIndex, NUM_IMG_TYS))
|
||||
// In case this combination is not legal, we go on to the next legal
|
||||
// combo.
|
||||
return isLegalCombination() ? *this : ++(*this);
|
||||
|
||||
*this = endIter;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool ImageValuesGenerator::iterator::operator == (
|
||||
const ImageValuesGenerator::iterator& o) const
|
||||
{
|
||||
return m_channelIndex == o.m_channelIndex &&
|
||||
m_imgTyIndex == o.m_imgTyIndex;
|
||||
}
|
||||
|
||||
bool ImageValuesGenerator::iterator::operator != (
|
||||
const ImageValuesGenerator::iterator& o) const
|
||||
{
|
||||
return !(*this == o);
|
||||
}
|
||||
|
||||
std::string ImageValuesGenerator::iterator::getDataTypeName() const
|
||||
{
|
||||
assert(m_imgTyIndex < NUM_IMG_TYS && "image type index is out of bound");
|
||||
|
||||
std::string tyName(imageTypes[m_imgTyIndex]);
|
||||
// Find the last '_' and remove it (the suffix is _<channel type>).
|
||||
size_t pos = tyName.find_last_of('_');
|
||||
assert (std::string::npos != pos && "no under score in type name?");
|
||||
tyName = tyName.erase(0, pos+1);
|
||||
return tyName;
|
||||
}
|
||||
|
||||
int ImageValuesGenerator::iterator::getOpenCLChannelOrder() const
|
||||
{
|
||||
assert(m_channelIndex < NUM_CHANNEL_ORDERS && "channel index out of bound");
|
||||
return channelOrders[m_channelIndex];
|
||||
}
|
||||
|
||||
int ImageValuesGenerator::iterator::getSPIRChannelOrder() const
|
||||
{
|
||||
return getOpenCLChannelOrder();
|
||||
}
|
||||
|
||||
std::string ImageValuesGenerator::iterator::getImageTypeName() const
|
||||
{
|
||||
assert(m_imgTyIndex < NUM_IMG_TYS && "image type index is out of bound");
|
||||
|
||||
std::string tyName = imageTypes[m_imgTyIndex];
|
||||
// Find the last '_' and remove it (the suffix is _<channel type>).
|
||||
size_t pos = tyName.find_last_of('_');
|
||||
assert (std::string::npos != pos && "no under score in type name?");
|
||||
tyName = tyName.erase(pos, tyName.size() - pos);
|
||||
|
||||
return tyName;
|
||||
}
|
||||
|
||||
std::string ImageValuesGenerator::iterator::getImageGeneratorName() const
|
||||
{
|
||||
assert(m_imgTyIndex < NUM_IMG_TYS && "image type index is out of bound");
|
||||
return imageTypes[m_imgTyIndex];
|
||||
}
|
||||
|
||||
std::string ImageValuesGenerator::iterator::getBaseImageGeneratorName() const
|
||||
{
|
||||
assert(m_imgTyIndex < NUM_IMG_TYS && "image type index is out of bound");
|
||||
std::string tyName = getImageTypeName();
|
||||
tyName.append("_t");
|
||||
return tyName;
|
||||
}
|
||||
|
||||
int ImageValuesGenerator::iterator::getDataType() const
|
||||
{
|
||||
assert(m_imgTyIndex < NUM_IMG_TYS && "image type index is out of bound");
|
||||
std::string tyName = getDataTypeName();
|
||||
|
||||
if ("int" == tyName)
|
||||
return SPIR_CLK_SIGNED_INT32;
|
||||
if ("uint" == tyName)
|
||||
return SPIR_CLK_UNSIGNED_INT32;
|
||||
if ("float" == tyName)
|
||||
return SPIR_CLK_FLOAT;
|
||||
assert (false && "unkown image data type");
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::string ImageValuesGenerator::iterator::toString() const
|
||||
{
|
||||
if (*this == m_parent->end())
|
||||
return "End iterator";
|
||||
|
||||
// Sanity.
|
||||
assert(m_imgTyIndex < NUM_IMG_TYS && "image type index is out of bound");
|
||||
assert(m_channelIndex < NUM_CHANNEL_ORDERS && "channel index out of bound");
|
||||
|
||||
std::string str = imageTypes[m_imgTyIndex];
|
||||
str.append("_");
|
||||
|
||||
switch (channelOrders[m_channelIndex])
|
||||
{
|
||||
case CL_R:
|
||||
str.append("cl_r");
|
||||
break;
|
||||
case CL_A:
|
||||
str.append("cl_a");
|
||||
break;
|
||||
case CL_RG:
|
||||
str.append("cl_rg");
|
||||
break;
|
||||
case CL_RA:
|
||||
str.append("cl_ra");
|
||||
break;
|
||||
case CL_RGB:
|
||||
str.append("cl_rgb");
|
||||
break;
|
||||
case CL_RGBA:
|
||||
str.append("cl_rgba");
|
||||
break;
|
||||
case CL_BGRA:
|
||||
str.append("cl_bgra");
|
||||
break;
|
||||
case CL_ARGB:
|
||||
str.append("cl_argb");
|
||||
break;
|
||||
case CL_INTENSITY:
|
||||
str.append("cl_intensity");
|
||||
break;
|
||||
case CL_LUMINANCE:
|
||||
str.append("cl_luminace");
|
||||
break;
|
||||
case CL_Rx:
|
||||
str.append("cl_Rx");
|
||||
break;
|
||||
case CL_RGx:
|
||||
str.append("cl_RGx");
|
||||
break;
|
||||
case CL_RGBx:
|
||||
str.append("cl_RGBx");
|
||||
break;
|
||||
case CL_DEPTH:
|
||||
str.append("cl_depth");
|
||||
break;
|
||||
case CL_DEPTH_STENCIL:
|
||||
str.append( "cl_depth_stencil");
|
||||
break;
|
||||
default:
|
||||
assert(false && "Invalid channel order");
|
||||
str.append("<invalid channel order>");
|
||||
break;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
bool ImageValuesGenerator::iterator::incrementIndex(size_t& index,
|
||||
size_t arrSize)
|
||||
{
|
||||
index = (index + 1) % arrSize;
|
||||
return index != 0;
|
||||
}
|
||||
|
||||
bool ImageValuesGenerator::iterator::isLegalCombination() const
|
||||
{
|
||||
cl_channel_order corder = channelOrders[m_channelIndex];
|
||||
std::string strImgTy(imageTypes[m_imgTyIndex]);
|
||||
|
||||
if (corder == CL_INTENSITY || corder == CL_LUMINANCE)
|
||||
{
|
||||
return getDataTypeName() == std::string("float");
|
||||
}
|
||||
|
||||
if (corder == CL_DEPTH)
|
||||
return false;
|
||||
|
||||
if (corder == CL_RGBx || corder == CL_RGB // Can only be applied for int unorms.
|
||||
|| corder == CL_ARGB || corder == CL_BGRA) // Can only be applied for int8.
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
1066
test_conformance/spir/datagen.h
Normal file
1066
test_conformance/spir/datagen.h
Normal file
File diff suppressed because it is too large
Load Diff
BIN
test_conformance/spir/enum_values.zip
Normal file
BIN
test_conformance/spir/enum_values.zip
Normal file
Binary file not shown.
53
test_conformance/spir/exceptions.h
Normal file
53
test_conformance/spir/exceptions.h
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef __EXCEPTIONS_H
|
||||
#define __EXCEPTIONS_H
|
||||
|
||||
#include <stdexcept>
|
||||
#include "../../test_common/miniz/miniz.h"
|
||||
|
||||
namespace Exceptions
|
||||
{
|
||||
/**
|
||||
Exception thrown on error in command line parameters
|
||||
*/
|
||||
class CmdLineError : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
CmdLineError (const std::string& msg): std::runtime_error(msg){}
|
||||
};
|
||||
|
||||
/**
|
||||
Exception thrown on error in test run
|
||||
*/
|
||||
class TestError : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
TestError (const std::string& msg, int errorCode = 1): std::runtime_error(msg), m_errorCode(errorCode){}
|
||||
|
||||
int getErrorCode() const { return m_errorCode; }
|
||||
private:
|
||||
int m_errorCode;
|
||||
};
|
||||
|
||||
class ArchiveError : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
ArchiveError(int errCode): std::runtime_error(mz_error(errCode)){}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
BIN
test_conformance/spir/geometrics.zip
Normal file
BIN
test_conformance/spir/geometrics.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/half.zip
Normal file
BIN
test_conformance/spir/half.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/images_kernel_read_write.zip
Normal file
BIN
test_conformance/spir/images_kernel_read_write.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/images_samplerlessRead.zip
Normal file
BIN
test_conformance/spir/images_samplerlessRead.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/integer_ops.zip
Normal file
BIN
test_conformance/spir/integer_ops.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/kernel_attributes.zip
Normal file
BIN
test_conformance/spir/kernel_attributes.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/kernel_image_methods.zip
Normal file
BIN
test_conformance/spir/kernel_image_methods.zip
Normal file
Binary file not shown.
24
test_conformance/spir/kernelargs.cpp
Normal file
24
test_conformance/spir/kernelargs.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#include "../../test_common/harness/compat.h"
|
||||
#include "kernelargs.h"
|
||||
#include "datagen.h"
|
||||
|
||||
KernelArg* KernelArg::clone(cl_context ctx, const WorkSizeInfo& ws, const cl_kernel kernel, const cl_device_id device) const
|
||||
{
|
||||
return DataGenerator::getInstance()->generateKernelArg(ctx, m_argInfo, ws,
|
||||
this, kernel, device);
|
||||
}
|
||||
444
test_conformance/spir/kernelargs.h
Normal file
444
test_conformance/spir/kernelargs.h
Normal file
@@ -0,0 +1,444 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef __KERNELARGS_H
|
||||
#define __KERNELARGS_H
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/opencl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
#include "../../test_common/harness/typeWrappers.h"
|
||||
|
||||
#include "exceptions.h"
|
||||
|
||||
class WorkSizeInfo;
|
||||
|
||||
/**
|
||||
Represents the single kernel argument information
|
||||
*/
|
||||
class KernelArgInfo
|
||||
{
|
||||
public:
|
||||
cl_kernel_arg_address_qualifier getAddressQualifier() const { return m_address_qualifier; }
|
||||
cl_kernel_arg_access_qualifier getAccessQualifier() const { return m_access_qualifier; }
|
||||
cl_kernel_arg_type_qualifier getTypeQualifier() const { return m_type_qualifier; }
|
||||
|
||||
cl_kernel_arg_address_qualifier* getAddressQualifierRef() { return &m_address_qualifier; }
|
||||
cl_kernel_arg_access_qualifier* getAccessQualifierRef() { return &m_access_qualifier; }
|
||||
cl_kernel_arg_type_qualifier* getTypeQualifierRef() { return &m_type_qualifier; }
|
||||
|
||||
void setTypeName( const char* name) { m_type.assign(name); }
|
||||
void setName( const char* name) { m_name.assign(name); }
|
||||
|
||||
std::string getTypeName() const { return m_type; }
|
||||
std::string getName() const { return m_name; }
|
||||
|
||||
bool operator == ( const KernelArgInfo& rhs ) const
|
||||
{
|
||||
return !m_name.compare(rhs.m_name) &&
|
||||
!m_type.compare(rhs.m_type) &&
|
||||
m_address_qualifier == rhs.m_address_qualifier &&
|
||||
m_access_qualifier == rhs.m_access_qualifier &&
|
||||
m_type_qualifier == rhs.m_type_qualifier;
|
||||
}
|
||||
|
||||
bool operator != ( const KernelArgInfo& rhs ) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
std::string m_type;
|
||||
cl_kernel_arg_address_qualifier m_address_qualifier;
|
||||
cl_kernel_arg_access_qualifier m_access_qualifier;
|
||||
cl_kernel_arg_type_qualifier m_type_qualifier;
|
||||
};
|
||||
|
||||
/**
|
||||
Represents the single kernel's argument value.
|
||||
Responsible for livekeeping of OCL objects.
|
||||
*/
|
||||
class KernelArg
|
||||
{
|
||||
public:
|
||||
KernelArg(const KernelArgInfo& argInfo, void* buffer, size_t size):
|
||||
m_argInfo(argInfo),
|
||||
m_buffer(buffer),
|
||||
m_size(size)
|
||||
{}
|
||||
|
||||
virtual ~KernelArg()
|
||||
{
|
||||
align_free(m_buffer);
|
||||
}
|
||||
|
||||
virtual size_t getArgSize() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
virtual const void* getBuffer() const
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
virtual const void* getArgValue() const
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
virtual bool compare( const KernelArg& rhs ) const
|
||||
{
|
||||
if( m_argInfo != rhs.m_argInfo )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_size != rhs.m_size)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( (NULL == m_buffer || NULL == rhs.m_buffer) && m_buffer != rhs.m_buffer )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//check two NULL buffers case
|
||||
if( NULL == m_buffer && NULL == rhs.m_buffer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( memcmp( m_buffer, rhs.m_buffer, m_size) )
|
||||
{
|
||||
size_t compared = 0;
|
||||
while (compared < m_size)
|
||||
{
|
||||
if ( *(((char*)m_buffer)+compared) != *(((char*)rhs.m_buffer)+compared) )
|
||||
{
|
||||
std::cerr << std::endl << " difference is at offset " << compared << std::endl;
|
||||
return false;
|
||||
}
|
||||
compared++;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void readToHost(cl_command_queue queue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
KernelArg* clone(cl_context context, const WorkSizeInfo& ws, const cl_kernel kernel, const cl_device_id device) const;
|
||||
|
||||
protected:
|
||||
KernelArgInfo m_argInfo;
|
||||
void* m_buffer;
|
||||
size_t m_size;
|
||||
};
|
||||
|
||||
class KernelArgSampler:public KernelArg
|
||||
{
|
||||
public:
|
||||
KernelArgSampler(cl_context context, cl_bool isNormalized,
|
||||
cl_addressing_mode addressMode, cl_filter_mode filterMode):
|
||||
KernelArg(KernelArgInfo(), NULL, sizeof(cl_sampler))
|
||||
{
|
||||
m_argInfo.setTypeName("sampler_t");
|
||||
int error = CL_SUCCESS;
|
||||
m_samplerObj = clCreateSampler(context, isNormalized, addressMode,
|
||||
filterMode, &error);
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("clCreateSampler failed\n", error);
|
||||
}
|
||||
}
|
||||
|
||||
~KernelArgSampler()
|
||||
{
|
||||
//~clSamplerWrapper() releases the sampler object
|
||||
}
|
||||
|
||||
size_t getArgSize() const
|
||||
{
|
||||
return sizeof(cl_sampler);
|
||||
}
|
||||
|
||||
const void* getArgValue() const
|
||||
{
|
||||
return &m_samplerObj;
|
||||
}
|
||||
|
||||
bool compare( const KernelArg& rhs ) const
|
||||
{
|
||||
if (const KernelArgSampler *Rhs = dynamic_cast<const KernelArgSampler*>(&rhs))
|
||||
{
|
||||
return isNormalized() == Rhs->isNormalized() &&
|
||||
getAddressingMode() == Rhs->getAddressingMode() &&
|
||||
getFilterMode() == Rhs->getFilterMode();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
cl_sampler getSampler() const
|
||||
{
|
||||
return (cl_sampler)m_samplerObj;
|
||||
}
|
||||
|
||||
protected:
|
||||
mutable clSamplerWrapper m_samplerObj;
|
||||
|
||||
cl_bool isNormalized() const
|
||||
{
|
||||
cl_bool norm;
|
||||
cl_int err = clGetSamplerInfo(getSampler(),
|
||||
CL_SAMPLER_NORMALIZED_COORDS,
|
||||
sizeof(cl_bool),
|
||||
&norm,
|
||||
NULL);
|
||||
if (CL_SUCCESS != err)
|
||||
throw Exceptions::TestError("clGetSamplerInfo failed\n", err);
|
||||
return norm;
|
||||
}
|
||||
|
||||
cl_addressing_mode getAddressingMode() const
|
||||
{
|
||||
cl_addressing_mode addressingmode;
|
||||
cl_int err = clGetSamplerInfo(getSampler(),
|
||||
CL_SAMPLER_ADDRESSING_MODE,
|
||||
sizeof(cl_addressing_mode),
|
||||
&addressingmode,
|
||||
NULL);
|
||||
if (CL_SUCCESS != err)
|
||||
throw Exceptions::TestError("clGetSamplerInfo failed\n", err);
|
||||
return addressingmode;
|
||||
}
|
||||
|
||||
cl_filter_mode getFilterMode() const
|
||||
{
|
||||
cl_filter_mode filtermode;
|
||||
cl_int err = clGetSamplerInfo(getSampler(),
|
||||
CL_SAMPLER_FILTER_MODE,
|
||||
sizeof(cl_filter_mode),
|
||||
&filtermode,
|
||||
NULL);
|
||||
if (CL_SUCCESS != err)
|
||||
throw Exceptions::TestError("clGetSamplerInfo failed\n", err);
|
||||
return filtermode;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
class KernelArgMemObj:public KernelArg
|
||||
{
|
||||
public:
|
||||
KernelArgMemObj(const KernelArgInfo& argInfo, void* buffer, size_t size):
|
||||
KernelArg(argInfo, buffer, size)
|
||||
{
|
||||
m_memObj = NULL;
|
||||
}
|
||||
|
||||
~KernelArgMemObj()
|
||||
{
|
||||
//~clMemWrapper() releases the memory object
|
||||
}
|
||||
|
||||
virtual void readToHost(cl_command_queue queue) = 0;
|
||||
|
||||
|
||||
size_t getArgSize() const
|
||||
{
|
||||
if( NULL == m_buffer )
|
||||
return m_size; // local buffer
|
||||
else
|
||||
return sizeof(cl_mem);
|
||||
}
|
||||
|
||||
const void* getArgValue() const
|
||||
{
|
||||
if( NULL == m_buffer )
|
||||
{
|
||||
return NULL; // local buffer
|
||||
}
|
||||
else {
|
||||
clMemWrapper* p = const_cast<clMemWrapper*>(&m_memObj);
|
||||
|
||||
return (const void*)(&(*p));
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
clMemWrapper m_memObj;
|
||||
};
|
||||
|
||||
/**
|
||||
Represents the single kernel's argument value.
|
||||
Responsible for livekeeping of OCL objects.
|
||||
*/
|
||||
class KernelArgBuffer:public KernelArgMemObj
|
||||
{
|
||||
public:
|
||||
KernelArgBuffer(cl_context context, const KernelArgInfo& argInfo, void* buffer, size_t size):
|
||||
KernelArgMemObj(argInfo, buffer, size)
|
||||
{
|
||||
if( NULL != buffer )
|
||||
{
|
||||
int error = CL_SUCCESS;
|
||||
m_memObj = clCreateBuffer( context,
|
||||
(cl_mem_flags)( CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR ),
|
||||
size, buffer, &error );
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("clCreateBuffer failed\n", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void readToHost(cl_command_queue queue)
|
||||
{
|
||||
if( NULL == m_buffer )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int error = clEnqueueReadBuffer( queue, m_memObj, CL_TRUE, 0, m_size, m_buffer, 0, NULL, NULL);
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("clEnqueueReadBuffer failed\n", error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class KernelArgImage:public KernelArgMemObj
|
||||
{
|
||||
public:
|
||||
KernelArgImage(cl_context context, const KernelArgInfo& argInfo,
|
||||
void* buffer, size_t size, cl_mem_flags flags,
|
||||
cl_image_format format, cl_image_desc desc):
|
||||
KernelArgMemObj(argInfo, buffer, size), m_desc(desc)
|
||||
{
|
||||
if( NULL != buffer )
|
||||
{
|
||||
int error = CL_SUCCESS;
|
||||
flags |= CL_MEM_COPY_HOST_PTR ;
|
||||
if (CL_MEM_OBJECT_IMAGE1D_BUFFER == m_desc.image_type)
|
||||
{
|
||||
m_desc.buffer = clCreateBuffer( context, flags, m_desc.image_row_pitch, buffer, &error );
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("KernelArgImage clCreateBuffer failed\n", error);
|
||||
}
|
||||
buffer = NULL;
|
||||
flags &= ~CL_MEM_COPY_HOST_PTR;
|
||||
m_desc.image_row_pitch = 0;
|
||||
m_desc.image_slice_pitch = 0;
|
||||
}
|
||||
m_memObj = clCreateImage( context, flags, &format, &m_desc, buffer, &error );
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("KernelArgImage clCreateImage failed\n", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~KernelArgImage()
|
||||
{
|
||||
if (CL_MEM_OBJECT_IMAGE1D_BUFFER == m_desc.image_type)
|
||||
{
|
||||
clReleaseMemObject(m_desc.buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void readToHost(cl_command_queue queue)
|
||||
{
|
||||
if( NULL == m_buffer )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
size_t origin[3] = {0, 0, 0};
|
||||
size_t region[3] = {m_desc.image_width , m_desc.image_height , m_desc.image_depth};
|
||||
|
||||
int error = clEnqueueReadImage (queue, m_memObj, CL_TRUE, origin, region, m_desc.image_row_pitch, m_desc.image_slice_pitch, m_buffer, 0, NULL, NULL);
|
||||
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("clEnqueueReadImage failed\n", error);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
cl_image_desc m_desc;
|
||||
};
|
||||
|
||||
/**
|
||||
Represents the container for the kernel parameters
|
||||
*/
|
||||
class KernelArgs
|
||||
{
|
||||
typedef std::vector<KernelArg*> KernelsArgsVector;
|
||||
public:
|
||||
KernelArgs(){}
|
||||
~KernelArgs()
|
||||
{
|
||||
KernelsArgsVector::iterator i = m_args.begin();
|
||||
KernelsArgsVector::iterator e = m_args.end();
|
||||
|
||||
for( ; i != e; ++i )
|
||||
{
|
||||
assert( NULL != *i );
|
||||
delete *i;
|
||||
}
|
||||
}
|
||||
|
||||
void readToHost(cl_command_queue queue)
|
||||
{
|
||||
KernelsArgsVector::iterator i = m_args.begin();
|
||||
KernelsArgsVector::iterator e = m_args.end();
|
||||
|
||||
for( ; i != e; ++i )
|
||||
{
|
||||
(*i)->readToHost(queue);
|
||||
}
|
||||
}
|
||||
|
||||
size_t getArgCount() const { return m_args.size(); }
|
||||
|
||||
KernelArg* getArg(size_t index ) { return m_args[index]; }
|
||||
|
||||
const KernelArg* getArg(size_t index) const { return m_args[index]; }
|
||||
|
||||
void addArg( KernelArg* arg ) { m_args.push_back(arg); }
|
||||
|
||||
private:
|
||||
KernelsArgsVector m_args;
|
||||
};
|
||||
|
||||
#endif
|
||||
2176
test_conformance/spir/khr.csv
Normal file
2176
test_conformance/spir/khr.csv
Normal file
File diff suppressed because it is too large
Load Diff
6985
test_conformance/spir/main.cpp
Normal file
6985
test_conformance/spir/main.cpp
Normal file
File diff suppressed because it is too large
Load Diff
BIN
test_conformance/spir/math_brute_force.zip
Normal file
BIN
test_conformance/spir/math_brute_force.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/printf.zip
Normal file
BIN
test_conformance/spir/printf.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/profiling.zip
Normal file
BIN
test_conformance/spir/profiling.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/relationals.zip
Normal file
BIN
test_conformance/spir/relationals.zip
Normal file
Binary file not shown.
422
test_conformance/spir/run_build_test.cpp
Normal file
422
test_conformance/spir/run_build_test.cpp
Normal file
@@ -0,0 +1,422 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#include "../../test_common/harness/compat.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/opencl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <assert.h>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include "../../test_common/harness/errorHelpers.h"
|
||||
#include "../../test_common/harness/kernelHelpers.h"
|
||||
#include "../../test_common/harness/typeWrappers.h"
|
||||
#include "../../test_common/harness/clImageHelper.h"
|
||||
#include "../../test_common/harness/os_helpers.h"
|
||||
|
||||
#include "exceptions.h"
|
||||
#include "kernelargs.h"
|
||||
#include "datagen.h"
|
||||
#include "run_services.h"
|
||||
#include "run_build_test.h"
|
||||
|
||||
//
|
||||
// Task
|
||||
//
|
||||
Task::Task(cl_device_id device, const char* options):
|
||||
m_devid(device) {
|
||||
if (options)
|
||||
m_options = options;
|
||||
}
|
||||
|
||||
Task::~Task() {}
|
||||
|
||||
const char* Task::getErrorLog() const {
|
||||
return m_log.c_str();
|
||||
}
|
||||
|
||||
void Task::setErrorLog(cl_program prog) {
|
||||
size_t len = 0;
|
||||
std::vector<char> log;
|
||||
|
||||
cl_int err_code = clGetProgramBuildInfo(prog, m_devid, CL_PROGRAM_BUILD_LOG, 0, NULL, &len);
|
||||
if(err_code != CL_SUCCESS)
|
||||
{
|
||||
m_log = "Error: clGetProgramBuildInfo(CL_PROGRAM_BUILD_LOG, &len) failed.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
log.resize(len, 0);
|
||||
|
||||
err_code = clGetProgramBuildInfo(prog, m_devid, CL_PROGRAM_BUILD_LOG, len, &log[0], NULL);
|
||||
if(err_code != CL_SUCCESS)
|
||||
{
|
||||
m_log = "Error: clGetProgramBuildInfo(CL_PROGRAM_BUILD_LOG, &log) failed.\n";
|
||||
return;
|
||||
}
|
||||
m_log.append(&log[0]);
|
||||
}
|
||||
|
||||
//
|
||||
// BuildTask
|
||||
//
|
||||
BuildTask::BuildTask(cl_program prog, cl_device_id dev, const char* options) :
|
||||
m_program(prog), Task(dev, options) {}
|
||||
|
||||
bool BuildTask::execute() {
|
||||
cl_int err_code = clBuildProgram(m_program, 0, NULL, m_options.c_str(), NULL, NULL);
|
||||
if(CL_SUCCESS == err_code)
|
||||
return true;
|
||||
|
||||
setErrorLog(m_program);
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// SpirBuildTask
|
||||
//
|
||||
SpirBuildTask::SpirBuildTask(cl_program prog, cl_device_id dev, const char* options) :
|
||||
BuildTask(prog, dev, options) {}
|
||||
|
||||
//
|
||||
// CompileTask
|
||||
//
|
||||
|
||||
CompileTask::CompileTask(cl_program prog, cl_device_id dev, const char* options) :
|
||||
m_program(prog), Task(dev, options) {}
|
||||
|
||||
void CompileTask::addHeader(const char* hname, cl_program hprog) {
|
||||
m_headers.push_back(std::make_pair(hname, hprog));
|
||||
}
|
||||
|
||||
const char* first(std::pair<const char*,cl_program>& p) {
|
||||
return p.first;
|
||||
}
|
||||
|
||||
cl_program second(const std::pair<const char*, cl_program>& p) {
|
||||
return p.second;
|
||||
}
|
||||
|
||||
bool CompileTask::execute() {
|
||||
// Generating the header names vector.
|
||||
std::vector<const char*> names;
|
||||
std::transform(m_headers.begin(), m_headers.end(), names.begin(), first);
|
||||
|
||||
// Generating the header programs vector.
|
||||
std::vector<cl_program> programs;
|
||||
std::transform(m_headers.begin(), m_headers.end(), programs.begin(), second);
|
||||
|
||||
const char** h_names = NULL;
|
||||
const cl_program* h_programs = NULL;
|
||||
if (!m_headers.empty())
|
||||
{
|
||||
h_programs = &programs[0];
|
||||
h_names = &names[0];
|
||||
}
|
||||
|
||||
// Compiling with the headers.
|
||||
cl_int err_code = clCompileProgram(
|
||||
m_program,
|
||||
1U,
|
||||
&m_devid,
|
||||
m_options.c_str(),
|
||||
m_headers.size(), // # of headers
|
||||
h_programs,
|
||||
h_names,
|
||||
NULL, NULL);
|
||||
if (CL_SUCCESS == err_code)
|
||||
return true;
|
||||
|
||||
setErrorLog(m_program);
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// SpirCompileTask
|
||||
//
|
||||
SpirCompileTask::SpirCompileTask(cl_program prog, cl_device_id dev, const char* options) :
|
||||
CompileTask(prog, dev, options) {}
|
||||
|
||||
|
||||
//
|
||||
// LinkTask
|
||||
//
|
||||
LinkTask::LinkTask(cl_program* programs, int num_programs, cl_context ctxt,
|
||||
cl_device_id dev, const char* options) :
|
||||
m_programs(programs), m_numPrograms(num_programs), m_context(ctxt), m_executable(NULL),
|
||||
Task(dev, options) {}
|
||||
|
||||
bool LinkTask::execute() {
|
||||
cl_int err_code;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < m_numPrograms; ++i)
|
||||
{
|
||||
err_code = clCompileProgram(m_programs[i], 1, &m_devid, "-x spir -spir-std=1.2 -cl-kernel-arg-info", 0, NULL, NULL, NULL, NULL);
|
||||
if (CL_SUCCESS != err_code)
|
||||
{
|
||||
setErrorLog(m_programs[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_executable = clLinkProgram(m_context, 1, &m_devid, m_options.c_str(), m_numPrograms, m_programs, NULL, NULL, &err_code);
|
||||
if (CL_SUCCESS == err_code)
|
||||
return true;
|
||||
|
||||
if(m_executable) setErrorLog(m_executable);
|
||||
return false;
|
||||
}
|
||||
|
||||
cl_program LinkTask::getExecutable() const {
|
||||
return m_executable;
|
||||
}
|
||||
|
||||
LinkTask::~LinkTask() {
|
||||
if(m_executable) clReleaseProgram(m_executable);
|
||||
}
|
||||
|
||||
//
|
||||
// KernelEnumerator
|
||||
//
|
||||
void KernelEnumerator::process(cl_program prog) {
|
||||
const size_t MAX_KERNEL_NAME = 64;
|
||||
size_t num_kernels;
|
||||
|
||||
cl_int err_code = clGetProgramInfo(
|
||||
prog,
|
||||
CL_PROGRAM_NUM_KERNELS,
|
||||
sizeof(size_t),
|
||||
&num_kernels,
|
||||
NULL
|
||||
);
|
||||
if (CL_SUCCESS != err_code)
|
||||
return;
|
||||
|
||||
// Querying for the number of kernels.
|
||||
size_t buffer_len = sizeof(char)*num_kernels*MAX_KERNEL_NAME;
|
||||
char* kernel_names = new char[buffer_len];
|
||||
memset(kernel_names, '\0', buffer_len);
|
||||
size_t str_len = 0;
|
||||
err_code = clGetProgramInfo(
|
||||
prog,
|
||||
CL_PROGRAM_KERNEL_NAMES,
|
||||
buffer_len,
|
||||
(void *)kernel_names,
|
||||
&str_len
|
||||
);
|
||||
if (CL_SUCCESS != err_code)
|
||||
return;
|
||||
|
||||
//parsing the names and inserting them to the list
|
||||
std::string names(kernel_names);
|
||||
assert (str_len == 1+names.size() && "incompatible string lengths");
|
||||
size_t offset = 0;
|
||||
for(size_t i=0 ; i<names.size() ; ++i){
|
||||
//kernel names are separated by semi colons
|
||||
if (names[i] == ';'){
|
||||
m_kernels.push_back(names.substr(offset, i-offset));
|
||||
offset = i+1;
|
||||
}
|
||||
}
|
||||
m_kernels.push_back(names.substr(offset, names.size()-offset));
|
||||
delete[] kernel_names;
|
||||
}
|
||||
|
||||
KernelEnumerator::KernelEnumerator(cl_program prog) {
|
||||
process(prog);
|
||||
}
|
||||
|
||||
KernelEnumerator::iterator KernelEnumerator::begin(){
|
||||
return m_kernels.begin();
|
||||
}
|
||||
|
||||
KernelEnumerator::iterator KernelEnumerator::end(){
|
||||
return m_kernels.end();
|
||||
}
|
||||
|
||||
size_t KernelEnumerator::size() const {
|
||||
return m_kernels.size();
|
||||
}
|
||||
|
||||
/**
|
||||
Run the single test - run the test for both CL and SPIR versions of the kernel
|
||||
*/
|
||||
static bool run_test(cl_context context, cl_command_queue queue, cl_program clprog,
|
||||
cl_program bcprog, const std::string& kernel_name, std::string& err, const cl_device_id device)
|
||||
{
|
||||
WorkSizeInfo ws;
|
||||
TestResult cl_result;
|
||||
std::auto_ptr<TestResult> bc_result;
|
||||
// first, run the single CL test
|
||||
{
|
||||
// make sure that the kernel will be released before the program
|
||||
clKernelWrapper kernel = create_kernel_helper(clprog, kernel_name);
|
||||
// based on the kernel characteristics, we are generating and initializing the arguments for both phases (cl and bc executions)
|
||||
generate_kernel_data(context, kernel, ws, cl_result);
|
||||
bc_result.reset(cl_result.clone(context, ws, kernel, device));
|
||||
assert (compare_results(cl_result, *bc_result) && "not equal?");
|
||||
run_kernel( kernel, queue, ws, cl_result );
|
||||
}
|
||||
// now, run the single BC test
|
||||
{
|
||||
// make sure that the kernel will be released before the program
|
||||
clKernelWrapper kernel = create_kernel_helper(bcprog, kernel_name);
|
||||
run_kernel( kernel, queue, ws, *bc_result );
|
||||
}
|
||||
|
||||
int error = clFinish(queue);
|
||||
if( CL_SUCCESS != error)
|
||||
{
|
||||
err = "clFinish failed\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
// compare the results
|
||||
if( !compare_results(cl_result, *bc_result) )
|
||||
{
|
||||
err = " (result diff in kernel '" + kernel_name + "').";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
TestRunner::TestRunner(EventHandler *success, EventHandler *failure,
|
||||
const OclExtensions& devExt):
|
||||
m_successHandler(success), m_failureHandler(failure), m_devExt(&devExt) {}
|
||||
|
||||
/**
|
||||
Based on the test name build the cl file name, the bc file name and execute
|
||||
the kernel for both modes (cl and bc).
|
||||
*/
|
||||
bool TestRunner::runBuildTest(cl_device_id device, const char *folder,
|
||||
const char *test_name, cl_uint size_t_width)
|
||||
{
|
||||
int failures = 0;
|
||||
// Composing the name of the CSV file.
|
||||
char* dir = get_exe_dir();
|
||||
std::string csvName(dir);
|
||||
csvName.append(dir_sep());
|
||||
csvName.append("khr.csv");
|
||||
free(dir);
|
||||
|
||||
log_info("%s...\n", test_name);
|
||||
|
||||
// Figure out whether the test can run on the device. If not, we skip it.
|
||||
const KhrSupport& khrDb = *KhrSupport::get(csvName);
|
||||
cl_bool images = khrDb.isImagesRequired(folder, test_name);
|
||||
cl_bool images3D = khrDb.isImages3DRequired(folder, test_name);
|
||||
|
||||
char deviceProfile[64];
|
||||
clGetDeviceInfo(device, CL_DEVICE_PROFILE, sizeof(deviceProfile), &deviceProfile, NULL);
|
||||
std::string device_profile(deviceProfile, 64);
|
||||
|
||||
if(images == CL_TRUE && checkForImageSupport(device) != 0)
|
||||
{
|
||||
(*m_successHandler)(test_name, "");
|
||||
std::cout << "Skipped. (Cannot run on device due to Images is not supported)." << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(images3D == CL_TRUE && checkFor3DImageSupport(device) != 0)
|
||||
{
|
||||
(*m_successHandler)(test_name, "");
|
||||
std::cout << "Skipped. (Cannot run on device as 3D images are not supported)." << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
OclExtensions requiredExt = khrDb.getRequiredExtensions(folder, test_name);
|
||||
if(!m_devExt->supports(requiredExt))
|
||||
{
|
||||
(*m_successHandler)(test_name, "");
|
||||
std::cout << "Skipped. (Cannot run on device due to missing extensions: " << m_devExt->get_missing(requiredExt) << " )." << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string cl_file_path, bc_file;
|
||||
// Build cl file name based on the test name
|
||||
get_cl_file_path(folder, test_name, cl_file_path);
|
||||
// Build bc file name based on the test name
|
||||
get_bc_file_path(folder, test_name, bc_file, size_t_width);
|
||||
gRG.init(1);
|
||||
//
|
||||
// Processing each kernel in the program separately
|
||||
//
|
||||
clContextWrapper context;
|
||||
clCommandQueueWrapper queue;
|
||||
create_context_and_queue(device, &context, &queue);
|
||||
clProgramWrapper clprog = create_program_from_cl(context, cl_file_path);
|
||||
clProgramWrapper bcprog = create_program_from_bc(context, bc_file);
|
||||
|
||||
// Building the programs.
|
||||
BuildTask clBuild(clprog, device, "-cl-kernel-arg-info");
|
||||
if (!clBuild.execute()) {
|
||||
std::cerr << clBuild.getErrorLog() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
SpirBuildTask bcBuild(bcprog, device, "-x spir -spir-std=1.2 -cl-kernel-arg-info");
|
||||
if (!bcBuild.execute()) {
|
||||
std::cerr << bcBuild.getErrorLog() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
KernelEnumerator clkernel_enumerator(clprog),
|
||||
bckernel_enumerator(bcprog);
|
||||
if (clkernel_enumerator.size() != bckernel_enumerator.size()) {
|
||||
std::cerr << "number of kernels in test" << test_name
|
||||
<< " doesn't match in bc and cl files" << std::endl;
|
||||
return false;
|
||||
}
|
||||
KernelEnumerator::iterator it = clkernel_enumerator.begin(),
|
||||
e = clkernel_enumerator.end();
|
||||
while (it != e)
|
||||
{
|
||||
std::string kernel_name = *it++;
|
||||
std::string err;
|
||||
try
|
||||
{
|
||||
bool success = run_test(context, queue, clprog, bcprog, kernel_name, err, device);
|
||||
if (success)
|
||||
{
|
||||
log_info("kernel '%s' passed.\n", kernel_name.c_str());
|
||||
(*m_successHandler)(test_name, kernel_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
++failures;
|
||||
log_info("kernel '%s' failed.\n", kernel_name.c_str());
|
||||
(*m_failureHandler)(test_name, kernel_name);
|
||||
}
|
||||
}
|
||||
catch (std::runtime_error err)
|
||||
{
|
||||
++failures;
|
||||
log_info("kernel '%s' failed: %s\n", kernel_name.c_str(), err.what());
|
||||
(*m_failureHandler)(test_name, kernel_name);
|
||||
}
|
||||
}
|
||||
|
||||
log_info("%s %s\n", test_name, failures ? "FAILED" : "passed.");
|
||||
return failures == 0;
|
||||
}
|
||||
|
||||
145
test_conformance/spir/run_build_test.h
Normal file
145
test_conformance/spir/run_build_test.h
Normal file
@@ -0,0 +1,145 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef __RUN_BUILD_TEST_H__
|
||||
#define __RUN_BUILD_TEST_H__
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
class OclExtensions;
|
||||
|
||||
struct EventHandler{
|
||||
virtual void operator()(const std::string&, const std::string&) = 0;
|
||||
virtual std::string toString()const {return std::string();}
|
||||
};
|
||||
|
||||
/*
|
||||
* Abstract task to be executed on a cl program.
|
||||
*/
|
||||
class Task{
|
||||
public:
|
||||
Task(cl_device_id, const char* options);
|
||||
|
||||
virtual bool execute() = 0;
|
||||
|
||||
virtual ~Task();
|
||||
|
||||
const char* getErrorLog() const;
|
||||
|
||||
protected:
|
||||
void setErrorLog(cl_program);
|
||||
|
||||
cl_device_id m_devid;
|
||||
std::string m_log;
|
||||
std::string m_options;
|
||||
};
|
||||
|
||||
/*
|
||||
* Build task - builds a given program.
|
||||
*/
|
||||
class BuildTask: public Task {
|
||||
public:
|
||||
BuildTask(cl_program, cl_device_id, const char* options);
|
||||
|
||||
bool execute();
|
||||
|
||||
private:
|
||||
cl_program m_program;
|
||||
};
|
||||
|
||||
/*
|
||||
* Spir build task - build programs from SPIR binaries.
|
||||
*/
|
||||
class SpirBuildTask : public BuildTask {
|
||||
public:
|
||||
SpirBuildTask(cl_program, cl_device_id, const char* options);
|
||||
};
|
||||
|
||||
/*
|
||||
* Compile task - compiles a given program.
|
||||
*/
|
||||
class CompileTask: public Task {
|
||||
public:
|
||||
CompileTask(cl_program, cl_device_id, const char* options);
|
||||
|
||||
void addHeader(const char* hname, cl_program hprog);
|
||||
|
||||
bool execute();
|
||||
|
||||
private:
|
||||
std::vector<std::pair<const char*,cl_program> > m_headers;
|
||||
cl_program m_program;
|
||||
};
|
||||
|
||||
/*
|
||||
* Spir compile task - compiles programs from SPIR binaries.
|
||||
*/
|
||||
class SpirCompileTask: public CompileTask {
|
||||
public:
|
||||
SpirCompileTask(cl_program, cl_device_id, const char* options);
|
||||
};
|
||||
|
||||
/*
|
||||
* Link task - links a given programs to an OpecnCL executable.
|
||||
*/
|
||||
class LinkTask: public Task{
|
||||
public:
|
||||
LinkTask(cl_program* programs, int num_programs, cl_context, cl_device_id,
|
||||
const char* options=NULL);
|
||||
|
||||
bool execute();
|
||||
|
||||
cl_program getExecutable() const;
|
||||
|
||||
~LinkTask();
|
||||
private:
|
||||
cl_program m_executable;
|
||||
cl_program* m_programs;
|
||||
int m_numPrograms;
|
||||
cl_context m_context;
|
||||
};
|
||||
|
||||
class TestRunner{
|
||||
EventHandler*const m_successHandler, *const m_failureHandler;
|
||||
const OclExtensions *m_devExt;
|
||||
|
||||
public:
|
||||
TestRunner(EventHandler *success, EventHandler *failure,
|
||||
const OclExtensions& devExt);
|
||||
|
||||
bool runBuildTest(cl_device_id device, const char *folder,
|
||||
const char *test_name, cl_uint size_t_width);
|
||||
};
|
||||
|
||||
//
|
||||
//Provides means to iterate over the kernels of a given program
|
||||
//
|
||||
class KernelEnumerator {
|
||||
std::list<std::string> m_kernels;
|
||||
|
||||
void process(cl_program prog);
|
||||
public:
|
||||
typedef std::list<std::string>::iterator iterator;
|
||||
|
||||
KernelEnumerator(cl_program prog);
|
||||
iterator begin();
|
||||
iterator end();
|
||||
size_t size()const;
|
||||
};
|
||||
|
||||
#endif//__RUN_BUILD_TEST_H__
|
||||
767
test_conformance/spir/run_services.cpp
Normal file
767
test_conformance/spir/run_services.cpp
Normal file
@@ -0,0 +1,767 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#include "../../test_common/harness/compat.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/opencl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
||||
#include "exceptions.h"
|
||||
#include "datagen.h"
|
||||
#include "run_services.h"
|
||||
|
||||
#define XSTR(A) STR(A)
|
||||
#define STR(A) #A
|
||||
|
||||
/**
|
||||
Based on the folder and the input string build the cl file nanme
|
||||
*/
|
||||
void get_cl_file_path (const char *folder, const char *test_name, std::string &cl_file_path)
|
||||
{
|
||||
assert(folder && "folder is empty");
|
||||
assert(test_name && "test_name is empty");
|
||||
|
||||
cl_file_path.append(folder);
|
||||
cl_file_path.append("/");
|
||||
cl_file_path.append(test_name);
|
||||
cl_file_path.append(".cl");
|
||||
}
|
||||
|
||||
/**
|
||||
Based on the folder and the input string build the bc file nanme
|
||||
*/
|
||||
void get_bc_file_path (const char *folder, const char *test_name, std::string &bc_file_path, cl_uint size_t_width)
|
||||
{
|
||||
assert(folder && "folder is empty");
|
||||
assert(test_name && "test_name is empty");
|
||||
bc_file_path.append(folder);
|
||||
bc_file_path.append("/");
|
||||
bc_file_path.append(test_name);
|
||||
if (32 == size_t_width)
|
||||
bc_file_path.append(".bc32");
|
||||
else
|
||||
bc_file_path.append(".bc64");
|
||||
}
|
||||
|
||||
/**
|
||||
Based on the folder and the input string build the h file nanme
|
||||
*/
|
||||
void get_h_file_path (const char *folder, const char *file_name, std::string &h_file_path)
|
||||
{
|
||||
assert(folder && "folder is empty");
|
||||
assert(file_name && "file_name is empty");
|
||||
|
||||
h_file_path.assign(folder);
|
||||
h_file_path.append("/");
|
||||
h_file_path.append(file_name);
|
||||
}
|
||||
|
||||
/**
|
||||
Fetch the kernel nanme from the test name
|
||||
*/
|
||||
void get_kernel_name (const char *test_name, std::string &kernel_name)
|
||||
{
|
||||
char *temp_str, *p;
|
||||
std::string temp;
|
||||
|
||||
temp.assign(test_name);
|
||||
|
||||
// Check if the test name includes '.' -
|
||||
// the convention is that the test's kernel name is embedded in the test name up to the first '.'
|
||||
temp_str = (char *)temp.c_str();
|
||||
p = strstr(temp_str, ".");
|
||||
if (p != NULL)
|
||||
{
|
||||
*p = '\0';
|
||||
}
|
||||
kernel_name.assign(temp_str);
|
||||
}
|
||||
|
||||
extern "C" void CL_CALLBACK notify_callback(const char *errInfo, const void *privateInfo, size_t cb, void *userData);
|
||||
|
||||
void create_context_and_queue(cl_device_id device, cl_context *out_context, cl_command_queue *out_queue)
|
||||
{
|
||||
assert( out_context && "out_context arg must be a valid pointer");
|
||||
assert( out_queue && "out_queue arg must be a valid pointer");
|
||||
|
||||
int error = CL_SUCCESS;
|
||||
|
||||
*out_context = clCreateContext( NULL, 1, &device, notify_callback, NULL, &error );
|
||||
if( NULL == *out_context || error != CL_SUCCESS)
|
||||
{
|
||||
throw Exceptions::TestError("clCreateContext failed\n", error);
|
||||
}
|
||||
|
||||
*out_queue = clCreateCommandQueueWithProperties( *out_context, device, 0, &error );
|
||||
if( NULL == *out_queue || error )
|
||||
{
|
||||
throw Exceptions::TestError("clCreateCommandQueue failed\n", error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Loads the kernel text from the given text file
|
||||
*/
|
||||
std::string load_file_cl( const std::string& file_name)
|
||||
{
|
||||
std::ifstream ifs(file_name.c_str());
|
||||
if( !ifs.good() )
|
||||
throw Exceptions::TestError("Can't load the cl File " + file_name, 1);
|
||||
std::string str( ( std::istreambuf_iterator<char>( ifs ) ), std::istreambuf_iterator<char>());
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
Loads the kernel IR from the given binary file in SPIR BC format
|
||||
*/
|
||||
void* load_file_bc( const std::string& file_name, size_t *binary_size)
|
||||
{
|
||||
assert(binary_size && "binary_size arg should be valid");
|
||||
|
||||
std::ifstream file(file_name.c_str(), std::ios::binary);
|
||||
|
||||
if( !file.good() )
|
||||
{
|
||||
throw Exceptions::TestError("Can't load the bc File " + file_name, 1);
|
||||
}
|
||||
|
||||
file.seekg(0, std::ios::end);
|
||||
*binary_size = (size_t)file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
|
||||
void* buffer = malloc(*binary_size);
|
||||
file.read((char*)buffer, *binary_size);
|
||||
file.close();
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
Create program from the CL source file
|
||||
*/
|
||||
cl_program create_program_from_cl(cl_context context, const std::string& file_name)
|
||||
{
|
||||
std::string text_file = load_file_cl(file_name);
|
||||
const char* text_str = text_file.c_str();
|
||||
int error = CL_SUCCESS;
|
||||
|
||||
cl_program program = clCreateProgramWithSource( context, 1, &text_str, NULL, &error );
|
||||
if( program == NULL || error != CL_SUCCESS)
|
||||
{
|
||||
throw Exceptions::TestError("Error creating program\n", error);
|
||||
}
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
/**
|
||||
Create program from the BC source file
|
||||
*/
|
||||
cl_program create_program_from_bc (cl_context context, const std::string& file_name)
|
||||
{
|
||||
cl_int load_error = CL_SUCCESS;
|
||||
cl_int error;
|
||||
size_t binary_size;
|
||||
BufferOwningPtr<const unsigned char> binary(load_file_bc(file_name, &binary_size));
|
||||
const unsigned char* ptr = binary;
|
||||
|
||||
cl_device_id device = get_context_device(context);
|
||||
cl_program program = clCreateProgramWithBinary( context, 1, &device, &binary_size, &ptr, &load_error, &error );
|
||||
|
||||
|
||||
if( program == NULL || error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("clCreateProgramWithBinary failed: Unable to load valid program binary\n", error);
|
||||
}
|
||||
|
||||
if( load_error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("clCreateProgramWithBinary failed: Unable to load valid device binary into program\n", load_error);
|
||||
}
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
/**
|
||||
Creates the kernel with the given name from the given program.
|
||||
*/
|
||||
cl_kernel create_kernel_helper( cl_program program, const std::string& kernel_name )
|
||||
{
|
||||
int error = CL_SUCCESS;
|
||||
cl_kernel kernel = NULL;
|
||||
cl_device_id device = get_program_device(program);
|
||||
/* And create a kernel from it */
|
||||
kernel = clCreateKernel( program, kernel_name.c_str(), &error );
|
||||
if( kernel == NULL || error != CL_SUCCESS)
|
||||
throw Exceptions::TestError("Unable to create kernel\n", error);
|
||||
return kernel;
|
||||
}
|
||||
|
||||
cl_device_id get_context_device (cl_context context)
|
||||
{
|
||||
cl_device_id device[1];
|
||||
|
||||
int error = clGetContextInfo(context, CL_CONTEXT_DEVICES, sizeof(device), device, NULL);
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("clGetContextInfo failed\n", error);
|
||||
}
|
||||
|
||||
return device[0];
|
||||
}
|
||||
|
||||
cl_device_id get_program_device (cl_program program)
|
||||
{
|
||||
cl_device_id device[1];
|
||||
|
||||
int error = clGetProgramInfo(program, CL_PROGRAM_DEVICES, sizeof(device), device, NULL);
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("clGetProgramInfo failed\n", error);
|
||||
}
|
||||
|
||||
return device[0];
|
||||
}
|
||||
|
||||
void generate_kernel_ws( cl_device_id device, cl_kernel kernel, WorkSizeInfo& ws)
|
||||
{
|
||||
size_t compile_work_group_size[MAX_WORK_DIM];
|
||||
|
||||
memset(&ws, 0, sizeof(WorkSizeInfo));
|
||||
ws.work_dim = 1;
|
||||
ws.global_work_size[0] = (GLOBAL_WORK_SIZE <= 32) ? GLOBAL_WORK_SIZE : 32; // kernels limitations
|
||||
ws.local_work_size[0] = ((GLOBAL_WORK_SIZE % 4) == 0) ? (GLOBAL_WORK_SIZE / 4) : (GLOBAL_WORK_SIZE / 2);
|
||||
|
||||
//Check if the kernel was compiled with specific work group size
|
||||
int error = clGetKernelWorkGroupInfo(kernel, device, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, sizeof(compile_work_group_size), &compile_work_group_size, NULL);
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("clGetKernelWorkGroupInfo failed\n", error);
|
||||
}
|
||||
|
||||
// if compile_work_group_size[0] is not 0 - use the compiled values
|
||||
if ( 0 != compile_work_group_size[0] )
|
||||
{
|
||||
// the kernel compiled with __attribute__((reqd_work_group_size(X, Y, Z)))
|
||||
memcpy(ws.global_work_size, compile_work_group_size, sizeof(ws.global_work_size));
|
||||
|
||||
// Now, check the correctness of the local work size and fix it if necessary
|
||||
for ( int i = 0; i < MAX_WORK_DIM; ++i )
|
||||
{
|
||||
if ( ws.local_work_size[i] > compile_work_group_size[i] )
|
||||
{
|
||||
ws.local_work_size[i] = compile_work_group_size[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TestResult* TestResult::clone(cl_context ctx, const WorkSizeInfo& ws, const cl_kernel kernel, const cl_device_id device) const
|
||||
{
|
||||
TestResult *cpy = new TestResult();
|
||||
|
||||
for (size_t i=0; i<m_kernelArgs.getArgCount(); ++i)
|
||||
cpy->m_kernelArgs.addArg(m_kernelArgs.getArg(i)->clone(ctx, ws, kernel, device));
|
||||
|
||||
return cpy;
|
||||
}
|
||||
|
||||
/*
|
||||
* class DataRow
|
||||
*/
|
||||
|
||||
const std::string& DataRow::operator[](int column)const
|
||||
{
|
||||
assert((column > -1 && (size_t)column < m_row.size()) && "Index out of bound");
|
||||
return m_row[column];
|
||||
}
|
||||
|
||||
std::string& DataRow::operator[](int column)
|
||||
{
|
||||
assert((column > -1) && "Index out of bound");
|
||||
|
||||
if ((size_t)column < m_row.size())
|
||||
return m_row[column];
|
||||
|
||||
if (column == m_row.size())
|
||||
{
|
||||
m_row.push_back("");
|
||||
return m_row[column];
|
||||
}
|
||||
|
||||
assert(0 && "Index out of bound.");
|
||||
}
|
||||
|
||||
/*
|
||||
* class DataTable
|
||||
*/
|
||||
|
||||
size_t DataTable::getNumRows() const
|
||||
{
|
||||
return m_rows.size();
|
||||
}
|
||||
|
||||
void DataTable::addTableRow(DataRow *dr)
|
||||
{
|
||||
m_rows.push_back(dr);
|
||||
}
|
||||
|
||||
const DataRow& DataTable::operator[](int index)const
|
||||
{
|
||||
assert((index > -1 && (size_t)index < m_rows.size()) && "Index out of bound");
|
||||
return *m_rows[index];
|
||||
}
|
||||
|
||||
DataRow& DataTable::operator[](int index)
|
||||
{
|
||||
assert((index > -1 && (size_t)index < m_rows.size()) && "Index out of bound");
|
||||
return *m_rows[index];
|
||||
}
|
||||
|
||||
/*
|
||||
* class OclExtensions
|
||||
*/
|
||||
OclExtensions OclExtensions::getDeviceCapabilities(cl_device_id devId)
|
||||
{
|
||||
char extensions[1024] = {0};
|
||||
size_t size;
|
||||
|
||||
// Querying the device for its supported extensions
|
||||
cl_int errcode = clGetDeviceInfo(devId,
|
||||
CL_DEVICE_EXTENSIONS,
|
||||
sizeof(extensions),
|
||||
extensions,
|
||||
&size);
|
||||
if (errcode)
|
||||
throw Exceptions::TestError("Device query failed");
|
||||
|
||||
char device_profile[1024] = {0};
|
||||
errcode = clGetDeviceInfo(devId,
|
||||
CL_DEVICE_PROFILE,
|
||||
sizeof(device_profile),
|
||||
device_profile,
|
||||
NULL);
|
||||
if (errcode)
|
||||
throw Exceptions::TestError("Device query failed");
|
||||
|
||||
OclExtensions ret = OclExtensions::empty();
|
||||
assert(size < sizeof(extensions));
|
||||
if (!size)
|
||||
return ret;
|
||||
|
||||
// Iterate over the extensions, and convert them into the bit field.
|
||||
std::list<std::string> extVector;
|
||||
std::stringstream khrStream(extensions);
|
||||
std::copy(std::istream_iterator<std::string>(khrStream),
|
||||
std::istream_iterator<std::string>(),
|
||||
std::back_inserter(extVector));
|
||||
|
||||
// full_profile devices supports embedded profile as core feature
|
||||
if ( std::string( device_profile ) == "FULL_PROFILE" ) {
|
||||
extVector.push_back("cles_khr_int64");
|
||||
extVector.push_back("cles_khr_2d_image_array_writes");
|
||||
}
|
||||
|
||||
for(std::list<std::string>::const_iterator it = extVector.begin(),
|
||||
e = extVector.end(); it != e;
|
||||
it++)
|
||||
{
|
||||
ret = ret | OclExtensions::fromString(*it);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
OclExtensions OclExtensions::empty()
|
||||
{
|
||||
return OclExtensions(0);
|
||||
}
|
||||
|
||||
OclExtensions OclExtensions::fromString(const std::string& e)
|
||||
{
|
||||
std::string s = "OclExtensions::" + e;
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_int64_base_atomics);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_int64_extended_atomics);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_3d_image_writes);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_fp16);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_gl_sharing);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_gl_event);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_d3d10_sharing);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_dx9_media_sharing);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_d3d11_sharing);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_depth_images);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_gl_depth_images);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_gl_msaa_sharing);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_image2d_from_buffer);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_initialize_memory);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_spir);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_fp64);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_global_int32_base_atomics);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_global_int32_extended_atomics);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_local_int32_base_atomics);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_local_int32_extended_atomics);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cl_khr_byte_addressable_store);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cles_khr_int64);
|
||||
RETURN_IF_ENUM(s, OclExtensions::cles_khr_2d_image_array_writes);
|
||||
// Unknown KHR string.
|
||||
return OclExtensions::empty();
|
||||
}
|
||||
|
||||
std::string OclExtensions::toString()
|
||||
{
|
||||
|
||||
#define APPEND_STR_IF_SUPPORTS( STR, E) \
|
||||
if ( this->supports(E) ) \
|
||||
{ \
|
||||
std::string ext_str( #E ); \
|
||||
std::string prefix = "OclExtensions::"; \
|
||||
size_t pos = ext_str.find( prefix ); \
|
||||
if ( pos != std::string::npos ) \
|
||||
{ \
|
||||
ext_str.replace( pos, prefix.length(), ""); \
|
||||
} \
|
||||
STR += ext_str; \
|
||||
}
|
||||
|
||||
std::string s = "";
|
||||
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_int64_base_atomics );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_int64_extended_atomics );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_3d_image_writes );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_fp16 );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_gl_sharing );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_gl_event );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_d3d10_sharing );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_dx9_media_sharing );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_d3d11_sharing );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_depth_images );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_gl_depth_images );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_gl_msaa_sharing );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_image2d_from_buffer );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_initialize_memory );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_spir );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_fp64 );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_global_int32_base_atomics );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_global_int32_extended_atomics );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_local_int32_base_atomics );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_local_int32_extended_atomics );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cl_khr_byte_addressable_store );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cles_khr_int64 );
|
||||
APPEND_STR_IF_SUPPORTS( s, OclExtensions::cles_khr_2d_image_array_writes );
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, OclExtensions ext)
|
||||
{
|
||||
return os << ext.toString();
|
||||
}
|
||||
|
||||
OclExtensions OclExtensions::operator|(const OclExtensions& b) const
|
||||
{
|
||||
return OclExtensions(m_extVector | b.m_extVector);
|
||||
}
|
||||
|
||||
bool OclExtensions::supports(const OclExtensions& b) const
|
||||
{
|
||||
return ((b.m_extVector & m_extVector) == b.m_extVector);
|
||||
}
|
||||
|
||||
OclExtensions OclExtensions::get_missing(const OclExtensions& b) const
|
||||
{
|
||||
return OclExtensions( b.m_extVector & ( ~ m_extVector ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* class KhrSupport
|
||||
*/
|
||||
|
||||
KhrSupport *KhrSupport::m_instance = NULL;
|
||||
|
||||
const KhrSupport* KhrSupport::get(const std::string& path)
|
||||
{
|
||||
if(m_instance)
|
||||
return m_instance;
|
||||
|
||||
m_instance = new KhrSupport();
|
||||
// First invokation, parse the file into memory.
|
||||
std::fstream csv(path.c_str(), std::ios_base::in);
|
||||
if (!csv.is_open())
|
||||
{
|
||||
delete m_instance;
|
||||
std::string msg;
|
||||
msg.append("File ");
|
||||
msg.append(path);
|
||||
msg.append(" cannot be opened");
|
||||
throw Exceptions::TestError(msg.c_str());
|
||||
}
|
||||
|
||||
m_instance->parseCSV(csv);
|
||||
csv.close();
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
void KhrSupport::parseCSV(std::fstream& f)
|
||||
{
|
||||
assert(f.is_open() && "file is not in reading state.") ;
|
||||
char line[1024];
|
||||
while (!f.getline(line, sizeof(line)).eof())
|
||||
{
|
||||
DataRow *dr = parseLine(std::string(line));
|
||||
m_dt.addTableRow(dr);
|
||||
}
|
||||
}
|
||||
|
||||
DataRow* KhrSupport::parseLine(const std::string& line)
|
||||
{
|
||||
const char DELIM = ',';
|
||||
std::string token;
|
||||
DataRow *dr = new DataRow();
|
||||
int tIndex = 0;
|
||||
|
||||
for(std::string::const_iterator it = line.begin(), e = line.end(); it != e;
|
||||
it++)
|
||||
{
|
||||
// Eat those characters away.
|
||||
if(isspace(*it) || '"' == *it)
|
||||
continue;
|
||||
|
||||
// If that's a delimiter, we need to tokenize the collected value.
|
||||
if(*it == DELIM)
|
||||
{
|
||||
(*dr)[tIndex++] = token;
|
||||
token.clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Append to current token.
|
||||
token.append(1U, *it);
|
||||
}
|
||||
if (!token.empty())
|
||||
(*dr)[tIndex] = token;
|
||||
|
||||
assert(tIndex && "empty data row??");
|
||||
return dr;
|
||||
}
|
||||
|
||||
OclExtensions KhrSupport::getRequiredExtensions(const char* suite, const char* test) const
|
||||
{
|
||||
OclExtensions ret = OclExtensions::empty();
|
||||
|
||||
const std::string strSuite(suite), strTest(test);
|
||||
// Iterating on the DataTable, searching whether the row with th requested
|
||||
// row exists.
|
||||
for(size_t rowIndex = 0; rowIndex < m_dt.getNumRows(); rowIndex++)
|
||||
{
|
||||
const DataRow& dr = m_dt[rowIndex];
|
||||
const std::string csvSuite = dr[SUITE_INDEX], csvTest = dr[TEST_INDEX];
|
||||
bool sameSuite = (csvSuite == strSuite), sameTest = (csvTest == strTest)||(csvTest == "*");
|
||||
if (sameTest && sameSuite)
|
||||
{
|
||||
ret = ret | OclExtensions::fromString(dr[EXT_INDEX]);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
cl_bool KhrSupport::isImagesRequired(const char* suite, const char* test) const
|
||||
{
|
||||
cl_bool ret = CL_FALSE;
|
||||
const std::string strSuite(suite), strTest(test);
|
||||
|
||||
// Iterating on the DataTable, searching whether the row with th requested
|
||||
// row exists.
|
||||
for(size_t rowIndex = 0; rowIndex < m_dt.getNumRows(); rowIndex++)
|
||||
{
|
||||
const DataRow& dr = m_dt[rowIndex];
|
||||
const std::string csvSuite = dr[SUITE_INDEX], csvTest = dr[TEST_INDEX];
|
||||
bool sameSuite = (csvSuite == strSuite), sameTest = (csvTest == strTest)||(csvTest == "*");
|
||||
if (sameTest && sameSuite)
|
||||
{
|
||||
ret = (dr[IMAGES_INDEX] == "CL_TRUE") ? CL_TRUE : CL_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
cl_bool KhrSupport::isImages3DRequired(const char* suite, const char* test) const
|
||||
{
|
||||
cl_bool ret = CL_FALSE;
|
||||
const std::string strSuite(suite), strTest(test);
|
||||
|
||||
// Iterating on the DataTable, searching whether the row with th requested
|
||||
// row exists.
|
||||
for(size_t rowIndex = 0; rowIndex < m_dt.getNumRows(); rowIndex++)
|
||||
{
|
||||
const DataRow& dr = m_dt[rowIndex];
|
||||
const std::string csvSuite = dr[SUITE_INDEX], csvTest = dr[TEST_INDEX];
|
||||
bool sameSuite = (csvSuite == strSuite), sameTest = (csvTest == strTest)||(csvTest == "*");
|
||||
if (sameTest && sameSuite)
|
||||
{
|
||||
ret = (dr[IMAGES_3D_INDEX] == "CL_TRUE") ? CL_TRUE : CL_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void generate_kernel_args(cl_context context, cl_kernel kernel, const WorkSizeInfo& ws, KernelArgs& cl_args, const cl_device_id device)
|
||||
{
|
||||
int error = CL_SUCCESS;
|
||||
cl_uint num_args = 0;
|
||||
KernelArg* cl_arg = NULL;
|
||||
DataGenerator* dg = DataGenerator::getInstance();
|
||||
|
||||
error = clGetKernelInfo( kernel, CL_KERNEL_NUM_ARGS, sizeof( num_args ), &num_args, NULL );
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("Unable to get kernel arg count\n", error);
|
||||
}
|
||||
|
||||
for ( cl_uint j = 0; j < num_args; ++j )
|
||||
{
|
||||
KernelArgInfo kernel_arg_info;
|
||||
size_t size;
|
||||
const int max_name_len = 512;
|
||||
char name[max_name_len];
|
||||
|
||||
// Try to get the address qualifier of each argument.
|
||||
error = clGetKernelArgInfo( kernel, j, CL_KERNEL_ARG_ADDRESS_QUALIFIER, sizeof(cl_kernel_arg_address_qualifier), kernel_arg_info.getAddressQualifierRef(), &size);
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("Unable to get argument address qualifier\n", error);
|
||||
}
|
||||
|
||||
// Try to get the access qualifier of each argument.
|
||||
error = clGetKernelArgInfo( kernel, j, CL_KERNEL_ARG_ACCESS_QUALIFIER, sizeof(cl_kernel_arg_access_qualifier), kernel_arg_info.getAccessQualifierRef(), &size );
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("Unable to get argument access qualifier\n", error);
|
||||
}
|
||||
|
||||
// Try to get the type qualifier of each argument.
|
||||
error = clGetKernelArgInfo( kernel, j, CL_KERNEL_ARG_TYPE_QUALIFIER, sizeof(cl_kernel_arg_type_qualifier), kernel_arg_info.getTypeQualifierRef(), &size );
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("Unable to get argument type qualifier\n", error);
|
||||
}
|
||||
|
||||
// Try to get the type of each argument.
|
||||
memset( name, 0, max_name_len );
|
||||
error = clGetKernelArgInfo(kernel, j, CL_KERNEL_ARG_TYPE_NAME, max_name_len, name, NULL );
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("Unable to get argument type name\n", error);
|
||||
}
|
||||
kernel_arg_info.setTypeName(name);
|
||||
|
||||
// Try to get the name of each argument.
|
||||
memset( name, 0, max_name_len );
|
||||
error = clGetKernelArgInfo( kernel, j, CL_KERNEL_ARG_NAME, max_name_len, name, NULL );
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("Unable to get argument name\n", error);
|
||||
}
|
||||
kernel_arg_info.setName(name);
|
||||
|
||||
cl_arg = dg->generateKernelArg(context, kernel_arg_info, ws, NULL, kernel, device);
|
||||
cl_args.addArg( cl_arg );
|
||||
}
|
||||
}
|
||||
|
||||
void set_kernel_args( cl_kernel kernel, KernelArgs& args)
|
||||
{
|
||||
int error = CL_SUCCESS;
|
||||
for( size_t i = 0; i < args.getArgCount(); ++ i )
|
||||
{
|
||||
error = clSetKernelArg( kernel, i, args.getArg(i)->getArgSize(), args.getArg(i)->getArgValue());
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("clSetKernelArg failed\n", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Run the single kernel
|
||||
*/
|
||||
void generate_kernel_data ( cl_context context, cl_kernel kernel, WorkSizeInfo &ws, TestResult& results)
|
||||
{
|
||||
cl_device_id device = get_context_device(context);
|
||||
generate_kernel_ws( device, kernel, ws);
|
||||
generate_kernel_args(context, kernel, ws, results.kernelArgs(), device);
|
||||
}
|
||||
|
||||
/**
|
||||
Run the single kernel
|
||||
*/
|
||||
void run_kernel( cl_kernel kernel, cl_command_queue queue, WorkSizeInfo &ws, TestResult& result )
|
||||
{
|
||||
clEventWrapper execute_event;
|
||||
|
||||
set_kernel_args(kernel, result.kernelArgs());
|
||||
|
||||
int error = clEnqueueNDRangeKernel( queue, kernel, ws.work_dim, ws.global_work_offset, ws.global_work_size, ws.local_work_size, 0, NULL, &execute_event );
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("clEnqueueNDRangeKernel failed\n", error);
|
||||
}
|
||||
|
||||
error = clWaitForEvents( 1, &execute_event );
|
||||
if( error != CL_SUCCESS )
|
||||
{
|
||||
throw Exceptions::TestError("clWaitForEvents failed\n", error);
|
||||
}
|
||||
|
||||
// read all the buffers back to host
|
||||
result.readToHost(queue);
|
||||
}
|
||||
|
||||
/**
|
||||
Compare two test results
|
||||
*/
|
||||
bool compare_results( const TestResult& lhs, const TestResult& rhs )
|
||||
{
|
||||
if( lhs.kernelArgs().getArgCount() != rhs.kernelArgs().getArgCount() )
|
||||
{
|
||||
log_error("number of kernel parameters differ between SPIR and CL version of the kernel\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
for( size_t i = 0 ; i < lhs.kernelArgs().getArgCount(); ++i )
|
||||
{
|
||||
if( ! lhs.kernelArgs().getArg(i)->compare( *rhs.kernelArgs().getArg(i)) )
|
||||
{
|
||||
log_error("the kernel parameter (%d) is different between SPIR and CL version of the kernel\n", i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
222
test_conformance/spir/run_services.h
Normal file
222
test_conformance/spir/run_services.h
Normal file
@@ -0,0 +1,222 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef __RUN_SERVICES_H
|
||||
#define __RUN_SERVICES_H
|
||||
|
||||
#include <string>
|
||||
#include "kernelargs.h"
|
||||
#include "datagen.h"
|
||||
#include <list>
|
||||
|
||||
void get_cl_file_path(const char *folder, const char *str, std::string &cl_file_path);
|
||||
void get_bc_file_path(const char *folder, const char *str, std::string &bc_file_path, cl_uint size_t_width);
|
||||
void get_h_file_path(const char *folder, const char *str, std::string &h_file_path);
|
||||
void get_kernel_name(const char *test_name, std::string &kernel_name);
|
||||
|
||||
cl_device_id get_context_device(cl_context context);
|
||||
|
||||
void create_context_and_queue(cl_device_id device, cl_context *out_context, cl_command_queue *out_queue);
|
||||
cl_program create_program_from_cl(cl_context context, const std::string& file_name);
|
||||
cl_program create_program_from_bc(cl_context context, const std::string& file_name);
|
||||
/**
|
||||
Retrieves the kernel with the given name from the program
|
||||
*/
|
||||
cl_kernel create_kernel_helper(cl_program program, const std::string& kernel_name);
|
||||
|
||||
cl_device_id get_program_device (cl_program program);
|
||||
|
||||
void generate_kernel_ws( cl_device_id device, cl_kernel kernel, WorkSizeInfo& ws);
|
||||
|
||||
/**
|
||||
Responsible for holding the result of a single test
|
||||
*/
|
||||
class TestResult
|
||||
{
|
||||
public:
|
||||
TestResult(){};
|
||||
|
||||
KernelArgs& kernelArgs() { return m_kernelArgs; }
|
||||
|
||||
const KernelArgs& kernelArgs() const { return m_kernelArgs; }
|
||||
|
||||
void readToHost(cl_command_queue queue) { m_kernelArgs.readToHost(queue); }
|
||||
|
||||
/*
|
||||
* Clones this object to a newly heap-allocated (deeply copied) object.
|
||||
*/
|
||||
TestResult* clone(cl_context ctx, const WorkSizeInfo& ws, const cl_kernel kernel, const cl_device_id device) const;
|
||||
|
||||
private:
|
||||
KernelArgs m_kernelArgs;
|
||||
};
|
||||
|
||||
template <int i>
|
||||
struct KhrValue
|
||||
{
|
||||
enum {Mask = (1 << i)};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct KhrValue<0>
|
||||
{
|
||||
enum {Mask = 1};
|
||||
};
|
||||
|
||||
/*
|
||||
* Represents a set of OpenCL extension.
|
||||
*/
|
||||
class OclExtensions
|
||||
{
|
||||
public:
|
||||
static OclExtensions getDeviceCapabilities(cl_device_id);
|
||||
|
||||
static OclExtensions empty();
|
||||
|
||||
#define STRINIGFY(X) #X
|
||||
|
||||
#define RETURN_IF_ENUM(S, E) if(S == STRINIGFY(E)) return E
|
||||
|
||||
|
||||
static OclExtensions fromString(const std::string&);
|
||||
|
||||
std::string toString();
|
||||
|
||||
// Operators
|
||||
|
||||
// Merges the given extension and this one together, and returns the merged
|
||||
// value.
|
||||
OclExtensions operator|(const OclExtensions&) const;
|
||||
|
||||
|
||||
// Indicates whether each extension in this objects also resides in b.
|
||||
bool supports(const OclExtensions& b) const;
|
||||
|
||||
// Return list of missing extensions
|
||||
OclExtensions get_missing(const OclExtensions& b) const;
|
||||
|
||||
|
||||
size_t get() const { return m_extVector; }
|
||||
private:
|
||||
|
||||
OclExtensions(size_t ext) : m_extVector(ext) {}
|
||||
|
||||
// Fix a compilation error, since cl_khr_gl_sharing is defined as a macro.
|
||||
#ifdef cl_khr_gl_sharing
|
||||
#undef cl_khr_gl_sharing
|
||||
#endif//cl_khr_gl_sharing
|
||||
|
||||
#ifdef cl_khr_icd
|
||||
#undef cl_khr_icd
|
||||
#endif//cl_khr_icd
|
||||
|
||||
enum ClKhrs
|
||||
{
|
||||
no_extensions = KhrValue<0>::Mask,
|
||||
cl_khr_int64_base_atomics = KhrValue<1>::Mask,
|
||||
cl_khr_int64_extended_atomics = KhrValue<2>::Mask,
|
||||
cl_khr_3d_image_writes = KhrValue<3>::Mask,
|
||||
cl_khr_fp16 = KhrValue<4>::Mask,
|
||||
cl_khr_gl_sharing = KhrValue<5>::Mask,
|
||||
cl_khr_gl_event = KhrValue<6>::Mask,
|
||||
cl_khr_d3d10_sharing = KhrValue<7>::Mask,
|
||||
cl_khr_dx9_media_sharing = KhrValue<8>::Mask,
|
||||
cl_khr_d3d11_sharing = KhrValue<9>::Mask,
|
||||
cl_khr_depth_images = KhrValue<10>::Mask,
|
||||
cl_khr_gl_depth_images = KhrValue<11>::Mask,
|
||||
cl_khr_gl_msaa_sharing = KhrValue<12>::Mask,
|
||||
cl_khr_image2d_from_buffer = KhrValue<13>::Mask,
|
||||
cl_khr_initialize_memory = KhrValue<14>::Mask,
|
||||
cl_khr_context_abort = KhrValue<15>::Mask,
|
||||
cl_khr_spir = KhrValue<16>::Mask,
|
||||
cl_khr_fp64 = KhrValue<17>::Mask,
|
||||
cl_khr_global_int32_base_atomics = KhrValue<18>::Mask,
|
||||
cl_khr_global_int32_extended_atomics = KhrValue<19>::Mask,
|
||||
cl_khr_local_int32_base_atomics = KhrValue<20>::Mask,
|
||||
cl_khr_local_int32_extended_atomics = KhrValue<21>::Mask,
|
||||
cl_khr_byte_addressable_store = KhrValue<22>::Mask,
|
||||
cles_khr_int64 = KhrValue<23>::Mask,
|
||||
cles_khr_2d_image_array_writes = KhrValue<24>::Mask,
|
||||
};
|
||||
|
||||
size_t m_extVector;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, OclExtensions ext);
|
||||
|
||||
/*
|
||||
* Indicates whether a given test needs KHR extension.
|
||||
*/
|
||||
|
||||
class DataRow;
|
||||
|
||||
class DataTable
|
||||
{
|
||||
std::vector<DataRow*> m_rows;
|
||||
public:
|
||||
size_t getNumRows() const;
|
||||
void addTableRow(DataRow*);
|
||||
const DataRow& operator[](int index)const;
|
||||
DataRow& operator[](int index);
|
||||
};
|
||||
|
||||
class KhrSupport
|
||||
{
|
||||
public:
|
||||
static const KhrSupport* get(const std::string& csvFile);
|
||||
DataRow* parseLine(const std::string&);
|
||||
OclExtensions getRequiredExtensions(const char* suite, const char* test) const;
|
||||
cl_bool isImagesRequired(const char* suite, const char* test) const;
|
||||
cl_bool isImages3DRequired(const char* suite, const char* test) const;
|
||||
|
||||
private:
|
||||
static const int SUITE_INDEX = 0;
|
||||
static const int TEST_INDEX = 1;
|
||||
static const int EXT_INDEX = 2;
|
||||
static const int IMAGES_INDEX = 3;
|
||||
static const int IMAGES_3D_INDEX = 4;
|
||||
|
||||
void parseCSV(std::fstream&);
|
||||
|
||||
DataTable m_dt;
|
||||
static KhrSupport* m_instance;
|
||||
};
|
||||
|
||||
class DataRow
|
||||
{
|
||||
std::vector<std::string> m_row;
|
||||
DataRow() {}
|
||||
public:
|
||||
const std::string& operator[](int)const;
|
||||
std::string& operator[](int);
|
||||
|
||||
friend DataRow* KhrSupport::parseLine(const std::string&);
|
||||
};
|
||||
|
||||
/*
|
||||
* Generates data for the given kernel.
|
||||
* Parameters:
|
||||
* context - The context of the kernel.
|
||||
* kernel - The kernel to which arguments will be generated
|
||||
* ws(OUT) - generated work size info.
|
||||
* res(OUT)- generated test results.
|
||||
*/
|
||||
void generate_kernel_data(cl_context context, cl_kernel kernel,
|
||||
WorkSizeInfo &ws, TestResult& res);
|
||||
|
||||
void run_kernel(cl_kernel kernel, cl_command_queue queue, WorkSizeInfo &ws, TestResult& result);
|
||||
bool compare_results(const TestResult& lhs, const TestResult& rhs);
|
||||
|
||||
#endif
|
||||
BIN
test_conformance/spir/sampler_enumeration.zip
Normal file
BIN
test_conformance/spir/sampler_enumeration.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/select.zip
Normal file
BIN
test_conformance/spir/select.zip
Normal file
Binary file not shown.
208
test_conformance/spir/typeinfo.h
Normal file
208
test_conformance/spir/typeinfo.h
Normal file
@@ -0,0 +1,208 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
TYPE_HNDL("_Bool", false, 0, 1, false, true, KernelArgGeneratorT<bool>)
|
||||
TYPE_HNDL("_Bool*", true, 0, 16, false, true, KernelArgGeneratorT<bool>)
|
||||
TYPE_HNDL("bool", false, 0, 1, false, true, KernelArgGeneratorT<bool>)
|
||||
TYPE_HNDL("bool*", true, 0, 16, false, true, KernelArgGeneratorT<bool>)
|
||||
TYPE_HNDL("char", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("char*", true, 0, 16, 0x0, 0x7f, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("char16", false, 0, 16, 0x0, 0x7f, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("char16*", true, 0, 16, 0x0, 0x7f, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("char2", false, 0, 2, 0x0, 0x7f, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("char2*", true, 0, 2, 0x0, 0x7f, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("char3", false, 0, 3, 0x0, 0x7f, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("char3*", true, 0, 3, 0x0, 0x7f, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("char4", false, 0, 4, 0x0, 0x7f, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("char4*", true, 0, 4, 0x0, 0x7f, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("char8", false, 0, 8, 0x0, 0x7f, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("char8*", true, 0, 8, 0x0, 0x7f, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("double", false, 0, 1, -0x40000000, 0x40000000, KernelArgGeneratorT<cl_double>)
|
||||
TYPE_HNDL("double*", true, 0, 16, -0x40000000, 0x40000000, KernelArgGeneratorT<cl_double>)
|
||||
TYPE_HNDL("double16", false, 0, 16, -0x40000000, 0x40000000, KernelArgGeneratorT<cl_double>)
|
||||
TYPE_HNDL("double16*", true, 0, 16, -0x40000000, 0x40000000, KernelArgGeneratorT<cl_double>)
|
||||
TYPE_HNDL("double2", false, 0, 2, -0x40000000, 0x40000000, KernelArgGeneratorT<cl_double>)
|
||||
TYPE_HNDL("double2*", true, 0, 2, -0x40000000, 0x40000000, KernelArgGeneratorT<cl_double>)
|
||||
TYPE_HNDL("double3", false, 0, 3, -0x40000000, 0x40000000, KernelArgGeneratorT<cl_double>)
|
||||
TYPE_HNDL("double3*", true, 0, 3, -0x40000000, 0x40000000, KernelArgGeneratorT<cl_double>)
|
||||
TYPE_HNDL("double4", false, 0, 4, -0x40000000, 0x40000000, KernelArgGeneratorT<cl_double>)
|
||||
TYPE_HNDL("double4*", true, 0, 4, -0x40000000, 0x40000000, KernelArgGeneratorT<cl_double>)
|
||||
TYPE_HNDL("double8", false, 0, 8, -0x40000000, 0x40000000, KernelArgGeneratorT<cl_double>)
|
||||
TYPE_HNDL("double8*", true, 0, 8, -0x40000000, 0x40000000, KernelArgGeneratorT<cl_double>)
|
||||
TYPE_HNDL("enum enum_type", false, 0, 1, 0, 2, KernelArgGeneratorT<cl_int>) // enum defines 0..2
|
||||
TYPE_HNDL("enum enum_type*", true, 0, 1, 0, 2, KernelArgGeneratorT<cl_int>) // enum defines 0..2
|
||||
TYPE_HNDL("float", false, 0, 1, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>)
|
||||
TYPE_HNDL("float*", true, 0, 16, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>)
|
||||
TYPE_HNDL("float16", false, 0, 16, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>)
|
||||
TYPE_HNDL("float16*", true, 0, 16, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>)
|
||||
TYPE_HNDL("float2", false, 0, 2, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>)
|
||||
TYPE_HNDL("float2*", true, 0, 2, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>)
|
||||
TYPE_HNDL("float3", false, 0, 3, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>)
|
||||
TYPE_HNDL("float3*", true, 0, 3, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>)
|
||||
TYPE_HNDL("float4", false, 0, 4, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>)
|
||||
TYPE_HNDL("float4*", true, 0, 4, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>)
|
||||
TYPE_HNDL("float8", false, 0, 8, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>)
|
||||
TYPE_HNDL("float8*", true, 0, 8, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>)
|
||||
TYPE_HNDL("half", false, 0, 1, 0x0, 0x7fff, KernelArgGeneratorT<cl_half>)
|
||||
TYPE_HNDL("half*", true, 0, 16, 0x0, 0x7fff, KernelArgGeneratorT<cl_half>)
|
||||
TYPE_HNDL("half16", false, 0, 16, 0x0, 0x7fff, KernelArgGeneratorT<cl_half>)
|
||||
TYPE_HNDL("half16*", true, 0, 16, 0x0, 0x7fff, KernelArgGeneratorT<cl_half>)
|
||||
TYPE_HNDL("half2", false, 0, 2, 0x0, 0x7fff, KernelArgGeneratorT<cl_half>)
|
||||
TYPE_HNDL("half2*", true, 0, 2, 0x0, 0x7fff, KernelArgGeneratorT<cl_half>)
|
||||
TYPE_HNDL("half3", false, 0, 3, 0x0, 0x7fff, KernelArgGeneratorT<cl_half>)
|
||||
TYPE_HNDL("half3*", true, 0, 3, 0x0, 0x7fff, KernelArgGeneratorT<cl_half>)
|
||||
TYPE_HNDL("half4", false, 0, 4, 0x0, 0x7fff, KernelArgGeneratorT<cl_half>)
|
||||
TYPE_HNDL("half4*", true, 0, 4, 0x0, 0x7fff, KernelArgGeneratorT<cl_half>)
|
||||
TYPE_HNDL("half8", false, 0, 8, 0x0, 0x7fff, KernelArgGeneratorT<cl_half>)
|
||||
TYPE_HNDL("half8*", true, 0, 8, 0x0, 0x7fff, KernelArgGeneratorT<cl_half>)
|
||||
TYPE_HNDL("image1d_array_t", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage1dArray<CL_SIGNED_INT32>)
|
||||
TYPE_HNDL("image1d_buffer_t", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage1dBuffer<CL_SIGNED_INT32>)
|
||||
TYPE_HNDL("image1d_t", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage1d<CL_SIGNED_INT32>)
|
||||
TYPE_HNDL("image2d_array_t", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage2dArray<CL_SIGNED_INT32>)
|
||||
TYPE_HNDL("image2d_t", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage2d<CL_SIGNED_INT32>)
|
||||
TYPE_HNDL("image3d_t", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage3d<CL_SIGNED_INT32>)
|
||||
TYPE_HNDL("image1d_array_float", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage1dArray<CL_FLOAT>)
|
||||
TYPE_HNDL("image1d_array_int", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage1dArray<CL_SIGNED_INT32>)
|
||||
TYPE_HNDL("image1d_array_uint", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage1dArray<CL_UNSIGNED_INT32>)
|
||||
TYPE_HNDL("image1d_buffer_float", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage1dBuffer<CL_FLOAT>)
|
||||
TYPE_HNDL("image1d_buffer_int", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage1dBuffer<CL_SIGNED_INT32>)
|
||||
TYPE_HNDL("image1d_buffer_uint", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage1dBuffer<CL_UNSIGNED_INT32>)
|
||||
TYPE_HNDL("image1d_float", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage1d<CL_FLOAT>)
|
||||
TYPE_HNDL("image1d_int", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage1d<CL_SIGNED_INT32>)
|
||||
TYPE_HNDL("image1d_uint", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage1d<CL_UNSIGNED_INT32>)
|
||||
TYPE_HNDL("image2d_array_float", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage2dArray<CL_FLOAT>)
|
||||
TYPE_HNDL("image2d_array_int", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage2dArray<CL_SIGNED_INT32>)
|
||||
TYPE_HNDL("image2d_array_uint", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage2dArray<CL_UNSIGNED_INT32>)
|
||||
TYPE_HNDL("image2d_float", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage2d<CL_FLOAT>)
|
||||
TYPE_HNDL("image2d_int", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage2d<CL_SIGNED_INT32>)
|
||||
TYPE_HNDL("image2d_uint", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage2d<CL_UNSIGNED_INT32>)
|
||||
TYPE_HNDL("image3d_float", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage3d<CL_FLOAT>)
|
||||
TYPE_HNDL("image3d_int", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage3d<CL_SIGNED_INT32>)
|
||||
TYPE_HNDL("image3d_uint", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorImage3d<CL_UNSIGNED_INT32>)
|
||||
TYPE_HNDL("image_kernel_data", false, 0, 1, 0x0, 0xffffffff, KernelStructTypeArgGenerator<image_kernel_data>) //image_kernel_data defines as 5 X int
|
||||
TYPE_HNDL("image_kernel_data*", true, 0, 1, 0x0, 0xffffffff, KernelStructTypeArgGenerator<image_kernel_data>) //image_kernel_data defines as 5 X int
|
||||
TYPE_HNDL("int", false, 0, 1, 0x0, 0x7fffffff, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("int*", true, 0, 16, 0x0, 0x7fffffff, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("int16", false, 0, 16, 0x0, 0x7fffffff, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("int16*", true, 0, 16, 0x0, 0x7fffffff, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("int2", false, 0, 2, 0x0, 0x7fffffff, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("int2*", true, 0, 2, 0x0, 0x7fffffff, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("int3", false, 0, 3, 0x0, 0x7fffffff, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("int3*", true, 0, 3, 0x0, 0x7fffffff, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("int4", false, 0, 4, 0x0, 0x7fffffff, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("int4*", true, 0, 4, 0x0, 0x7fffffff, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("int8", false, 0, 8, 0x0, 0x7fffffff, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("int8*", true, 0, 8, 0x0, 0x7fffffff, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("intptr_t", false, 0, 1, 0x0, 0xffffffff, KernelArgGeneratorT<size_t>)
|
||||
TYPE_HNDL("intptr_t*", true, 0, 1, 0x0, 0xffffffff, KernelArgGeneratorT<size_t>)
|
||||
TYPE_HNDL("long", false, 0, 1, 0x0, 0x7fffffffffffffff, KernelArgGeneratorT<cl_long>)
|
||||
TYPE_HNDL("long*", true, 0, 16, 0x0, 0x7fffffffffffffff, KernelArgGeneratorT<cl_long>)
|
||||
TYPE_HNDL("long16", false, 0, 16, 0x0, 0x7fffffffffffffff, KernelArgGeneratorT<cl_long>)
|
||||
TYPE_HNDL("long16*", true, 0, 16, 0x0, 0x7fffffffffffffff, KernelArgGeneratorT<cl_long>)
|
||||
TYPE_HNDL("long2", false, 0, 2, 0x0, 0x7fffffffffffffff, KernelArgGeneratorT<cl_long>)
|
||||
TYPE_HNDL("long2*", true, 0, 2, 0x0, 0x7fffffffffffffff, KernelArgGeneratorT<cl_long>)
|
||||
TYPE_HNDL("long3", false, 0, 3, 0x0, 0x7fffffffffffffff, KernelArgGeneratorT<cl_long>)
|
||||
TYPE_HNDL("long3*", true, 0, 3, 0x0, 0x7fffffffffffffff, KernelArgGeneratorT<cl_long>)
|
||||
TYPE_HNDL("long4", false, 0, 4, 0x0, 0x7fffffffffffffff, KernelArgGeneratorT<cl_long>)
|
||||
TYPE_HNDL("long4*", true, 0, 4, 0x0, 0x7fffffffffffffff, KernelArgGeneratorT<cl_long>)
|
||||
TYPE_HNDL("long8", false, 0, 8, 0x0, 0x7fffffffffffffff, KernelArgGeneratorT<cl_long>)
|
||||
TYPE_HNDL("long8*", true, 0, 8, 0x0, 0x7fffffffffffffff, KernelArgGeneratorT<cl_long>)
|
||||
TYPE_HNDL("ptrdiff_t", false, 0, 1, 0x0, 0xffffffff, KernelArgGeneratorT<size_t>)
|
||||
TYPE_HNDL("ptrdiff_t*", true, 0, 1, 0x0, 0xffffffff, KernelArgGeneratorT<size_t>)
|
||||
TYPE_HNDL("sampler_t", false, 0, 1, 0x0, 0x7f, KernelArgGeneratorSampler)
|
||||
TYPE_HNDL("short", false, 0, 1, 0x0, 0x7fff, KernelArgGeneratorT<cl_short>)
|
||||
TYPE_HNDL("short*", true, 0, 16, 0x0, 0x7fff, KernelArgGeneratorT<cl_short>)
|
||||
TYPE_HNDL("short16", false, 0, 16, 0x0, 0x7fff, KernelArgGeneratorT<cl_short>)
|
||||
TYPE_HNDL("short16*", true, 0, 16, 0x0, 0x7fff, KernelArgGeneratorT<cl_short>)
|
||||
TYPE_HNDL("short2", false, 0, 2, 0x0, 0x7fff, KernelArgGeneratorT<cl_short>)
|
||||
TYPE_HNDL("short2*", true, 0, 2, 0x0, 0x7fff, KernelArgGeneratorT<cl_short>)
|
||||
TYPE_HNDL("short3", false, 0, 3, 0x0, 0x7fff, KernelArgGeneratorT<cl_short>)
|
||||
TYPE_HNDL("short3*", true, 0, 3, 0x0, 0x7fff, KernelArgGeneratorT<cl_short>)
|
||||
TYPE_HNDL("short4", false, 0, 4, 0x0, 0x7fff, KernelArgGeneratorT<cl_short>)
|
||||
TYPE_HNDL("short4*", true, 0, 4, 0x0, 0x7fff, KernelArgGeneratorT<cl_short>)
|
||||
TYPE_HNDL("short8", false, 0, 8, 0x0, 0x7fff, KernelArgGeneratorT<cl_short>)
|
||||
TYPE_HNDL("short8*", true, 0, 8, 0x0, 0x7fff, KernelArgGeneratorT<cl_short>)
|
||||
TYPE_HNDL("size_t", false, 0, 1, 0x0, 0xffffffff, KernelArgGeneratorT<size_t>)
|
||||
TYPE_HNDL("size_t*", true, 0, 1, 0x0, 0xffffffff, KernelArgGeneratorT<size_t>)
|
||||
TYPE_HNDL("struct", false, 0, 1, -0x01000000, 0x01000000, KernelArgGeneratorNI)
|
||||
TYPE_HNDL("struct struct_type", false, 0, 1, -0x01000000, 0x01000000, KernelStructTypeArgGenerator<typedef_struct_type>) //struct_type defines as {float4, int}
|
||||
TYPE_HNDL("struct struct_type*", true, 0, 1, -0x01000000, 0x01000000, KernelStructTypeArgGenerator<typedef_struct_type>) //struct_type defines as {float4, int}
|
||||
TYPE_HNDL("testStruct", false, 0, 1, 0x0, 0xffffffff, KernelStructTypeArgGenerator<testStruct>) //testStruct
|
||||
TYPE_HNDL("testStruct*", true, 0, 1, 0x0, 0xffffffff, KernelStructTypeArgGenerator<testStruct>) //testStruct
|
||||
TYPE_HNDL("typedef_enum_type", false, 0, 1, 0, 2, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("typedef_enum_type*", true, 0, 1, 0, 2, KernelArgGeneratorT<cl_int>)
|
||||
TYPE_HNDL("typedef_struct_type", false, 0, 1, -0x01000000, 0x01000000, KernelStructTypeArgGenerator<typedef_struct_type>) //typedef_struct_type defines as {float4, int}
|
||||
TYPE_HNDL("typedef_struct_type*", true, 0, 1, -0x01000000, 0x01000000, KernelStructTypeArgGenerator<typedef_struct_type>) //typedef_struct_type defines as {float4, int}
|
||||
TYPE_HNDL("typedef_type", false, 0, 4, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>) //typeded_type defines as float4
|
||||
TYPE_HNDL("typedef_type*", true, 0, 4, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>) //typeded_type defines as float4
|
||||
TYPE_HNDL("typedef_union_type", false, 0, 4, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>) //typedef_union_type defines as float4/int4
|
||||
TYPE_HNDL("typedef_union_type*", true, 0, 4, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>) //typedef_union_type defines as float4/int4
|
||||
TYPE_HNDL("uchar", false, 0, 1, 0x0, 0xff, KernelArgGeneratorT<cl_uchar>)
|
||||
TYPE_HNDL("uchar*", true, 0, 16, 0x0, 0xff, KernelArgGeneratorT<cl_uchar>)
|
||||
TYPE_HNDL("uchar16", false, 0, 16, 0x0, 0xff, KernelArgGeneratorT<cl_uchar>)
|
||||
TYPE_HNDL("uchar16*", true, 0, 16, 0x0, 0xff, KernelArgGeneratorT<cl_uchar>)
|
||||
TYPE_HNDL("uchar2", false, 0, 2, 0x0, 0xff, KernelArgGeneratorT<cl_uchar>)
|
||||
TYPE_HNDL("uchar2*", true, 0, 2, 0x0, 0xff, KernelArgGeneratorT<cl_uchar>)
|
||||
TYPE_HNDL("uchar3", false, 0, 3, 0x0, 0xff, KernelArgGeneratorT<cl_uchar>)
|
||||
TYPE_HNDL("uchar3*", true, 0, 3, 0x0, 0xff, KernelArgGeneratorT<cl_uchar>)
|
||||
TYPE_HNDL("uchar4", false, 0, 4, 0x0, 0xff, KernelArgGeneratorT<cl_uchar>)
|
||||
TYPE_HNDL("uchar4*", true, 0, 4, 0x0, 0xff, KernelArgGeneratorT<cl_uchar>)
|
||||
TYPE_HNDL("uchar8", false, 0, 8, 0x0, 0xff, KernelArgGeneratorT<cl_uchar>)
|
||||
TYPE_HNDL("uchar8*", true, 0, 8, 0x0, 0xff, KernelArgGeneratorT<cl_uchar>)
|
||||
TYPE_HNDL("uint", false, 0, 1, 0x0, 0xffffffff, KernelArgGeneratorT<cl_uint>)
|
||||
TYPE_HNDL("uint*", true, 0, 16, 0x0, 0xffffffff, KernelArgGeneratorT<cl_uint>)
|
||||
TYPE_HNDL("uint16", false, 0, 16, 0x0, 0xffffffff, KernelArgGeneratorT<cl_uint>)
|
||||
TYPE_HNDL("uint16*", true, 0, 16, 0x0, 0xffffffff, KernelArgGeneratorT<cl_uint>)
|
||||
TYPE_HNDL("uint2", false, 0, 2, 0x0, 0xffffffff, KernelArgGeneratorT<cl_uint>)
|
||||
TYPE_HNDL("uint2*", true, 0, 2, 0x0, 0xffffffff, KernelArgGeneratorT<cl_uint>)
|
||||
TYPE_HNDL("uint3", false, 0, 3, 0x0, 0xffffffff, KernelArgGeneratorT<cl_uint>)
|
||||
TYPE_HNDL("uint3*", true, 0, 3, 0x0, 0xffffffff, KernelArgGeneratorT<cl_uint>)
|
||||
TYPE_HNDL("uint4", false, 0, 4, 0x0, 0xffffffff, KernelArgGeneratorT<cl_uint>)
|
||||
TYPE_HNDL("uint4*", true, 0, 4, 0x0, 0xffffffff, KernelArgGeneratorT<cl_uint>)
|
||||
TYPE_HNDL("uint8", false, 0, 8, 0x0, 0xffffffff, KernelArgGeneratorT<cl_uint>)
|
||||
TYPE_HNDL("uint8*", true, 0, 8, 0x0, 0xffffffff, KernelArgGeneratorT<cl_uint>)
|
||||
TYPE_HNDL("uintptr_t", false, 0, 1, 0x0, 0xffffffff, KernelArgGeneratorT<size_t>)
|
||||
TYPE_HNDL("uintptr_t*", true, 0, 1, 0x0, 0xffffffff, KernelArgGeneratorT<size_t>)
|
||||
TYPE_HNDL("ulong", false, 0, 1, 0x0, 0xffffffffffffffff, KernelArgGeneratorT<cl_ulong>)
|
||||
TYPE_HNDL("ulong*", true, 0, 16, 0x0, 0xffffffffffffffff, KernelArgGeneratorT<cl_ulong>)
|
||||
TYPE_HNDL("ulong16", false, 0, 16, 0x0, 0xffffffffffffffff, KernelArgGeneratorT<cl_ulong>)
|
||||
TYPE_HNDL("ulong16*", true, 0, 16, 0x0, 0xffffffffffffffff, KernelArgGeneratorT<cl_ulong>)
|
||||
TYPE_HNDL("ulong2", false, 0, 2, 0x0, 0xffffffffffffffff, KernelArgGeneratorT<cl_ulong>)
|
||||
TYPE_HNDL("ulong2*", true, 0, 2, 0x0, 0xffffffffffffffff, KernelArgGeneratorT<cl_ulong>)
|
||||
TYPE_HNDL("ulong3", false, 0, 3, 0x0, 0xffffffffffffffff, KernelArgGeneratorT<cl_ulong>)
|
||||
TYPE_HNDL("ulong3*", true, 0, 3, 0x0, 0xffffffffffffffff, KernelArgGeneratorT<cl_ulong>)
|
||||
TYPE_HNDL("ulong4", false, 0, 4, 0x0, 0xffffffffffffffff, KernelArgGeneratorT<cl_ulong>)
|
||||
TYPE_HNDL("ulong4*", true, 0, 4, 0x0, 0xffffffffffffffff, KernelArgGeneratorT<cl_ulong>)
|
||||
TYPE_HNDL("ulong8", false, 0, 8, 0x0, 0xffffffffffffffff, KernelArgGeneratorT<cl_ulong>)
|
||||
TYPE_HNDL("ulong8*", true, 0, 8, 0x0, 0xffffffffffffffff, KernelArgGeneratorT<cl_ulong>)
|
||||
TYPE_HNDL("union union_type", false, 0, 4, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>) //union union_type defines as float4/int4
|
||||
TYPE_HNDL("union union_type*", true, 0, 4, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>) //union union_type defines as float4/int4
|
||||
TYPE_HNDL("union_type", false, 0, 4, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>) //union_type defines as float4/int4
|
||||
TYPE_HNDL("union_type*", true, 0, 4, -0x01000000, 0x01000000, KernelArgGeneratorT<cl_float>) //union_type defines as float4/int4
|
||||
TYPE_HNDL("ushort", false, 0, 1, 0x0, 0xffff, KernelArgGeneratorT<cl_ushort>)
|
||||
TYPE_HNDL("ushort*", true, 0, 16, 0x0, 0xffff, KernelArgGeneratorT<cl_ushort>)
|
||||
TYPE_HNDL("ushort16", false, 0, 16, 0x0, 0xffff, KernelArgGeneratorT<cl_ushort>)
|
||||
TYPE_HNDL("ushort16*", true, 0, 16, 0x0, 0xffff, KernelArgGeneratorT<cl_ushort>)
|
||||
TYPE_HNDL("ushort2", false, 0, 2, 0x0, 0xffff, KernelArgGeneratorT<cl_ushort>)
|
||||
TYPE_HNDL("ushort2*", true, 0, 2, 0x0, 0xffff, KernelArgGeneratorT<cl_ushort>)
|
||||
TYPE_HNDL("ushort3", false, 0, 3, 0x0, 0xffff, KernelArgGeneratorT<cl_ushort>)
|
||||
TYPE_HNDL("ushort3*", true, 0, 3, 0x0, 0xffff, KernelArgGeneratorT<cl_ushort>)
|
||||
TYPE_HNDL("ushort4", false, 0, 4, 0x0, 0xffff, KernelArgGeneratorT<cl_ushort>)
|
||||
TYPE_HNDL("ushort4*", true, 0, 4, 0x0, 0xffff, KernelArgGeneratorT<cl_ushort>)
|
||||
TYPE_HNDL("ushort8", false, 0, 8, 0x0, 0xffff, KernelArgGeneratorT<cl_ushort>)
|
||||
TYPE_HNDL("ushort8*", true, 0, 8, 0x0, 0xffff, KernelArgGeneratorT<cl_ushort>)
|
||||
TYPE_HNDL("void*", true, 0, 16, 0x0, 0xff, KernelArgGeneratorT<cl_char>)
|
||||
TYPE_HNDL("work_item_data", false, 0, 1, 0x0, 0xffffffff, KernelStructTypeArgGenerator<work_item_data>) //work_item_data defines as uint, 6 X uint[3]
|
||||
TYPE_HNDL("work_item_data*", true, 0, 1, 0x0, 0xffffffff, KernelStructTypeArgGenerator<work_item_data>) //work_item_data defines as uint, 6 X uint[3]
|
||||
BIN
test_conformance/spir/vec_align.zip
Normal file
BIN
test_conformance/spir/vec_align.zip
Normal file
Binary file not shown.
BIN
test_conformance/spir/vec_step.zip
Normal file
BIN
test_conformance/spir/vec_step.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user