Skip to content

Commit 7504598

Browse files
author
bowwang
committed
[docs] move DAS documentation to config/README.md with usage guide
1 parent b7cc499 commit 7504598

2 files changed

Lines changed: 60 additions & 5 deletions

File tree

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
[![ci](https://github.com/pulp-platform/mempool/actions/workflows/ci.yml/badge.svg)](https://github.com/pulp-platform/mempool/actions/workflows/ci.yml)
22
[![lint](https://github.com/pulp-platform/mempool/actions/workflows/lint.yml/badge.svg)](https://github.com/pulp-platform/mempool/actions/workflows/lint.yml)
33
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4-
# MemPool Dynamic Allocation Scheme
5-
Dynamic Allocation Scheme (DAS), a flexible, adaptable, runtime-configurable address mapping technique. DAS remaps contiguous address spaces to physically adjacent memory banks based on the workload’s memory access patterns, placing the data physically close to PEs.
6-
7-
This repository branch contains DAS extensions based on MemPool.
8-
94
# MemPool
105

116
MemPool is a many-core system targeting image processing and wireless applications. It implements 256 RISC-V cores that can access a large, shared L1 memory in at most five cycles. TeraPool and MinPool, respectively a 1024 RISC-V cores scaled-up and a 16 RISC-V cores scaled-down parametrizations of MemPool are also supported.

config/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,63 @@ you can use the following command to make git pick up tracking the file again:
3434
```bash
3535
git update-index --no-assume-unchanged config/config.mk
3636
```
37+
38+
## Dynamic Address Scrambling (DAS)
39+
40+
Dynamic Address Scrambling (DAS) is a runtime-configurable address mapping
41+
technique. DAS remaps contiguous address spaces to physically adjacent memory
42+
banks based on the workload's memory access patterns, placing data physically
43+
close to PEs.
44+
45+
### Build-time configuration
46+
47+
DAS is controlled by three variables in `config.mk`:
48+
49+
| Variable | Default | Description |
50+
|----------------------|---------|--------------------------------------------|
51+
| `das` | `1` | Enable (`1`) or disable (`0`) DAS support |
52+
| `num_das_partitions` | `4` | Number of independent DAS regions |
53+
| `das_mem_size` | `2048` | DAS heap size per core (bytes) |
54+
55+
### DAS registers
56+
57+
Each DAS partition `i` (0 .. `num_das_partitions - 1`) is programmed through
58+
three memory-mapped registers:
59+
60+
| Register | Description |
61+
|----------------|------------------------------------------------------------|
62+
| `tiles_das[i]` | Folding granularity: number of tiles in this DAS partition |
63+
| `start_das[i]` | Allocated start address of this DAS partition |
64+
| `rows_das[i]` | Allocated size of this DAS partition (in rows) |
65+
66+
The hardware address scrambler uses these registers to remap addresses within
67+
each partition so that consecutive words land on adjacent banks within
68+
`tiles_das[i]` tiles, rather than being interleaved across all tiles.
69+
70+
### Software usage
71+
72+
The runtime provides a convenience API to configure DAS partitions. A typical
73+
flow (see `software/apps/baremetal/das_gemm_f32/main.c` for a full example):
74+
75+
```c
76+
// 1. Initialize the DAS heap allocator
77+
mempool_dynamic_heap_alloc_init(core_id);
78+
alloc_t *das_alloc = get_dynamic_heap_alloc();
79+
80+
// 2. Allocate buffers from the DAS heap
81+
float *a = (float *)partition_malloc(das_alloc, a_size);
82+
float *b = (float *)partition_malloc(das_alloc, b_size);
83+
84+
// 3. Configure DAS partitions
85+
// das_config(partition_id, tiles_per_partition, start_addr, size_bytes)
86+
// - Setting tiles_per_partition = 1 maps the region to a single tile (local).
87+
// - Setting tiles_per_partition = NUM_TILES keeps the default full interleaving.
88+
das_config(0, 1, (uint32_t)a, a_size); // a: local to one tile
89+
das_config(1, NUM_TILES, (uint32_t)b, b_size); // b: fully interleaved
90+
91+
// 4. Use the buffers normally — the hardware handles address remapping
92+
93+
// 5. Free when done
94+
partition_free(das_alloc, b);
95+
partition_free(das_alloc, a);
96+
```

0 commit comments

Comments
 (0)