MCPcopy Create free account
hub / github.com/a2flo/floor / create_argument_buffer

Method create_argument_buffer

src/device/device_function.cpp:57–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57std::unique_ptr<argument_buffer> device_function::create_argument_buffer(const device_queue& cqueue, const uint32_t& arg_index,
58 const MEMORY_FLAG add_mem_flags,
59 const bool zero_init) const {
60 const auto& dev = cqueue.get_device();
61 const auto entry = get_function_entry(dev);
62 if (!entry || !entry->info) {
63 log_error("no function entry/info \"$\" for device $", function_name, dev.name);
64 return {};
65 }
66
67 // need to take care of argument index translation when stage_input arguments exist
68 uint32_t idx = 0;
69 for (uint32_t actual_idx = 0, count = uint32_t(entry->info->args.size()); idx <= count; ++actual_idx) {
70 if (idx >= count) {
71 log_error("argument index is out-of-bounds: $", arg_index);
72 return {};
73 }
74
75 const auto& arg_info = entry->info->args[idx];
76 if (actual_idx == arg_index) {
77 if (!has_flag<toolchain::ARG_FLAG::ARGUMENT_BUFFER>(arg_info.flags)) {
78 log_error("argument #$ is not an argument buffer", arg_index);
79 return {};
80 }
81 break;
82 }
83
84 if (has_flag<toolchain::ARG_FLAG::STAGE_INPUT>(arg_info.flags)) {
85 // skip to next actual arg
86 while (idx < entry->info->args.size() &&
87 has_flag<toolchain::ARG_FLAG::STAGE_INPUT>(entry->info->args[idx].flags)) {
88 ++idx;
89 }
90 } else {
91 ++idx;
92 }
93 }
94
95 return create_argument_buffer_internal(cqueue, *entry, entry->info->args[idx], arg_index, idx, add_mem_flags, zero_init);
96}
97
98std::unique_ptr<argument_buffer> device_function::create_argument_buffer_internal(const device_queue&,
99 const function_entry&,

Callers

nothing calls this directly

Calls 2

get_deviceMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected