Skip to content

Commit

Permalink
Merge branch 'master' into jmgd/sublayer-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Duarte authored Sep 19, 2018
2 parents 68d87dc + 54294a7 commit 86e6766
Show file tree
Hide file tree
Showing 30 changed files with 1,718 additions and 76 deletions.
127 changes: 127 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
pipeline {
agent {
docker {
image 'hls4ml-with-vivado:latest'
}
}
options {
timeout(time: 3, unit: 'HOURS')
}

stages {
stage('Keras to HLS') {
parallel {
stage('py36') {
steps {
dir(path: 'test') {
sh '''#!/bin/bash
. activate hls4ml-py36
cat keras-models.txt | xargs ./keras-to-hls.sh -p 3'''
}
}
}
stage('py27') {
steps {
dir(path: 'test') {
sh '''#!/bin/bash
. activate hls4ml-py27
cat keras-models.txt | xargs ./keras-to-hls.sh -p 2'''
}
}
}
}
post {
success {
dir(path: 'test') {
sh '''#!/bin/bash
./py-diff.sh -r 2'''
}
}
}
}
stage('C Simulation') {
parallel {
stage('2017.2') {
when {
allOf {
environment name: 'USE_VIVADO_2017', value: '1';
environment name: 'TEST_SIMULATION', value: '1'
}
}
steps {
dir(path: 'test') {
sh '''#!/bin/bash
./build-prj.sh -i /opt/Xilinx -v 2017.2 -c -p 2'''
}
}
}
stage('2018.2') {
when {
allOf {
environment name: 'USE_VIVADO_2018', value: '1';
environment name: 'TEST_SIMULATION', value: '1'
}
}
steps {
dir(path: 'test') {
sh '''#!/bin/bash
./build-prj.sh -i /opt/Xilinx -v 2018.2 -c -p 2'''
}
}
}
}
}
stage('C/RTL Synthesis') {
parallel {
stage('2017.2') {
when {
allOf {
environment name: 'USE_VIVADO_2017', value: '1';
environment name: 'TEST_SYNTHESIS', value: '1'
}
}
steps {
dir(path: 'test') {
sh '''#!/bin/bash
./build-prj.sh -i /opt/Xilinx -v 2017.2 -r -p 2'''
}
}
}
stage('2018.2') {
when {
allOf {
environment name: 'USE_VIVADO_2018', value: '1';
environment name: 'TEST_SYNTHESIS', value: '1'
}
}
steps {
dir(path: 'test') {
sh '''#!/bin/bash
./build-prj.sh -i /opt/Xilinx -v 2018.2 -r -p 2'''
}
}
}
}
}
stage('Report') {
when {
environment name: 'TEST_SYNTHESIS', value: '1'
}
steps {
dir(path: 'test') {
sh '''#!/bin/bash
./gather-reports.sh -b'''
}

}
}
}
post {
always {
dir(path: 'test') {
sh '''#!/bin/bash
./cleanup.sh'''
}
}
}
}
2 changes: 1 addition & 1 deletion example-prjs/conv-1layer/firmware/weights/w2.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
//Min -3.99493789673
//Max 1.6389746666

