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
[ROCm/clr commit: 5b6d359824]
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ getParamSizeImpl(bool cpuLayer, const clk_parameter_descriptor_t* desc,
|
||||
size_t* alignment, unsigned* index_out)
|
||||
{
|
||||
size_t size = 0;
|
||||
if(desc[index].type == T_STRUCT) {
|
||||
if(desc[index].type == T_STRUCT || desc[index].type == T_PAD) {
|
||||
size_t maxAlignment = 0;
|
||||
size_t structSize = 0;
|
||||
size_t structAlignment = 0;
|
||||
@@ -237,7 +237,7 @@ getNumTypeDescs(const clk_parameter_descriptor_t* desc)
|
||||
int numStruct = 0;
|
||||
unsigned i;
|
||||
for(i = 0; desc[i].type != T_VOID || numStruct > 0; ++i) {
|
||||
if (desc[i].type == T_STRUCT)
|
||||
if (desc[i].type == T_STRUCT || desc[i].type == T_PAD)
|
||||
numStruct++;
|
||||
if (desc[i].type == T_VOID)
|
||||
numStruct--;
|
||||
|
||||
Referens i nytt ärende
Block a user