| 170 | } |
| 171 | |
| 172 | std::vector<char> |
| 173 | compile_hip_raw(context& ctx, const std::string& content, hip_compile_options options) |
| 174 | { |
| 175 | assert(options.global > 0); |
| 176 | assert(options.local > 0); |
| 177 | std::vector<src_file> srcs = options.additional_src_files; |
| 178 | static auto kernels{::migraphx_kernels()}; |
| 179 | std::transform( |
| 180 | kernels.begin(), |
| 181 | kernels.end(), |
| 182 | std::back_inserter(srcs), |
| 183 | [](const std::pair<std::string_view, std::string_view>& elem) { return src_file{elem}; }); |
| 184 | srcs.emplace_back("main.cpp", content); |
| 185 | |
| 186 | if(options.global % options.local != 0 and hip_accept_non_uniform_wg()) |
| 187 | options.emplace_param("-fno-offload-uniform-block"); |
| 188 | else |
| 189 | assert(options.global % options.local == 0); |
| 190 | |
| 191 | options.emplace_param("-DMIGRAPHX_NGLOBAL=" + std::to_string(options.global)); |
| 192 | options.emplace_param("-DMIGRAPHX_NLOCAL=" + std::to_string(options.local)); |
| 193 | options.emplace_param("-DMIGRAPHX_WAVEFRONTSIZE=" + |
| 194 | std::to_string(ctx.get_current_device().get_wavefront_size())); |
| 195 | const auto& warnings = compiler_warnings(); |
| 196 | options.params.insert(options.params.end(), warnings.begin(), warnings.end()); |
| 197 | options.emplace_param("-ftemplate-backtrace-limit=0"); |
| 198 | options.emplace_param("-Werror"); |
| 199 | auto cos = compile_hip_src(srcs, options.params, ctx.get_current_device().get_device_name()); |
| 200 | if(cos.size() != 1) |
| 201 | MIGRAPHX_THROW("No code object"); |
| 202 | return cos.front(); |
| 203 | } |
| 204 | |
| 205 | operation |
| 206 | compile_hip_code_object(context& ctx, const std::string& content, hip_compile_options options) |
no test coverage detected