P4 to Git Change 1159925 by rayxiao@alit_opencl_rayxiao on 2015/06/10 13:33:10

EPR #396242 - Add T_PAD type for padding to parameters, use struct instead of array for padding. Set name of padding struct as "__paddingFields" when created.

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_kernel.h#23 edit
... //depot/stg/opencl/drivers/opencl/compiler/clc/src/e2lType.cpp#53 edit
... //depot/stg/opencl/drivers/opencl/compiler/clc/src/oclMetallvm.cpp#46 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpumapping.cpp#3 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuprogram.cpp#67 edit
This commit is contained in:
foreman
2015-06-10 13:42:11 -04:00
parent 27a9fcd36f
commit 5b6d359824
2 changed files with 35 additions and 3 deletions
+33 -1
View File
@@ -235,6 +235,38 @@ namespace cpu {
}
}
}
else if (desc[internal_index].type == T_PAD) {
//Struct has padding
hc_offset = init_offset;
if (desc[index_out+1].type != T_VOID) {
index_out++;
internal_index = index_out;
internal_field_map = new HCtoDCmap(desc, 0, internal_index, init_offset);
hc_size = internal_field_map->compute_map(desc, hc_alignment, dc_alignment, next_offset, inStruct, index_out);
// Adjust alignment to biggest member alignment
hc_alignment = 1;
dc_alignment = 1;
unsigned pad_size = hc_size;
internal_index = index_out;
if (desc[index_out+1].type != T_VOID) {
//Still inside padding and not done
index_out++;
internal_index = index_out;
next_field_map = new HCtoDCmap(desc, 0, internal_index, next_offset);
pad_size = hc_size;
pad_size += next_field_map->compute_map(desc, outer_hc_alignment, outer_dc_alignment, next_offset, inStruct, index_out);
next_offset = max(next_field_map->hc_offset+next_field_map->hc_size, next_field_map->hc_offset+hc_alignment);
// running count of padding dc_size = hc_size + size of next member
return pad_size;
}
else {
//Moving out of struct, go to next index
index_out++;
internal_index = index_out;
return hc_size; //return last padding member size
}
}
}
else {
//Scalar parameter
hc_offset = init_offset;
@@ -278,7 +310,7 @@ namespace cpu {
}
else {
// Ignore alignment when a char occurs to account for padding
if (type != T_STRUCT && next_field_map->hc_size == 1 && map_param_size > 1 && inStruct_flag > 0) {
if (type == T_PAD) {
next_field_map->dc_offset = dc_offset + dc_size;
next_offset = current_offset + hc_size;
}