Debian Codegraph @

src/asahi/lib/agx_scratch.h

raw
1 /*
2 * Copyright 2023 Asahi Lina
3 * SPDX-License-Identifier: MIT
4 */
5
6 #pragma once
7
8 #include "agx_device.h"
9 #include <agx_pack.h>
10
11 // #define SCRATCH_DEBUG
12
13 struct agx_scratch {
14 struct agx_device *dev;
15 struct agx_bo *buf;
16 uint32_t max_core_id;
17 uint32_t num_cores;
18
19 uint32_t subgroups;
20 uint32_t size_dwords;
21
22 struct agx_helper_header *header;
23
24 #ifdef SCRATCH_DEBUG
25 bool core_present[1024];
26 struct agx_helper_block *blocklist;
27 void *data;
28 size_t core_size;
29 #endif
30 };
31
32 void agx_scratch_init(struct agx_device *dev, struct agx_scratch *scratch);
33 void agx_scratch_fini(struct agx_scratch *scratch);
34 void agx_scratch_debug_pre(struct agx_scratch *scratch);
35 void agx_scratch_debug_post(struct agx_scratch *scratch);
36
37 uint32_t agx_scratch_get_bucket(uint32_t dwords);
38 void agx_scratch_alloc(struct agx_scratch *scratch, uint32_t dwords,
39 size_t subgroups);