weight_default_t w2[12][6] = {0.0703558772802, 0.195531725883, 0.882671236992, 0.122258678079, -0.805009901524, -1.77403998375, 0.0427149757743, 0.2606151402, 0.198590949178, -2.00605344772, -1.25901305676, -0.680186808109, 0.876149058342, 0.850599467754, 0.266026824713, -1.21070945263, -0.611534416676, -1.47468972206, 0.0826660320163, 0.445819497108, 1.25453591347, 0.190964847803, -1.50951910019, -1.41201293468, 0.00866852328181, 0.437172561884, 0.51068431139, -2.64838910103, -1.85585343838, -0.479221761227, 0.703556954861, 0.789607465267, -0.0566038452089, -2.16423130035, -1.21902525425, -2.31408381462, -0.369159549475, -0.115854308009, 1.1034463644, -1.43637740612, -1.78799104691, -2.31636929512, 0.369361281395, 0.615654408932, 0.914156675339, -2.67787241936, -0.783697903156, -1.04587876797, 0.630964159966, 0.822637975216, -0.104492470622, -2.55448246002, -1.22843444347, -2.11188864708, 0.0971898436546, 0.223909288645, 1.6389746666, -0.852568626404, -2.76464748383, -3.99493789673, 0.387508243322, 0.324822813272, 0.814649283886, -1.97792601585, -3.38260149956, -2.22571611404, 0.774132668972, 1.03101193905, -0.143244296312, -2.81113767624, -2.69752907753, -0.8527354002};
weight_default_t w2[72] = {0.0703558772802, 0.195531725883, 0.882671236992, 0.122258678079, -0.805009901524, -1.77403998375, 0.0427149757743, 0.2606151402, 0.198590949178, -2.00605344772, -1.25901305676, -0.680186808109, 0.876149058342, 0.850599467754, 0.266026824713, -1.21070945263, -0.611534416676, -1.47468972206, 0.0826660320163, 0.445819497108, 1.25453591347, 0.190964847803, -1.50951910019, -1.41201293468, 0.00866852328181, 0.437172561884, 0.51068431139, -2.64838910103, -1.85585343838, -0.479221761227, 0.703556954861, 0.789607465267, -0.0566038452089, -2.16423130035, -1.21902525425, -2.31408381462, -0.369159549475, -0.115854308009, 1.1034463644, -1.43637740612, -1.78799104691, -2.31636929512, 0.369361281395, 0.615654408932, 0.914156675339, -2.67787241936, -0.783697903156, -1.04587876797, 0.630964159966, 0.822637975216, -0.104492470622, -2.55448246002, -1.22843444347, -2.11188864708, 0.0971898436546, 0.223909288645, 1.6389746666, -0.852568626404, -2.76464748383, -3.99493789673, 0.387508243322, 0.324822813272, 0.814649283886, -1.97792601585, -3.38260149956, -2.22571611404, 0.774132668972, 1.03101193905, -0.143244296312, -2.81113767624, -2.69752907753, -0.8527354002};
2 changes: 1 addition & 1 deletion example-prjs/conv2d-1layer/firmware/weights/w2.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example-prjs/higgs-1layer/firmware/weights/w1.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
//Min -0.780374884605
//Max 0.646854102612

