文件
rocm-systems/rocclr/runtime/device/cpu/cpumapping.hpp
T
foreman 51d7e63f11 P4 to Git Change 1157942 by rayxiao@alit_opencl_rayxiao on 2015/06/04 14:00:57
EPR #396242 - Update to HCtoDCmapping: Adding guards for HCtoDCmapping in mapping parameters from LLVM to MVSC. New struct packing rule for doubles in Windows added. Use dc_alignment and hc_alignment to track parameter alignment on device and host compilers respectively.

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpumapping.cpp#2 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpumapping.hpp#2 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuprogram.cpp#66 edit
2015-06-04 14:14:26 -04:00

47 行
1.9 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 hc_alignment; // Alignment of parameter in host compiler
unsigned int dc_alignment; // Alignment of parameter in device 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 &, unsigned int, int&, int&);
unsigned next_offset(unsigned, unsigned &, int &);
size_t getHostScalarParamSize(const clk_value_type_t) const;
size_t getScalarAlignment(const clk_value_type_t, bool) const;
void align_map(unsigned, 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