Skip to content

Commit d56143b

Browse files
author
Nathan Shreve
committed
Modified Doxygen comments on heaps
1 parent d580ab1 commit d56143b

File tree

4 files changed

+56
-24
lines changed

4 files changed

+56
-24
lines changed

vpr/src/base/ShowSetup.cpp

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,26 +287,46 @@ static void ShowRouterOpts(const t_router_opts& RouterOpts) {
287287
VTR_LOG("DELAY_NORMALIZED\n");
288288
break;
289289
case DELAY_NORMALIZED_LENGTH:
290-
VTR_ASSERT_SAFE(DETAILED == RouterOpts.route_type);
290+
if (GLOBAL == RouterOpts.route_type) {
291+
VTR_LOG_ERROR("Unknown router base cost type\n");
292+
break;
293+
}
294+
291295
VTR_LOG("DELAY_NORMALIZED_LENGTH\n");
292296
break;
293297
case DELAY_NORMALIZED_LENGTH_BOUNDED:
294-
VTR_ASSERT_SAFE(DETAILED == RouterOpts.route_type);
298+
if (GLOBAL == RouterOpts.route_type) {
299+
VTR_LOG_ERROR("Unknown router base cost type\n");
300+
break;
301+
}
302+
295303
VTR_LOG("DELAY_NORMALIZED_LENGTH_BOUNDED\n");
296304
break;
297305
case DELAY_NORMALIZED_FREQUENCY:
298-
VTR_ASSERT_SAFE(DETAILED == RouterOpts.route_type);
306+
if (GLOBAL == RouterOpts.route_type) {
307+
VTR_LOG_ERROR("Unknown router base cost type\n");
308+
break;
309+
}
310+
299311
VTR_LOG("DELAY_NORMALIZED_FREQUENCY\n");
300312
break;
301313
case DELAY_NORMALIZED_LENGTH_FREQUENCY:
302-
VTR_ASSERT_SAFE(DETAILED == RouterOpts.route_type);
314+
if (GLOBAL == RouterOpts.route_type) {
315+
VTR_LOG_ERROR("Unknown router base cost type\n");
316+
break;
317+
}
318+
303319
VTR_LOG("DELAY_NORMALIZED_LENGTH_FREQUENCY\n");
304320
break;
305321
case DEMAND_ONLY:
306322
VTR_LOG("DEMAND_ONLY\n");
307323
break;
308324
case DEMAND_ONLY_NORMALIZED_LENGTH:
309-
VTR_ASSERT_SAFE(DETAILED == RouterOpts.route_type);
325+
if (GLOBAL == RouterOpts.route_type) {
326+
VTR_LOG_ERROR("Unknown router base cost type\n");
327+
break;
328+
}
329+
310330
VTR_LOG("DEMAND_ONLY_NORMALIZED_LENGTH\n");
311331
break;
312332
default:

vpr/src/route/four_ary_heap.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
#include "k_ary_heap.h"
55
#include <vector>
66

7+
/**
8+
* @brief Minheap with 4 child nodes per parent.
9+
*
10+
* @note
11+
* Currently, KAryHeap's two children are BinaryHeap and FourAryHeap. On small circuits, these
12+
* heaps have negligible differences in runtime, but on larger heaps, runtime is lower when
13+
* using FourAryHeap. On titan benchmarks, the runtime is ~1.8% better on FourAryHeap compared
14+
* to BinaryHeap. This is likely because FourAryHeap is more cache friendly, as we can fit 5
15+
* heap_elem on a cache line.
16+
*/
717
class FourAryHeap : public KAryHeap {
818
public:
919
bool is_valid() const final;

vpr/src/route/heap_type.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ class HeapStorage {
9999
/**
100100
* @brief Interface to heap used for router optimization.
101101
*
102-
* @details
103-
* Note: Objects used in instances of HeapInterface must always be allocated
102+
* @note
103+
* Objects used in instances of HeapInterface must always be allocated
104104
* and free'd using the HeapInterface::alloc and HeapInterface::free methods
105-
* of that instance. Object pools are likely in use.<BR><BR>
105+
* of that instance. Object pools are likely in use.
106+
*
107+
* @details
106108
* As a general rule, any t_heap objects returned from this interface,
107109
* **must** be HeapInterface::free'd before destroying the HeapInterface
108110
* instance. This ensure that no leaks are present in the users of the heap.
@@ -135,8 +137,8 @@ class HeapInterface {
135137
/**
136138
* @brief Initializes heap storage based on the size of the device.
137139
*
138-
* @details
139-
* Note: this method **must** be invoked at least once prior to the
140+
* @note
141+
* This method **must** be invoked at least once prior to the
140142
* following methods being called:<BR>
141143
* - add_to_heap<BR>
142144
* - push_back<BR>
@@ -212,8 +214,10 @@ class HeapInterface {
212214
*
213215
* @details
214216
* This returns all memory allocated by the HeapInterface instance. Only
215-
* call this if the heap is no longer being used.<BR><BR>
216-
* Note: Only invoke this method if all objects returned from this
217+
* call this if the heap is no longer being used.
218+
*
219+
* @note
220+
* Only invoke this method if all objects returned from this
217221
* HeapInterface instance have been free'd.
218222
*/
219223
virtual void free_all_memory() = 0;

vpr/src/route/k_ary_heap.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@
66

77
/**
88
* @brief Abstract class whose children are HeapInterface implementations of a k-ary minheap.
9-
*
10-
* @details
11-
* Currently, KAryHeap's two children are BinaryHeap and FourAryHeap. On small circuits, these
12-
* heaps have negligible differences in runtime, but on larger heaps, runtime is lower when
13-
* using FourAryHeap. On titan benchmarks, the runtime is ~1.8% better on FourAryHeap compared
14-
* to BinaryHeap. This is likely because FourAryHeap is more cache friendly, as we can fit 5
15-
* heap_elem on a cache line.
169
*/
1710
class KAryHeap : public HeapInterface {
1811
public:
@@ -48,12 +41,14 @@ class KAryHeap : public HeapInterface {
4841
* @param elem_ptr A pointer to the t_heap struct which contains all
4942
* the node's information.
5043
* @param cost The cost of the node.
51-
*/
52-
/* TODO: We are currently storing the node cost in two places (in elem_ptr->cost and cost). This might be fixed in two ways:
53-
* 1. Don't store the cost in t_heap.
44+
*
45+
* @todo
46+
* We are currently storing the node cost in two places (in elem_ptr->cost and cost). This might be fixed in two ways:<BR>
47+
* 1. Don't store the cost in t_heap.<BR>
5448
* 2. Instead of using pointers, use a 32-bit ID. If we do this, we can create a new 8-ary heap, which is likely to be even
5549
* faster as we can fit more heap_elem on one cache line (currently, we can fit 5 as heap_elem is 12 bytes), even with more
56-
* comparisons.*/
50+
* comparisons.
51+
*/
5752
struct heap_elem {
5853
t_heap* elem_ptr;
5954
float cost;
@@ -110,11 +105,14 @@ class KAryHeap : public HeapInterface {
110105
HeapStorage storage_;
111106

112107
/**
108+
* @details
113109
* heap_ is indexed from [1..heap_size]; the 0th element is unused. For BinaryHeap, this simplifies
114110
* arithmetic in left() and parent() functions. Using a heap beginning at index 0 would simplify
115111
* first_child() and parent() functions in FourAryHeap, but this does not improve runtime.
112+
*
113+
* @todo
114+
* If an 8-ary heap is implemented, experiment with starting at index 0
116115
*/
117-
/* TODO: If an 8-ary heap is implemented, experiment with starting at index 0 */
118116
std::vector<heap_elem> heap_;
119117

120118
size_t heap_size_; /* Number of slots in the heap array */

0 commit comments

Comments
 (0)