weight_default_t w1[10][32] = {0.469886034727, 0.33286473155, 0.49105873704, -0.200682103634, -0.442451655865, 0.349089324474, -0.00461332546547, 0.485931366682, 0.542743623257, 0.0105694588274, -0.372760951519, -0.439520865679, 0.0936330631375, 0.0439695045352, -0.0137981586158, 0.295308321714, -0.341242134571, -0.235930711031, -0.158450946212, 0.237205564976, 0.281340658665, 0.437705606222, -0.577979207039, 0.331360459328, 0.152280181646, 0.411959022284, 0.388127863407, -0.27843233943, 0.16480627656, 0.0976520776749, 0.627826809883, -0.1764690727, 0.424388736486, 0.642921924591, -0.422784358263, -0.158862888813, 0.300285577774, 0.238359376788, 0.0195394605398, 0.317052841187, 0.326164513826, 0.303764522076, 0.407794475555, 0.257050514221, 0.51091337204, 0.062592022121, 0.588592231274, -0.287731796503, 0.386802703142, -0.375764399767, -0.427033543587, -0.167250394821, -0.000206599419471, 0.24760761857, 0.235603064299, -0.295301884413, -0.65853947401, 0.0971146598458, 0.480021834373, -0.268138796091, -0.233451142907, -0.652442574501, -0.671008348465, 0.220575734973, -0.400389879942, 0.438910186291, -0.306240767241, -0.323651224375, -0.392225533724, 0.3572678864, -0.397361218929, 0.394868463278, 0.0780302062631, 0.106056764722, -0.487095057964, -0.327191382647, 0.644771695137, -0.34697213769, 0.591501116753, 0.0155806466937, 0.264412999153, 0.0641430318356, 0.065486446023, 0.166196450591, 0.264521747828, 0.063338264823, -0.299565404654, 0.148377254605, -0.574795842171, 0.574057936668, 0.258876770735, 0.0988429412246, 0.0118086850271, 0.365797281265, 0.20612552762, -0.403643190861, -0.388556420803, -0.338402450085, -0.10554137826, -0.458934038877, 0.113407559693, 0.433230131865, 0.188863113523, 0.0728542357683, 0.404284179211, 0.554571032524, -0.0320322774351, 0.0706231668591, 0.171757608652, 0.0327457301319, 0.609308063984, 0.285122692585, 0.0312469471246, -0.153103038669, -0.618405401707, -0.498597204685, -0.120579503477, -0.585806488991, 0.310296028852, -0.519743859768, -0.61884611845, 0.646854102612, -0.12144652009, 0.427223861217, 0.0946889296174, -0.24024116993, 0.213585242629, 0.426330417395, 0.0677106902003, 0.307132989168, -0.408271700144, 0.564430236816, 0.373969048262, -0.294965475798, 0.268711477518, 0.340486526489, 0.580298185349, -0.448332995176, 0.300760626793, -0.355630248785, 0.379427969456, 0.0594677887857, 0.278144806623, -0.307702571154, -0.164764538407, 0.323285609484, -0.593663454056, 0.137764915824, 0.183085903525, -0.0766139179468, -0.541784107685, -0.363497048616, 0.0167881250381, -0.424634546041, 0.0934605523944, -0.307861149311, -0.0440296866, 0.0679265484214, 0.642297625542, -0.0125775840133, 0.15372492373, -0.456968694925, -0.619609177113, 0.108014553785, -0.332670778036, -0.0228065475821, 0.110137924552, -0.451573699713, -0.0221301410347, 0.278278380632, 0.326373547316, 0.149607345462, -0.108291178942, -0.412107855082, -0.564781546593, -0.257253676653, 0.397280603647, 0.505163490772, -0.187055394053, 0.484979391098, 0.26713809371, 0.0772454589605, 0.0883025079966, 0.377275258303, -0.12519736588, 0.38796466589, 0.195471301675, -0.431639403105, -0.0420404225588, -0.592884480953, -0.710084378719, 0.322846531868, -0.367289185524, 0.381537139416, -0.60257935524, -0.478854894638, 0.413495451212, 0.319222390652, 0.385795325041, -0.115412861109, 0.402388989925, 0.162365406752, 0.369744092226, 0.310960561037, -0.00471964431927, 0.0807521864772, -0.372333705425, -0.172515034676, -0.115229815245, -0.240981906652, -0.0264383982867, 0.409555137157, -0.0810084193945, 0.0773022249341, -0.770044803619, 0.0681896284223, 0.46504843235, 0.454740464687, -0.22361548245, 0.403856545687, 0.330072641373, -0.321361631155, 0.00806753803045, -0.356280982494, 0.324613630772, 0.115001045167, 0.367018848658, -0.571761250496, 0.151520609856, -0.280782312155, -0.363941133022, -0.679587125778, -0.0962254032493, -0.0460290648043, 0.2845274508, -0.124097146094, -0.170083731413, 0.224245175719, -0.557738721371, 0.328040361404, -0.0466306358576, 0.306923151016, -0.353631287813, 0.48392868042, -0.215632915497, 0.450591593981, -0.351363986731, -0.421781778336, 0.496215313673, -0.302800446749, 0.251873165369, -0.43370205164, 0.119063258171, -0.35147562623, -0.39615136385, 0.0605220645666, 0.423658758402, -0.248717084527, -0.346449553967, -0.501381456852, 0.0550600588322, 0.0405263975263, 0.205968305469, -0.035626064986, -0.312921822071, 0.0827094018459, 0.390530824661, -0.024772150442, 0.412245184183, -0.276159733534, -0.780374884605, -0.120683729649, 0.307958126068, 0.169523924589, -0.344679713249, 0.0704858377576, 0.493517488241, 0.306565761566, -0.304837614298, -0.543242454529, -0.220428451896, -0.706516087055, -0.128503292799, -0.351199686527, 0.201777845621, 0.0973702296615, -0.327868074179, -0.446466118097, -0.547505736351, -0.174534186721, -0.0659094750881, 0.18624329567, 0.276881158352, 0.322869598866, -0.136942520738, -0.655940413475, 0.267590165138, -0.31935557723, -0.195686161518, -0.392601639032, -0.624195575714, 0.115053512156, -0.346742898226, -0.0618994273245, 0.500961601734, 0.459005326033, 0.110334888101, -0.151589557528, 0.399537920952, 0.325923115015, -0.00381595967337, 0.334656924009, -0.466167807579, 0.338534146547, 0.333391338587, -0.0439685583115, 0.426117956638, -0.254403948784, 0.155952066183, 0.222431972623};
weight_default_t w1[320] = {0.469886034727, 0.33286473155, 0.49105873704, -0.200682103634, -0.442451655865, 0.349089324474, -0.00461332546547, 0.485931366682, 0.542743623257, 0.0105694588274, -0.372760951519, -0.439520865679, 0.0936330631375, 0.0439695045352, -0.0137981586158, 0.295308321714, -0.341242134571, -0.235930711031, -0.158450946212, 0.237205564976, 0.281340658665, 0.437705606222, -0.577979207039, 0.331360459328, 0.152280181646, 0.411959022284, 0.388127863407, -0.27843233943, 0.16480627656, 0.0976520776749, 0.627826809883, -0.1764690727, 0.424388736486, 0.642921924591, -0.422784358263, -0.158862888813, 0.300285577774, 0.238359376788, 0.0195394605398, 0.317052841187, 0.326164513826, 0.303764522076, 0.407794475555, 0.257050514221, 0.51091337204, 0.062592022121, 0.588592231274, -0.287731796503, 0.386802703142, -0.375764399767, -0.427033543587, -0.167250394821, -0.000206599419471, 0.24760761857, 0.235603064299, -0.295301884413, -0.65853947401, 0.0971146598458, 0.480021834373, -0.268138796091, -0.233451142907, -0.652442574501, -0.671008348465, 0.220575734973, -0.400389879942, 0.438910186291, -0.306240767241, -0.323651224375, -0.392225533724, 0.3572678864, -0.397361218929, 0.394868463278, 0.0780302062631, 0.106056764722, -0.487095057964, -0.327191382647, 0.644771695137, -0.34697213769, 0.591501116753, 0.0155806466937, 0.264412999153, 0.0641430318356, 0.065486446023, 0.166196450591, 0.264521747828, 0.063338264823, -0.299565404654, 0.148377254605, -0.574795842171, 0.574057936668, 0.258876770735, 0.0988429412246, 0.0118086850271, 0.365797281265, 0.20612552762, -0.403643190861, -0.388556420803, -0.338402450085, -0.10554137826, -0.458934038877, 0.113407559693, 0.433230131865, 0.188863113523, 0.0728542357683, 0.404284179211, 0.554571032524, -0.0320322774351, 0.0706231668591, 0.171757608652, 0.0327457301319, 0.609308063984, 0.285122692585, 0.0312469471246, -0.153103038669, -0.618405401707, -0.498597204685, -0.120579503477, -0.585806488991, 0.310296028852, -0.519743859768, -0.61884611845, 0.646854102612, -0.12144652009, 0.427223861217, 0.0946889296174, -0.24024116993, 0.213585242629, 0.426330417395, 0.0677106902003, 0.307132989168, -0.408271700144, 0.564430236816, 0.373969048262, -0.294965475798, 0.268711477518, 0.340486526489, 0.580298185349, -0.448332995176, 0.300760626793, -0.355630248785, 0.379427969456, 0.0594677887857, 0.278144806623, -0.307702571154, -0.164764538407, 0.323285609484, -0.593663454056, 0.137764915824, 0.183085903525, -0.0766139179468, -0.541784107685, -0.363497048616, 0.0167881250381, -0.424634546041, 0.0934605523944, -0.307861149311, -0.0440296866, 0.0679265484214, 0.642297625542, -0.0125775840133, 0.15372492373, -0.456968694925, -0.619609177113, 0.108014553785, -0.332670778036, -0.0228065475821, 0.110137924552, -0.451573699713, -0.0221301410347, 0.278278380632, 0.326373547316, 0.149607345462, -0.108291178942, -0.412107855082, -0.564781546593, -0.257253676653, 0.397280603647, 0.505163490772, -0.187055394053, 0.484979391098, 0.26713809371, 0.0772454589605, 0.0883025079966, 0.377275258303, -0.12519736588, 0.38796466589, 0.195471301675, -0.431639403105, -0.0420404225588, -0.592884480953, -0.710084378719, 0.322846531868, -0.367289185524, 0.381537139416, -0.60257935524, -0.478854894638, 0.413495451212, 0.319222390652, 0.385795325041, -0.115412861109, 0.402388989925, 0.162365406752, 0.369744092226, 0.310960561037, -0.00471964431927, 0.0807521864772, -0.372333705425, -0.172515034676, -0.115229815245, -0.240981906652, -0.0264383982867, 0.409555137157, -0.0810084193945, 0.0773022249341, -0.770044803619, 0.0681896284223, 0.46504843235, 0.454740464687, -0.22361548245, 0.403856545687, 0.330072641373, -0.321361631155, 0.00806753803045, -0.356280982494, 0.324613630772, 0.115001045167, 0.367018848658, -0.571761250496, 0.151520609856, -0.280782312155, -0.363941133022, -0.679587125778, -0.0962254032493, -0.0460290648043, 0.2845274508, -0.124097146094, -0.170083731413, 0.224245175719, -0.557738721371, 0.328040361404, -0.0466306358576, 0.306923151016, -0.353631287813, 0.48392868042, -0.215632915497, 0.450591593981, -0.351363986731, -0.421781778336, 0.496215313673, -0.302800446749, 0.251873165369, -0.43370205164, 0.119063258171, -0.35147562623, -0.39615136385, 0.0605220645666, 0.423658758402, -0.248717084527, -0.346449553967, -0.501381456852, 0.0550600588322, 0.0405263975263, 0.205968305469, -0.035626064986, -0.312921822071, 0.0827094018459, 0.390530824661, -0.024772150442, 0.412245184183, -0.276159733534, -0.780374884605, -0.120683729649, 0.307958126068, 0.169523924589, -0.344679713249, 0.0704858377576, 0.493517488241, 0.306565761566, -0.304837614298, -0.543242454529, -0.220428451896, -0.706516087055, -0.128503292799, -0.351199686527, 0.201777845621, 0.0973702296615, -0.327868074179, -0.446466118097, -0.547505736351, -0.174534186721, -0.0659094750881, 0.18624329567, 0.276881158352, 0.322869598866, -0.136942520738, -0.655940413475, 0.267590165138, -0.31935557723, -0.195686161518, -0.392601639032, -0.624195575714, 0.115053512156, -0.346742898226, -0.0618994273245, 0.500961601734, 0.459005326033, 0.110334888101, -0.151589557528, 0.399537920952, 0.325923115015, -0.00381595967337, 0.334656924009, -0.466167807579, 0.338534146547, 0.333391338587, -0.0439685583115, 0.426117956638, -0.254403948784, 0.155952066183, 0.222431972623};
2 changes: 1 addition & 1 deletion example-prjs/higgs-1layer/firmware/weights/w2.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
//Min -0.437459200621
//Max 0.237157344818

