DB4HLS

Tutorial

This page offers a few examples of SQL scripts that can be used to interact with the tutorial. In addition, are shown examples for defining a configuration space with the proposed DSL, and, lastly, how to use the gnu-parallel framework to concurrently run synthesis processes is described.

Retrieve the designs from the database

The following script retrieves all the available designs in the database independently from their original benchmark and application.
SQL Script:

SELECT * FROM DB4HLS.design;

Example of output:

Retrieve all the configurations associated with a design configuration space

The following script given a configuration space identifier (i.e., id_configuration_space) retrieves all the associated configurations in the database. The id_configuration_space=455 is associated to the configuration space with name=aes_addRoundKey_aes_aes.
SQL Script:

SELECT * FROM DB4HLS.configuration where id_configuration_space=445;

Example of output:

Retrieve all the completed implementations given the configuration hashes

The following script extracts all the completed synthesis (hls_exit_value=0) given a list of configuration hashes (hash_configuration). The hashes can be retrieved from the table obtained in the example above.
SQL Script:

SELECT * FROM DB4HLS.implementation where hash_configuration in ( SELECT hash_configuration FROM DB4HLS.configuration where id_configuration_space=445 ) and hls_exit_value=0;

Example of output:

Retrieve performance results from a list of implementations

The following script, given the id_performance_result of the extracted implementations (see example above), retrieves all the associated performance results.
SQL Script:

SELECT * FROM DB4HLS.performance_results where id_performance_result in ( SELECT id_performance_results FROM DB4HLS.implementation where hash_configuration in ( SELECT hash_configuration FROM DB4HLS.configuration where id_configuration_space=445 ) and hls_exit_value=0 );

Example of output:

DSL examples

Herein follows a few DSL scripts to automatically generate generate all the configurations of the defined configuration space:

The DSL parser and other examples can be found in the db4hls github repository

aes256_encrypt_ecb

Example of configuration space defined for the aes256_encrypt_ecb function from MachSuite. The following script defines a configuration space with 1944 different configurations.

resource;aes256_encrypt_ecb;ctx;{RAM_2P_BRAM} resource;aes256_encrypt_ecb;k;{RAM_2P_BRAM} resource;aes256_encrypt_ecb;buf;{RAM_2P_BRAM} array_partition;aes256_encrypt_ecb;ctx->key;1;{cyclic};{1,8,32}@A array_partition;aes256_encrypt_ecb;ctx->enckey;1;{cyclic};{1,8,32}@A array_partition;aes256_encrypt_ecb;ctx->deckey;1;{cyclic};{1,8,32}@A array_partition;aes256_encrypt_ecb;k;1;{cyclic};{1,8,32} array_partition;aes256_encrypt_ecb;buf;1;{cyclic};{1,4,16} unroll;aes256_encrypt_ecb;ecb1;{1,8,32}@A unroll;aes256_encrypt_ecb;ecb2;{1,2,8} inline;aes_expandEncKey;{on,off} inline;aes_addRoundKey_cpy;{on,off}@B unroll;aes256_encrypt_ecb;ecb3;{1,7,14} inline;aes_subBytes;{on,off}@C inline;aes_shiftRows;{on,off}@C inline;aes_mixColumns;{on,off}@C inline;aes_addRoundKey;{on,off}@B clock;{10}

The binding decorator @A is used to constraint the directive values of knobs at lines 4,5,6 and 9 to share the same directive value in all the generated configurations. Therefore, there are no configurations generated with all the permutations of three possible directive values for the bound knobs. In the same way, knob @B and @C bind the knobs at lines 12 and 17, and 14, 15, and 16, respectively.

Retrieve all the configurations associated to a design configuration space

Example of configuration space defined for the get_delta_matrix_weights1 function from MachSuite. The following script defines a configuration space with 21952 different configurations.

array_partition;get_delta_matrix_weights1;delta_weights1;1; {cyclic,block};{1->832,integer_divisors} array_partition;get_delta_matrix_weights1;output_difference;1; {cyclic,block};{1->64,integer_divisors} array_partition;get_delta_matrix_weights1;last_activations;1; {cyclic,block};{1->13,integer_divisors} unroll;get_delta_matrix_weights1;loop_1;{1->13,integer_divisors} unroll;get_delta_matrix_weights1;loop_2;{1->64,integer_divisors} clock;{10}

The directive value generators are used in this example to populate all the directive value sets, but the clock one. The generators allow to automatically generate the desired values without enumerating them. In the example, the 1->832,integer_divisors generator, generates a set of values which are all the integer divisors of 832 with the starting elements (i.e., 1) and the last one (i.e., 832) included.

Another possible generator supported by the DSL is pow_2, which generates all the powers of two in between the starting and the ending numbers specified.

Parallel framework for Design Space Explorations.

In order to use the parallel framework to run exhaustive DSEs, clone the db4hls github repository with the source files and instructions on how to run it.

Author

Lorenzo Ferretti, Ph.D. student at Università della Svizzera italiana (USI).
You can find more information about my work here and for any question you can contact me at [email protected].