etna/ml: Write out the size of the requested tensor
Instead of the size of its backing resource. Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32498>
This commit is contained in:
@@ -28,6 +28,12 @@ etna_ml_get_offset(struct etna_ml_subgraph *subgraph, unsigned idx)
|
||||
return *util_dynarray_element(&subgraph->offsets, unsigned, idx);
|
||||
}
|
||||
|
||||
unsigned
|
||||
etna_ml_get_size(struct etna_ml_subgraph *subgraph, unsigned idx)
|
||||
{
|
||||
return *util_dynarray_element(&subgraph->sizes, unsigned, idx);
|
||||
}
|
||||
|
||||
unsigned
|
||||
etna_ml_allocate_tensor(struct etna_ml_subgraph *subgraph)
|
||||
{
|
||||
@@ -789,12 +795,12 @@ etna_ml_subgraph_read_outputs(struct pipe_context *context, struct pipe_ml_subgr
|
||||
PIPE_MAP_READ,
|
||||
&src_transfer);
|
||||
assert(src_map);
|
||||
for (unsigned k = 0; k < pipe_buffer_size(res); k++) {
|
||||
for (unsigned k = 0; k < etna_ml_get_size(subgraph, output_idxs[i]); k++) {
|
||||
((uint8_t *)(outputs[i]))[k] = src_map[k] - 128;
|
||||
}
|
||||
pipe_buffer_unmap(context, src_transfer);
|
||||
} else {
|
||||
pipe_buffer_read(context, res, 0, pipe_buffer_size(res), outputs[i]);
|
||||
pipe_buffer_read(context, res, 0, etna_ml_get_size(subgraph, output_idxs[i]), outputs[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -118,6 +118,7 @@ struct etna_operation {
|
||||
unsigned etna_ml_allocate_tensor(struct etna_ml_subgraph *subgraph);
|
||||
struct pipe_resource *etna_ml_get_tensor(struct etna_ml_subgraph *subgraph, unsigned idx);
|
||||
unsigned etna_ml_get_offset(struct etna_ml_subgraph *subgraph, unsigned idx);
|
||||
unsigned etna_ml_get_size(struct etna_ml_subgraph *subgraph, unsigned idx);
|
||||
|
||||
struct etna_bo *etna_ml_create_bo(struct pipe_context *pctx, size_t size);
|
||||
|
||||
|
Reference in New Issue
Block a user