Nakai
2013-01-20, 21:01:37
Heyho für genauere Problembeschreibung hier:
http://www.forum-3dcenter.org/vbulletin/showthread.php?t=537968
Code:
#define WORKGROUPSIZE 64
__kernel void MinMax(
__global float* input,
__global float * output,
float min,
float max,
int sizex,
int sizey,
int sizez
)
{
int idx = get_global_id(0);
int idy = get_global_id(1);
int idz = get_global_id(2);
int idx_local = get_local_id(0);
int idy_local = get_local_id(1);
int idz_local = get_local_id(2);
int local_x = get_local_size(0);
int local_y = get_local_size(1);
int local_z = get_local_size(2);
int group_x = get_num_groups(0);
int group_y = get_num_groups(1);
int group_z = get_num_groups(2);
int groupid_x = get_group_id(0);
int groupid_y = get_group_id(1);
int groupid_z = get_group_id(2);
int gid = idx + sizex*idy + sizex*sizey*idz;
int gid_local = idx_local + local_x*idy_local +local_x*local_y*idz_local;
int group_id = groupid_x + group_y*groupid_y + groupid_z*group_z*groupid_z;
int group_count = group_x*group_y*group_z;
int offset = 1;
bool isValid = true;
if(idx >sizex) isValid = false;
if(idy >sizey) isValid = false;
if(idz >sizez) isValid = false;
if(idx_local >local_x) isValid = false;
if(idy_local >local_y) isValid = false;
if(idz_local >local_z) isValid = false;
if(isValid)
{
barrier(CLK_LOCAL_MEM_FENCE);
__local float Minvals[WORKGROUPSIZE];
__local float Maxvals[WORKGROUPSIZE];
Minvals[gid_local] = input[gid];
Maxvals[gid_local] = input[gid];
int offset = 1;
int jump = 2;
barrier(CLK_LOCAL_MEM_FENCE);
for(;gid_local%jump==0;)
{
Minvals[gid_local] = fmin(Minvals[gid_local],Minvals[gid_local+offset]);
Maxvals[gid_local] = fmax(Maxvals[gid_local],Maxvals[gid_local+offset]);
offset *= 2;
jump *= 2;
}
barrier(CLK_GLOBAL_MEM_FENCE);
if(gid_local == 0)
{
//global Rueckschreiben
output[gid*2] = Minvals[gid_local];
output[gid*2 +1] = Maxvals[gid_local];
}
barrier(CLK_GLOBAL_MEM_FENCE);
if(gid==0)
{
float mint;
float maxt;
for(int i =0; i < group_count; i=i+2)
{
mint = fmin(mint,output[i]);
maxt = fmax(maxt,output[i+1]);
}
output[0] = mint;
output[1] = maxt;
}
}
}
Es gibt nen Bluescreen, welcher auf einen Konflikt mit einem Treibereset hindeutet(BCCode: 116).
Problemsignatur:
Problemereignisname: BlueScreen
Betriebsystemversion: 6.1.7601.2.1.0.256.48
Gebietsschema-ID: 1031
Zusatzinformationen zum Problem:
BCCode: 116
BCP1: FFFFFA80043354E0
BCP2: FFFFF88006E07408
BCP3: 0000000000000000
BCP4: 0000000000000002
OS Version: 6_1_7601
Service Pack: 1_0
Product: 256_1
Ich hab keine Ahnung, was das Problem ist. Bitte anderen Thread beachten.
Ob es ein Hardware oder Softwareproblem ist, kann ich nicht sagen, deswegen zwei Threads.
Zum Kernel:
Der sucht aus einem Array aus Floats das Max und Min heraus. Dabei wird erstmal in der Workgroup reduziert, dann Global.
http://www.forum-3dcenter.org/vbulletin/showthread.php?t=537968
Code:
#define WORKGROUPSIZE 64
__kernel void MinMax(
__global float* input,
__global float * output,
float min,
float max,
int sizex,
int sizey,
int sizez
)
{
int idx = get_global_id(0);
int idy = get_global_id(1);
int idz = get_global_id(2);
int idx_local = get_local_id(0);
int idy_local = get_local_id(1);
int idz_local = get_local_id(2);
int local_x = get_local_size(0);
int local_y = get_local_size(1);
int local_z = get_local_size(2);
int group_x = get_num_groups(0);
int group_y = get_num_groups(1);
int group_z = get_num_groups(2);
int groupid_x = get_group_id(0);
int groupid_y = get_group_id(1);
int groupid_z = get_group_id(2);
int gid = idx + sizex*idy + sizex*sizey*idz;
int gid_local = idx_local + local_x*idy_local +local_x*local_y*idz_local;
int group_id = groupid_x + group_y*groupid_y + groupid_z*group_z*groupid_z;
int group_count = group_x*group_y*group_z;
int offset = 1;
bool isValid = true;
if(idx >sizex) isValid = false;
if(idy >sizey) isValid = false;
if(idz >sizez) isValid = false;
if(idx_local >local_x) isValid = false;
if(idy_local >local_y) isValid = false;
if(idz_local >local_z) isValid = false;
if(isValid)
{
barrier(CLK_LOCAL_MEM_FENCE);
__local float Minvals[WORKGROUPSIZE];
__local float Maxvals[WORKGROUPSIZE];
Minvals[gid_local] = input[gid];
Maxvals[gid_local] = input[gid];
int offset = 1;
int jump = 2;
barrier(CLK_LOCAL_MEM_FENCE);
for(;gid_local%jump==0;)
{
Minvals[gid_local] = fmin(Minvals[gid_local],Minvals[gid_local+offset]);
Maxvals[gid_local] = fmax(Maxvals[gid_local],Maxvals[gid_local+offset]);
offset *= 2;
jump *= 2;
}
barrier(CLK_GLOBAL_MEM_FENCE);
if(gid_local == 0)
{
//global Rueckschreiben
output[gid*2] = Minvals[gid_local];
output[gid*2 +1] = Maxvals[gid_local];
}
barrier(CLK_GLOBAL_MEM_FENCE);
if(gid==0)
{
float mint;
float maxt;
for(int i =0; i < group_count; i=i+2)
{
mint = fmin(mint,output[i]);
maxt = fmax(maxt,output[i+1]);
}
output[0] = mint;
output[1] = maxt;
}
}
}
Es gibt nen Bluescreen, welcher auf einen Konflikt mit einem Treibereset hindeutet(BCCode: 116).
Problemsignatur:
Problemereignisname: BlueScreen
Betriebsystemversion: 6.1.7601.2.1.0.256.48
Gebietsschema-ID: 1031
Zusatzinformationen zum Problem:
BCCode: 116
BCP1: FFFFFA80043354E0
BCP2: FFFFF88006E07408
BCP3: 0000000000000000
BCP4: 0000000000000002
OS Version: 6_1_7601
Service Pack: 1_0
Product: 256_1
Ich hab keine Ahnung, was das Problem ist. Bitte anderen Thread beachten.
Ob es ein Hardware oder Softwareproblem ist, kann ich nicht sagen, deswegen zwei Threads.
Zum Kernel:
Der sucht aus einem Array aus Floats das Max und Min heraus. Dabei wird erstmal in der Workgroup reduziert, dann Global.