4D Example - 2025.1 English - XD100

Vitis Tutorials: AI Engine Development (XD100)

Document ID
XD100
Release Date
2025-08-25
Version
2025.1 English

There is a single 4D example in the documentation. In the following description the 4 dimensions are referenced as:

  • column

  • row

  • layer

  • image

Each image is composed of a row of blocks. Each block is a layer.

The buffer is a 4x4x4x4 data set. The data is transferred in a complex way. The Source data organization is as follows:

Utils/GetTiles.py data/Input_1D_256.txt 4D 4 4 4 4 0
  0   1   2   3       16  17  18  19       32  33  34  35       48  49  50  51
  4   5   6   7       20  21  22  23       36  37  38  39       52  53  54  55
  8   9  10  11       24  25  26  27       40  41  42  43       56  57  58  59
 12  13  14  15       28  29  30  31       44  45  46  47       60  61  62  63

 64  65  66  67       80  81  82  83       96  97  98  99      112 113 114 115
 68  69  70  71       84  85  86  87      100 101 102 103      116 117 118 119
 72  73  74  75       88  89  90  91      104 105 106 107      120 121 122 123
 76  77  78  79       92  93  94  95      108 109 110 111      124 125 126 127

128 129 130 131      144 145 146 147      160 161 162 163      176 177 178 179
132 133 134 135      148 149 150 151      164 165 166 167      180 181 182 183
136 137 138 139      152 153 154 155      168 169 170 171      184 185 186 187
140 141 142 143      156 157 158 159      172 173 174 175      188 189 190 191

192 193 194 195      208 209 210 211      224 225 226 227      240 241 242 243
196 197 198 199      212 213 214 215      228 229 230 231      244 245 246 247
200 201 202 203      216 217 218 219      232 233 234 235      248 249 250 251
204 205 206 207      220 221 222 223      236 237 238 239      252 253 254 255

The read access is declared as this:

adf::read_access(mtxin.out[0]) = adf::tiling({
    .buffer_dimension = {4, 4, 4, 4}, 
    .tiling_dimension = {4, 1, 1, 4}, 
    .offset = {0, 0, 0, 0}, 
    .tile_traversal = {
        {.dimension = 2, .stride = 1, .wrap = 4}, 
        {.dimension = 1, .stride = 1, .wrap = 4}}});

Considering the tiling dimension we can see that a tile is composed of 16 elements which are selected as the 4 first columns (first row) of the 4 first layers of the image:

  • 0 1 2 3

  • 64 65 66 67

  • 128 129 130 131

  • 192 193 194 195

The first traversal parameter is on dimension 2, the layer dimension. So the second extracted tile will be the 4 first rows of the second layer of each image:

  • 16 17 18 19

  • 80 81 82 83

  • 144 145 146 147

  • 208 209 210 211

The second traversal parameter is on dimension 1, the row dimension. The fifth extracted tile (there is a wrap of 4 on the first traversal parameter) will be the second rows of the first 4 layers of the image:

  • 4 5 6 7

  • 68 69 70 71

  • 132 133 134 135

  • 196 197 198 199

And so on…

Utils/GetTiles.py doc_x86simulator_output/data/Output_40.txt 4D 4 4 4 4 0
Tile: 0
  0   1   2   3       16  17  18  19       32  33  34  35       48  49  50  51
 64  65  66  67       80  81  82  83       96  97  98  99      112 113 114 115
128 129 130 131      144 145 146 147      160 161 162 163      176 177 178 179
192 193 194 195      208 209 210 211      224 225 226 227      240 241 242 243

  4   5   6   7       20  21  22  23       36  37  38  39       52  53  54  55
 68  69  70  71       84  85  86  87      100 101 102 103      116 117 118 119
132 133 134 135      148 149 150 151      164 165 166 167      180 181 182 183
196 197 198 199      212 213 214 215      228 229 230 231      244 245 246 247

  8   9  10  11       24  25  26  27       40  41  42  43       56  57  58  59
 72  73  74  75       88  89  90  91      104 105 106 107      120 121 122 123
136 137 138 139      152 153 154 155      168 169 170 171      184 185 186 187
200 201 202 203      216 217 218 219      232 233 234 235      248 249 250 251

 12  13  14  15       28  29  30  31       44  45  46  47       60  61  62  63
 76  77  78  79       92  93  94  95      108 109 110 111      124 125 126 127
140 141 142 143      156 157 158 159      172 173 174 175      188 189 190 191
204 205 206 207      220 221 222 223      236 237 238 239      252 253 254 255