Merge branch 'launch3d' into nvptx
This commit is contained in:
@@ -62,17 +62,20 @@ extern "C" {
|
||||
extern void f_di(float *result, double *a, int *b);
|
||||
extern void result(float *val);
|
||||
|
||||
void ISPCLaunch(void **handlePtr, void *f, void *d, int);
|
||||
void ISPCLaunch(void **handlePtr, void *f, void *d, int,int,int);
|
||||
void ISPCSync(void *handle);
|
||||
void *ISPCAlloc(void **handlePtr, int64_t size, int32_t alignment);
|
||||
}
|
||||
|
||||
void ISPCLaunch(void **handle, void *f, void *d, int count) {
|
||||
|
||||
void ISPCLaunch(void **handle, void *f, void *d, int count0, int count1, int count2) {
|
||||
*handle = (void *)0xdeadbeef;
|
||||
typedef void (*TaskFuncType)(void *, int, int, int, int);
|
||||
typedef void (*TaskFuncType)(void *, int, int, int, int, int,int,int, int,int,int);
|
||||
TaskFuncType func = (TaskFuncType)f;
|
||||
for (int i = 0; i < count; ++i)
|
||||
func(d, 0, 1, i, count);
|
||||
int count = count0*count1*count2, idx = 0;
|
||||
for (int k = 0; k < count2; ++k)
|
||||
for (int j = 0; j < count1; ++j)
|
||||
for (int i = 0; i < count0; ++i)
|
||||
func(d, 0, 1, idx++, count, i,j,k,count0,count1,count2);
|
||||
}
|
||||
|
||||
void ISPCSync(void *) {
|
||||
|
||||
42
tests/launch-8.ispc
Normal file
42
tests/launch-8.ispc
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
#define N0 10
|
||||
#define N1 20
|
||||
#define N2 50
|
||||
static uniform float array[N2][N1][N0];
|
||||
|
||||
task void x(const float f) {
|
||||
uniform int j;
|
||||
|
||||
assert(taskCount == N0*N1*N2);
|
||||
assert(taskCount0 == N0);
|
||||
assert(taskCount1 == N1);
|
||||
assert(taskCount2 == N2);
|
||||
assert(taskIndex == taskIndex0 + N0*(taskIndex1 + N1*taskIndex2));
|
||||
assert(taskIndex0 < N0);
|
||||
assert(taskIndex1 < N1);
|
||||
assert(taskIndex2 < N2);
|
||||
|
||||
const uniform int i0 = taskIndex0;
|
||||
const uniform int i1 = taskIndex1;
|
||||
const uniform int i2 = taskIndex2;
|
||||
const uniform int i = taskIndex;
|
||||
array[i2][i1][i0] = i / 10000.;
|
||||
cfor (j = 0; j < 10000; ++j)
|
||||
array[i2][i1][i0] = sin(array[i2][i1][i0]);
|
||||
if (array[i2][i1][i0] < .02)
|
||||
array[i2][i1][i0] = i;
|
||||
}
|
||||
export void f_f(uniform float RET[], uniform float fFOO[]) {
|
||||
float f = fFOO[programIndex];
|
||||
launch[N2][N1][N0] x(f);
|
||||
sync;
|
||||
RET[programIndex] = array[N2-1][N1-1][N0-1];
|
||||
}
|
||||
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 9999.000000;
|
||||
}
|
||||
42
tests/launch-9.ispc
Normal file
42
tests/launch-9.ispc
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
#define N0 10
|
||||
#define N1 20
|
||||
#define N2 50
|
||||
static uniform float array[N2][N1][N0];
|
||||
|
||||
task void x(const float f) {
|
||||
uniform int j;
|
||||
|
||||
assert(taskCount == N0*N1*N2);
|
||||
assert(taskCount0 == N0);
|
||||
assert(taskCount1 == N1);
|
||||
assert(taskCount2 == N2);
|
||||
assert(taskIndex == taskIndex0 + N0*(taskIndex1 + N1*taskIndex2));
|
||||
assert(taskIndex0 < N0);
|
||||
assert(taskIndex1 < N1);
|
||||
assert(taskIndex2 < N2);
|
||||
|
||||
const uniform int i0 = taskIndex0;
|
||||
const uniform int i1 = taskIndex1;
|
||||
const uniform int i2 = taskIndex2;
|
||||
const uniform int i = taskIndex;
|
||||
array[i2][i1][i0] = i / 10000.;
|
||||
cfor (j = 0; j < 10000; ++j)
|
||||
array[i2][i1][i0] = sin(array[i2][i1][i0]);
|
||||
if (array[i2][i1][i0] < .02)
|
||||
array[i2][i1][i0] = i;
|
||||
}
|
||||
export void f_f(uniform float RET[], uniform float fFOO[]) {
|
||||
float f = fFOO[programIndex];
|
||||
launch[N0,N1,N2] x(f);
|
||||
sync;
|
||||
RET[programIndex] = array[N2-1][N1-1][N0-1];
|
||||
}
|
||||
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 9999.000000;
|
||||
}
|
||||
Reference in New Issue
Block a user