Files
rocm-systems/rocclr/runtime/device/cpu/cpumapping.hpp
T
foreman 70aabc5325 P4 to Git Change 1150348 by rayxiao@alit_opencl_rayxiao on 2015/05/13 10:49:22
EPR #396242 - Solution to cpu device alignment bug.

Affected files ...

... //depot/stg/opencl/drivers/opencl/compiler/edg/src/amd_ocl_attribute.c#24 edit
... //depot/stg/opencl/drivers/opencl/compiler/edg/src/cmd_line.c#86 edit
... //depot/stg/opencl/drivers/opencl/compiler/edg/src/il.c#28 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpucommand.cpp#64 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpucommand.hpp#39 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpukernel.hpp#7 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpumapping.cpp#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpumapping.hpp#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuprogram.cpp#65 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuprogram.hpp#13 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#231 edit
... //depot/stg/opencl/drivers/opencl/tools/runocl/options.c#11 edit
2015-05-13 12:01:50 -04:00

46 lines
1.8 KiB
C++

//
// Copyright (c) 2011 Advanced Micro Devices, Inc. All rights reserved.
//
// HCtoDCmap provides a mapping of parameters from host compiler to device compiler
// The mapping can be used to copy parameters from host to device where field alignment
// is different in compilers
#ifndef CPUMAPPING_HPP_
#define CPUMAPPING_HPP_
using std::min;
using std::max;
namespace cpu {
class HCtoDCmap
{
public:
unsigned int hc_offset, hc_size; // Offset and size of this parameter in host compiler
unsigned int dc_offset, dc_size; // Offset and size of this parameter in device compiler
unsigned int map_alignment; // Alignment of parameter in host compiler
clk_value_type_t type; // Type of parameter
HCtoDCmap *internal_field_map; // Pointer to internal mapping when current parameter is of type T_STRUCT
HCtoDCmap *next_field_map; // Pointer to next struct field when current parameter is a struct member
HCtoDCmap(const clk_parameter_descriptor_t*, unsigned int, unsigned int, unsigned int);
virtual ~HCtoDCmap();
int compute_map(const clk_parameter_descriptor_t*, unsigned int &, unsigned int, int&, int&);
unsigned next_offset(unsigned, unsigned &, int &);
size_t getHostScalarParamSize(const clk_value_type_t) const;
size_t getHostScalarAlignment(const clk_value_type_t) const;
void align_map(unsigned, unsigned&, unsigned&, int&);
unsigned int copy_params(void *, const void *, unsigned int&, int&, int&) const;
private:
};
} // namespace cpu
#endif // CPUMAPPING_HPP_
// Mapping rule
// Long types are treated with 8 byte alignment in runtime when passed in as arguments
// but they are treated with 4 byte alignment in compiler
// Double members have 8 byte alignment when passed as scalar argument
// but have 4 byte alignment as a field inside a struct