| 29 | } |
| 30 | |
| 31 | static TinyNNStatus alloc_device_tensor(Instruction* inst, VM* vm) { |
| 32 | Tensor* tensor = inst->workload.dev_mem_alloc.tensor; |
| 33 | DeviceModel* model = get_active_device_model(vm); |
| 34 | RuntimeOpt* opt = &model->opt; |
| 35 | if (!tensor || !opt) |
| 36 | return TinyNN_ERROR_NULL_PTR; |
| 37 | size_t length_in_bytes = tensor_length_in_byte(tensor); |
| 38 | tensor->ptr = opt->device->malloc(length_in_bytes); |
| 39 | return TinyNN_SUCCESS; |
| 40 | } |
| 41 | |
| 42 | static TinyNNStatus free_device_tensor(Instruction* inst, VM* vm) { |
| 43 | Tensor* tensor = inst->workload.dev_mem_alloc.tensor; |
nothing calls this directly
no test coverage detected