From a065f75a23877f31e68080c90ccd77334d944a75 Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Wed, 4 Aug 2021 21:23:12 +0000 Subject: [PATCH 1/4] Add -reference_checkpoint option to aws_build_dcp_from_cl.sh If passed, the path given to -reference_checkpoint is used to `read_checkpoint -incremental` at the appropriate place in the design flow for Vivado to do an incremental implementation Also adds `report_incremental_reuse -hierarchical` reporting at the various stages of the flow. --- .../build/scripts/create_dcp_from_cl.tcl | 17 +++++++++++++++++ .../build/scripts/synth_cl_firesim.tcl | 4 +++- .../build/scripts/aws_build_dcp_from_cl.sh | 8 ++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/hdk/cl/developer_designs/cl_firesim/build/scripts/create_dcp_from_cl.tcl b/hdk/cl/developer_designs/cl_firesim/build/scripts/create_dcp_from_cl.tcl index 1cea9628..bb61578c 100644 --- a/hdk/cl/developer_designs/cl_firesim/build/scripts/create_dcp_from_cl.tcl +++ b/hdk/cl/developer_designs/cl_firesim/build/scripts/create_dcp_from_cl.tcl @@ -38,6 +38,8 @@ set clock_recipe_c [lindex $argv 10] set uram_option [lindex $argv 11] set notify_via_sns [lindex $argv 12] set VDEFINES [lindex $argv 13] +set reference_checkpoint [lindex $argv 14] + ################################################## ## Flow control variables ################################################## @@ -272,6 +274,14 @@ if {$implement} { write_checkpoint -force $CL_DIR/build/checkpoints/${timestamp}.post_link.dcp } + ######################## + # Load Reference Checkpoint (if provided) + ######################## + if {$reference_checkpoint != ""} { + read_checkpoint -incremental $reference_checkpoint + report_incremental_reuse -hierarchical -file $CL_DIR/build/reports/${timestamp}.post_link_incremental_reuse.rpt + } + ######################## # CL Optimize ######################## @@ -284,6 +294,9 @@ if {$implement} { } } report_utilization -hierarchical -file $CL_DIR/build/reports/${timestamp}.post_opt_utilization.rpt + if {$reference_checkpoint != ""} { + report_incremental_reuse -hierarchical -file $CL_DIR/build/reports/${timestamp}.post_opt_incremental_reuse.rpt + } ######################## # CL Place @@ -328,6 +341,10 @@ if {$implement} { # Report final timing report_timing_summary -file $CL_DIR/build/reports/${timestamp}.SH_CL_final_timing_summary.rpt + if {$reference_checkpoint != ""} { + report_incremental_reuse -hierarchical -file $CL_DIR/build/reports/${timestamp}.SH_CL_incremental_reuse.rpt + } + # Report utilization report_utilization -hierarchical -file $CL_DIR/build/reports/${timestamp}.SH_CL_utilization.rpt diff --git a/hdk/cl/developer_designs/cl_firesim/build/scripts/synth_cl_firesim.tcl b/hdk/cl/developer_designs/cl_firesim/build/scripts/synth_cl_firesim.tcl index 037ec3dd..7db0ceea 100644 --- a/hdk/cl/developer_designs/cl_firesim/build/scripts/synth_cl_firesim.tcl +++ b/hdk/cl/developer_designs/cl_firesim/build/scripts/synth_cl_firesim.tcl @@ -117,7 +117,9 @@ puts "AWS FPGA: ([clock format [clock seconds] -format %T]) Start design synthes update_compile_order -fileset sources_1 puts "\nRunning synth_design for $CL_MODULE $CL_DIR/build/scripts \[[clock format [clock seconds] -format {%a %b %d %H:%M:%S %Y}]\]" -eval [concat synth_design -top $CL_MODULE -verilog_define XSDB_SLV_DIS $VDEFINES -part [DEVICE_TYPE] -mode out_of_context $synth_options -directive $synth_directive] +set runcmd [concat synth_design -top $CL_MODULE -verilog_define XSDB_SLV_DIS $VDEFINES -part [DEVICE_TYPE] -mode out_of_context $synth_options -directive $synth_directive] +puts "\n$runcmd" +eval $runcmd set failval [catch {exec grep "FAIL" failfast.csv}] if { $failval==0 } { diff --git a/hdk/common/shell_v04261818/build/scripts/aws_build_dcp_from_cl.sh b/hdk/common/shell_v04261818/build/scripts/aws_build_dcp_from_cl.sh index 75104d5c..517297dd 100755 --- a/hdk/common/shell_v04261818/build/scripts/aws_build_dcp_from_cl.sh +++ b/hdk/common/shell_v04261818/build/scripts/aws_build_dcp_from_cl.sh @@ -18,7 +18,7 @@ # Usage help function usage { - echo "usage: aws_build_dcp_from_cl.sh [ [-script ] | [-strategy BASIC | DEFAULT | EXPLORE | TIMING | NORETIMING | CONGESTION] [-clock_recipe_a A0 | A1 | A2] [-clock_recipe_b B0 | B1 | B2 | B3 | B4 | B5] [-clock_recipe_c C0 | C1 | C2 | C3] [-uram_option 2 | 3 | 4] [-vdefine macro1,macro2,macro3,.....,macrox] -foreground] [-notify] | [-h] | [-H] | [-help] ]" + echo "usage: aws_build_dcp_from_cl.sh [ [-script ] | [-strategy BASIC | DEFAULT | EXPLORE | TIMING | NORETIMING | CONGESTION] [-clock_recipe_a A0 | A1 | A2] [-clock_recipe_b B0 | B1 | B2 | B3 | B4 | B5] [-clock_recipe_c C0 | C1 | C2 | C3] [-uram_option 2 | 3 | 4] [-vdefine macro1,macro2,macro3,.....,macrox] -foreground] [-notify] [-reference_checkpoint ] | [-h] | [-H] | [-help] ]" echo " " echo "By default the build is run in the background using nohup so that the" echo "process will not be terminated if the terminal window is closed." @@ -45,6 +45,7 @@ ignore_memory_requirement=0 expected_memory_usage=30000000 uram_option=2 vdefine="" +reference_checkpoint="" function info_msg { echo -e "INFO: $1" @@ -100,6 +101,9 @@ while [ "$1" != "" ]; do ;; -ignore_memory_requirement) ignore_memory_requirement=1 ;; + -reference_checkpoint) shift + reference_checkpoint=$1 + ;; -h | -H | -help ) usage exit ;; @@ -243,7 +247,7 @@ subsystem_id="0x${id1_version:0:4}"; subsystem_vendor_id="0x${id1_version:4:4}"; # Run vivado -cmd="vivado -mode batch -nojournal -log $logname -source $vivado_script -tclargs $timestamp $strategy $hdk_version $shell_version $device_id $vendor_id $subsystem_id $subsystem_vendor_id $clock_recipe_a $clock_recipe_b $clock_recipe_c $uram_option $notify $opt_vdefine" +cmd="vivado -mode batch -nojournal -log $logname -source $vivado_script -tclargs $timestamp $strategy $hdk_version $shell_version $device_id $vendor_id $subsystem_id $subsystem_vendor_id $clock_recipe_a $clock_recipe_b $clock_recipe_c $uram_option $notify $opt_vdefine $reference_checkpoint" if [[ "$foreground" == "0" ]]; then nohup $cmd > $timestamp.nohup.out 2>&1 & From 2a2b4eb29ffcbeee3189775e6b8138e23c5eb800 Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Wed, 4 Aug 2021 22:28:59 +0000 Subject: [PATCH 2/4] fixup! Add -reference_checkpoint option to aws_build_dcp_from_cl.sh --- .../cl_firesim/build/scripts/create_dcp_from_cl.tcl | 13 ++++++++++--- .../build/scripts/aws_build_dcp_from_cl.sh | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/hdk/cl/developer_designs/cl_firesim/build/scripts/create_dcp_from_cl.tcl b/hdk/cl/developer_designs/cl_firesim/build/scripts/create_dcp_from_cl.tcl index bb61578c..33dd2bac 100644 --- a/hdk/cl/developer_designs/cl_firesim/build/scripts/create_dcp_from_cl.tcl +++ b/hdk/cl/developer_designs/cl_firesim/build/scripts/create_dcp_from_cl.tcl @@ -40,6 +40,13 @@ set notify_via_sns [lindex $argv 12] set VDEFINES [lindex $argv 13] set reference_checkpoint [lindex $argv 14] + +if {$VDEFINES == "__NONE__"} { + # it is easier to explicitly pass something rather than having to get + # empty string passed correctly through layers of string interpolation + set VDEFINES "" +} + ################################################## ## Flow control variables ################################################## @@ -277,7 +284,7 @@ if {$implement} { ######################## # Load Reference Checkpoint (if provided) ######################## - if {$reference_checkpoint != ""} { + if {$reference_checkpoint != "__NONE__"} { read_checkpoint -incremental $reference_checkpoint report_incremental_reuse -hierarchical -file $CL_DIR/build/reports/${timestamp}.post_link_incremental_reuse.rpt } @@ -294,7 +301,7 @@ if {$implement} { } } report_utilization -hierarchical -file $CL_DIR/build/reports/${timestamp}.post_opt_utilization.rpt - if {$reference_checkpoint != ""} { + if {$reference_checkpoint != "__NONE__"} { report_incremental_reuse -hierarchical -file $CL_DIR/build/reports/${timestamp}.post_opt_incremental_reuse.rpt } @@ -341,7 +348,7 @@ if {$implement} { # Report final timing report_timing_summary -file $CL_DIR/build/reports/${timestamp}.SH_CL_final_timing_summary.rpt - if {$reference_checkpoint != ""} { + if {$reference_checkpoint != "__NONE__"} { report_incremental_reuse -hierarchical -file $CL_DIR/build/reports/${timestamp}.SH_CL_incremental_reuse.rpt } diff --git a/hdk/common/shell_v04261818/build/scripts/aws_build_dcp_from_cl.sh b/hdk/common/shell_v04261818/build/scripts/aws_build_dcp_from_cl.sh index 517297dd..873df19b 100755 --- a/hdk/common/shell_v04261818/build/scripts/aws_build_dcp_from_cl.sh +++ b/hdk/common/shell_v04261818/build/scripts/aws_build_dcp_from_cl.sh @@ -44,8 +44,8 @@ notify=0 ignore_memory_requirement=0 expected_memory_usage=30000000 uram_option=2 -vdefine="" -reference_checkpoint="" +vdefine="__NONE__" +reference_checkpoint="__NONE__" function info_msg { echo -e "INFO: $1" From cda7ae7cfde98f99a66c02232364b709c14b1624 Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Wed, 4 Aug 2021 23:35:59 +0000 Subject: [PATCH 3/4] fixup! fixup! Add -reference_checkpoint option to aws_build_dcp_from_cl.sh --- .../build/scripts/aws_build_dcp_from_cl.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hdk/common/shell_v04261818/build/scripts/aws_build_dcp_from_cl.sh b/hdk/common/shell_v04261818/build/scripts/aws_build_dcp_from_cl.sh index 873df19b..5a2e68cb 100755 --- a/hdk/common/shell_v04261818/build/scripts/aws_build_dcp_from_cl.sh +++ b/hdk/common/shell_v04261818/build/scripts/aws_build_dcp_from_cl.sh @@ -44,7 +44,7 @@ notify=0 ignore_memory_requirement=0 expected_memory_usage=30000000 uram_option=2 -vdefine="__NONE__" +vdefine="" reference_checkpoint="__NONE__" function info_msg { @@ -166,7 +166,11 @@ do opt_vdefine+=" -verilog_define " opt_vdefine+=${vdefine_array[index]} done -echo "$opt_vdefine" + +if [[ "$opt_vdefine" == "" ]]; then + opt_vdefine="__NONE__" +fi +info_msg "opt_vdefine is : $opt_vdefine" if [ $expected_memory_usage -gt `get_instance_memory` ]; then output_message="YOUR INSTANCE has less memory than is necessary for certain builds. This means that your builds will take longer than expected. \nTo change to an instance type with more memory, please check our instance resize guide: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-resize.html" From 7113ce307e4f8dc14f63a56464efbc3401672258 Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Fri, 6 Aug 2021 17:16:03 +0000 Subject: [PATCH 4/4] read_checkpoint -incremental must happen after opt_design trying to do it after link_design or after CL_synthesis leads to an error saying ERROR: [Vivado 12-4846] Found memory core that needs to be (re)generated. Please run opt_design or implement_mig_cores prior to launching 'read_checkpoint -incremental'. --- .../cl_firesim/build/scripts/create_dcp_from_cl.tcl | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/hdk/cl/developer_designs/cl_firesim/build/scripts/create_dcp_from_cl.tcl b/hdk/cl/developer_designs/cl_firesim/build/scripts/create_dcp_from_cl.tcl index 33dd2bac..fad503db 100644 --- a/hdk/cl/developer_designs/cl_firesim/build/scripts/create_dcp_from_cl.tcl +++ b/hdk/cl/developer_designs/cl_firesim/build/scripts/create_dcp_from_cl.tcl @@ -281,14 +281,6 @@ if {$implement} { write_checkpoint -force $CL_DIR/build/checkpoints/${timestamp}.post_link.dcp } - ######################## - # Load Reference Checkpoint (if provided) - ######################## - if {$reference_checkpoint != "__NONE__"} { - read_checkpoint -incremental $reference_checkpoint - report_incremental_reuse -hierarchical -file $CL_DIR/build/reports/${timestamp}.post_link_incremental_reuse.rpt - } - ######################## # CL Optimize ######################## @@ -301,7 +293,12 @@ if {$implement} { } } report_utilization -hierarchical -file $CL_DIR/build/reports/${timestamp}.post_opt_utilization.rpt + + ######################## + # Load Reference Checkpoint (if provided) + ######################## if {$reference_checkpoint != "__NONE__"} { + read_checkpoint -incremental $reference_checkpoint report_incremental_reuse -hierarchical -file $CL_DIR/build/reports/${timestamp}.post_opt_incremental_reuse.rpt }