-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add regression test for issue pocl#1435
- Loading branch information
Showing
2 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
Github Issue #1435 | ||
*/ | ||
|
||
#include "pocl_opencl.h" | ||
|
||
#define CL_HPP_ENABLE_EXCEPTIONS | ||
#define CL_HPP_MINIMUM_OPENCL_VERSION 120 | ||
#define CL_HPP_TARGET_OPENCL_VERSION 120 | ||
#include <CL/opencl.hpp> | ||
#include <cassert> | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
const char *SOURCE = R"RAW( | ||
__kernel void testkernel(__local float2 *b) { | ||
struct { | ||
int c[1]; | ||
float2 d; | ||
} e; | ||
for (int f = 0; f < 2; f++) { | ||
if (f) | ||
for (int g; g < (int)b[0].x; g++) | ||
e.c[g] = 0; | ||
else if (b) | ||
e.d.s0 = b[0].s0; | ||
barrier(0); | ||
} | ||
} | ||
)RAW"; | ||
|
||
#define ARRAY_SIZE 4 | ||
|
||
int main(int argc, char *argv[]) { | ||
cl::Device device = cl::Device::getDefault(); | ||
cl::Program program(SOURCE); | ||
program.build("-cl-std=CL1.2"); | ||
|
||
// This triggers compilation of dynamic WG binaries. | ||
cl::Program::Binaries binaries{}; | ||
int err = program.getInfo<>(CL_PROGRAM_BINARIES, &binaries); | ||
if (err == CL_SUCCESS) { | ||
printf("OK\n"); | ||
return EXIT_SUCCESS; | ||
} else { | ||
printf("FAIL\n"); | ||
return EXIT_FAILURE; | ||
} | ||
} |