| 236 | } |
| 237 | |
| 238 | std::unique_ptr<argument_buffer> cuda_function::create_argument_buffer_internal(const device_queue& cqueue, |
| 239 | const function_entry& kern_entry, |
| 240 | const toolchain::arg_info& arg floor_unused, |
| 241 | const uint32_t& user_arg_index, |
| 242 | const uint32_t& ll_arg_index, |
| 243 | const MEMORY_FLAG& add_mem_flags, |
| 244 | const bool zero_init) const { |
| 245 | const auto& dev = cqueue.get_device(); |
| 246 | const auto& cuda_entry = (const cuda_function_entry&)kern_entry; |
| 247 | |
| 248 | // check if info exists |
| 249 | const auto& arg_info = cuda_entry.info->args[ll_arg_index].argument_buffer_info; |
| 250 | if (!arg_info) { |
| 251 | log_error("no argument buffer info for arg at index #$", user_arg_index); |
| 252 | return {}; |
| 253 | } |
| 254 | |
| 255 | const auto arg_buffer_size = cuda_entry.info->args[ll_arg_index].size; |
| 256 | if (arg_buffer_size == 0) { |
| 257 | log_error("computed argument buffer size is 0"); |
| 258 | return {}; |
| 259 | } |
| 260 | |
| 261 | // create the argument buffer |
| 262 | auto buf = dev.context->create_buffer(cqueue, arg_buffer_size, MEMORY_FLAG::READ | MEMORY_FLAG::HOST_WRITE | add_mem_flags); |
| 263 | (void)zero_init; // newly created buffers are zero-initialized |
| 264 | buf->set_debug_label(kern_entry.info->name + "_arg_buffer"); |
| 265 | return std::make_unique<cuda_argument_buffer>(*this, buf, *arg_info); |
| 266 | } |
| 267 | |
| 268 | } // namespace fl |
| 269 |
nothing calls this directly
no test coverage detected