weight_default_t w2[32][1] = {-0.0582222938538, -0.139401033521, -0.437459200621, -0.176295682788, 0.0648417845368, 0.187429219484, 0.156936720014, -0.357166618109, -0.169738873839, -0.324651628733, 0.237157344818, 0.0639939531684, -0.386845320463, -0.00481491070241, -0.159990355372, 0.0899929478765, 0.125663176179, 0.0247628651559, -0.427373498678, -0.0069064674899, 0.0494951717556, -0.0939490869641, -0.238442763686, -0.292703747749, -0.322070419788, -0.36728823185, 0.0726772025228, 0.155764341354, 0.117759428918, -0.10209748894, -0.181185156107, 0.0284108463675};
weight_default_t w2[32] = {-0.0582222938538, -0.139401033521, -0.437459200621, -0.176295682788, 0.0648417845368, 0.187429219484, 0.156936720014, -0.357166618109, -0.169738873839, -0.324651628733, 0.237157344818, 0.0639939531684, -0.386845320463, -0.00481491070241, -0.159990355372, 0.0899929478765, 0.125663176179, 0.0247628651559, -0.427373498678, -0.0069064674899, 0.0494951717556, -0.0939490869641, -0.238442763686, -0.292703747749, -0.322070419788, -0.36728823185, 0.0726772025228, 0.155764341354, 0.117759428918, -0.10209748894, -0.181185156107, 0.0284108463675};
36 changes: 32 additions & 4 deletions hls-template/build_prj.tcl
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#################
# HLS4ML
#################
array set opt {
csim 1
synth 1
cosim 1
export 1
}

