From 366658602db85e70d68f1a4c1b02115916ad6cd4 Mon Sep 17 00:00:00 2001 From: amin1377 Date: Tue, 21 Nov 2023 09:04:17 -0500 Subject: [PATCH 1/3] change the IPIN base cost if spec is enabled --- .../librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp index 56059e9bb7f..5c58e660bf3 100644 --- a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp +++ b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp @@ -351,7 +351,13 @@ static void load_rr_indexed_data_base_costs(const RRGraphView& rr_graph, rr_indexed_data[RRIndexedDataId(SOURCE_COST_INDEX)].base_cost = delay_normalization_fac; rr_indexed_data[RRIndexedDataId(SINK_COST_INDEX)].base_cost = 0.; rr_indexed_data[RRIndexedDataId(OPIN_COST_INDEX)].base_cost = delay_normalization_fac; + // IF the SPEC_CPU flag is set, we need to make sure that all floating point numbers are perfectly representable in + // binary format. Thus, we changed the IPIN_COST_INDEX base cost from 0.95 to 0.875. +#ifdef SPEC_CPU + rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].base_cost = 0.875 * delay_normalization_fac; +#else rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].base_cost = 0.95 * delay_normalization_fac; +#endif auto rr_segment_counts = count_rr_segment_types(rr_graph, rr_indexed_data); size_t total_segments = std::accumulate(rr_segment_counts.begin(), rr_segment_counts.end(), 0u); From 3c96ac0b85b83116efec3245af52e7b6fe33b798 Mon Sep 17 00:00:00 2001 From: amin1377 Date: Tue, 28 Nov 2023 10:25:12 -0500 Subject: [PATCH 2/3] Expand the comment on why we need different const when SPEC is enabled --- libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp index 5c58e660bf3..35d4bd406bd 100644 --- a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp +++ b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp @@ -353,6 +353,11 @@ static void load_rr_indexed_data_base_costs(const RRGraphView& rr_graph, rr_indexed_data[RRIndexedDataId(OPIN_COST_INDEX)].base_cost = delay_normalization_fac; // IF the SPEC_CPU flag is set, we need to make sure that all floating point numbers are perfectly representable in // binary format. Thus, we changed the IPIN_COST_INDEX base cost from 0.95 to 0.875. + // This number is perfectly representable in a binary mantissa (without round-off) so we can get the same routing result on different platforms. + // Since the router cost calculations and heap use floating point numbers, normally we get slightly different round off with different compiler settings, + // leading to different heap sorts and hence different routings. + // To make result validation for SPEC easier, we choose all router parameters to result in calculations that fit perfectly in a 24-bit binary mantissa. + // .875 = 1/2 + 1/4 + 1/8 can be perfectly represented in a binary mantissa with only the first 3 bits set. #ifdef SPEC_CPU rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].base_cost = 0.875 * delay_normalization_fac; #else From 554841b51eaceafa8eb5ac6e624a1f27846bb7fc Mon Sep 17 00:00:00 2001 From: amin1377 Date: Tue, 28 Nov 2023 10:25:58 -0500 Subject: [PATCH 3/3] fix a typo --- libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp index 35d4bd406bd..7eb6ded1579 100644 --- a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp +++ b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp @@ -351,7 +351,7 @@ static void load_rr_indexed_data_base_costs(const RRGraphView& rr_graph, rr_indexed_data[RRIndexedDataId(SOURCE_COST_INDEX)].base_cost = delay_normalization_fac; rr_indexed_data[RRIndexedDataId(SINK_COST_INDEX)].base_cost = 0.; rr_indexed_data[RRIndexedDataId(OPIN_COST_INDEX)].base_cost = delay_normalization_fac; - // IF the SPEC_CPU flag is set, we need to make sure that all floating point numbers are perfectly representable in + // If the SPEC_CPU flag is set, we need to make sure that all floating point numbers are perfectly representable in // binary format. Thus, we changed the IPIN_COST_INDEX base cost from 0.95 to 0.875. // This number is perfectly representable in a binary mantissa (without round-off) so we can get the same routing result on different platforms. // Since the router cost calculations and heap use floating point numbers, normally we get slightly different round off with different compiler settings,