note that cuda doesn't have any special argument types and everything is just sized "memory" -> only need to add up sizes
| 26 | // note that cuda doesn't have any special argument types and everything is just sized "memory" |
| 27 | // -> only need to add up sizes |
| 28 | static size_t compute_kernel_args_size(const llvm_toolchain::function_info& info) { |
| 29 | size_t ret = 0; |
| 30 | const auto arg_count = info.args.size(); |
| 31 | for(size_t i = 0; i < arg_count; ++i) { |
| 32 | // actual arg or pointer? |
| 33 | if(info.args[i].address_space == llvm_toolchain::ARG_ADDRESS_SPACE::CONSTANT) { |
| 34 | ret += info.args[i].size; |
| 35 | } |
| 36 | else if(info.args[i].address_space == llvm_toolchain::ARG_ADDRESS_SPACE::IMAGE) { |
| 37 | ret += sizeof(uint32_t) * cuda_sampler::max_sampler_count; |
| 38 | ret += sizeof(uint64_t) * 1 /* surface */; |
| 39 | ret += sizeof(cu_device_ptr) * 1 /* surfaces lod buffer */; |
| 40 | ret += sizeof(COMPUTE_IMAGE_TYPE); |
| 41 | ret += 4 /* padding */; |
| 42 | } |
| 43 | else ret += sizeof(void*); |
| 44 | } |
| 45 | return ret; |
| 46 | } |
| 47 | |
| 48 | cuda_program::cuda_program(program_map_type&& programs_) : programs(std::move(programs_)) { |
| 49 | if(programs.empty()) return; |