foreach arg $::argv {
foreach o [lsort [array names opt]] {
regexp "$o +(\\w+)" $arg unused opt($o)
}
}

open_project -reset myproject_prj
set_top myproject
add_files firmware/myproject.cpp -cflags "-I[file normalize nnet_utils]"
Expand All @@ -11,8 +24,23 @@ open_solution -reset "solution1"
config_array_partition -maximum_size 4096
set_part {xc7vx690tffg1927-2}
create_clock -period 5 -name default
csim_design
csynth_design
cosim_design -trace_level all
export_design -format ip_catalog

if {$opt(csim)} {
puts "***** C SIMULATION *****"
csim_design
}

if {$opt(synth)} {
puts "***** C/RTL SYNTHESIS *****"
csynth_design
if {$opt(cosim)} {
puts "***** C/RTL SIMULATION *****"
cosim_design -trace_level all
}
if {$opt(export)} {
puts "***** EXPORT IP *****"
export_design -format ip_catalog
}
}

exit
1 change: 1 addition & 0 deletions hls-template/firmware/myproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "nnet_layer.h"
#include "nnet_conv.h"
#include "nnet_conv2d.h"
#include "nnet_batchnorm.h"
#include "nnet_activation.h"

//hls-fpga-machine-learning insert weights
Expand Down
1 change: 1 addition & 0 deletions hls-template/firmware/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "nnet_conv2d.h"
#include "nnet_activation.h"
#include "nnet_common.h"
#include "nnet_batchnorm.h"

//hls-fpga-machine-learning insert numbers

Expand Down
Loading

0 comments on commit 86e6766

Please sign in to comment.