You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
821 B
36 lines
821 B
#pragma once
|
|
#include <string>
|
|
#include "../cl.hpp"
|
|
|
|
|
|
|
|
class TestCase {
|
|
private:
|
|
std::string kernelCode;
|
|
public:
|
|
virtual void collect_results(cl::CommandQueue* queue) = 0;
|
|
virtual void gpu_compute(
|
|
cl::Context* context,
|
|
cl::CommandQueue* queue,
|
|
cl::Program* program,
|
|
cl::Event* Event
|
|
) = 0;
|
|
virtual void cpu_compute() = 0;
|
|
virtual bool validate_results() = 0;
|
|
};
|
|
|
|
class Square : public TestCase {
|
|
private:
|
|
size_t data_size = 4096;
|
|
std::vector<float> gpuHostBuffer;
|
|
std::vector<float> sourceData;
|
|
std::vector<float> cpuResult;
|
|
cl::Buffer clInputBuffer;
|
|
cl::Buffer clResultBuffer;
|
|
public:
|
|
Square();
|
|
void collect_results(cl::CommandQueue* queue);
|
|
void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event);
|
|
void cpu_compute();
|
|
bool validate_results();
|
|
};
|