diff --git a/CodeExamples/RegressionSingleOp.py b/CodeExamples/RegressionSingleOp.py index d9d5ed0..fb02bd2 100755 --- a/CodeExamples/RegressionSingleOp.py +++ b/CodeExamples/RegressionSingleOp.py @@ -117,6 +117,7 @@ def genAndRunValue(singleArith, opList, wordLenList, vectorLen, archName, keep): parser.add_argument('-z', '--analyse', action='store_true', help='Analyse result') parser.add_argument('-d', '--dotests', action='store_true', help='Generate results') a = parser.parse_args() + print(a.wLen); # print (a) results = {} csvFileName = "regression-single-op-%s.csv"%a.arch[0] @@ -124,29 +125,20 @@ def genAndRunValue(singleArith, opList, wordLenList, vectorLen, archName, keep): if len(a.arch) != 1: exitError("Could only analyse 1 architecture") else: - # Read reference list - csvRef = csv.reader (open ("RegressionSingleOpReference.csv", "r"), delimiter=";") - # Restrict the list to 1 arch - refList = [(ref[0], ref[1], int(ref[2]), int(ref[3]), ref[4]) for ref in csvRef if ref[5] == a.arch[0]] - refList.sort() - # print (refList) - - # Read the generated results + csvArch = csv.reader (open (csvFileName, "r"), delimiter=";") - archList = [(ref[0], ref[1], int(ref[2]), int(ref[3]), ref[4]) for ref in csvArch] + archList = [(ref[0], ref[1], int(ref[2]), int(ref[3]), ref[4],ref[5],ref[6]) for ref in csvArch] archList.sort() # print (archList) - moreInArch = [x for x in refList + archList if x not in refList] - moreInRef = [x for x in refList + archList if x not in archList] - print ("moreInRef : "+str(moreInRef)) - print ("moreInArch : "+str(moreInArch)) - if archList == refList: - print ("same list") - sys.exit(0) - else: - print ("different list") - sys.exit(-1) + checkIf = False + for test in archList: + print(test) + if(test[6] == "Fail"): + checkIf = True + if(checkIf): + exit(-1) + elif a.dotests: if "value" in a.param: for archName in a.arch: diff --git a/CodeExamples/Tests/Test-Address-mul-int-008-128-aarch64+riscv+power.hl b/CodeExamples/Tests/Test-Address-mul-int-008-128-aarch64+riscv+power.hl new file mode 100644 index 0000000..2b9dab7 --- /dev/null +++ b/CodeExamples/Tests/Test-Address-mul-int-008-128-aarch64+riscv+power.hl @@ -0,0 +1,46 @@ +// -*- c -*- +#include +#include +/* C compilette prototype vector version*/ +typedef int8_t v8_128_int_t __attribute__ ((vector_size (128*sizeof (int8_t)))); +typedef void (*functionPointer)(v8_128_int_t*, v8_128_int_t*, v8_128_int_t*); +functionPointer genSingleOp(functionPointer ptr) /* C compilette prototype */ +{ + +#[ +int 32 1 compilette(int[] 8 128 a, int[] 8 128 b, int[] 8 128 r) +{ + r[0] = a[0] * b[0]; + return 1; +} +]# + return ptr; +} +int main(int argc, char * argv[]) +{ + functionPointer fPtr; + int i, returnValue; + if (argc < 256) + { + printf("Give 256 values\n"); + exit(-1); + } + v8_128_int_t in0, in1, res; + for (int i = 0; i < 128; i++) + { + in0[i] = atoi (argv[1+i]); + in1[i] = atoi (argv[1+128+i]); + } + fPtr = h2_malloc (1024); + fPtr = (functionPointer) genSingleOp(fPtr); + fPtr(&in0, &in1, &res); + printf ("Simple operation on 2 variables (wordLen: 8, vectorLen 128):\n"); + returnValue = 0; + for (i= 0; i < 128; i++) + { +printf("%d * %d = %d\n", in0[i], in1[i], res[i]); +if (res[i] != (in0[i] * in1[i])) + returnValue = -1; + } + return returnValue; +} \ No newline at end of file diff --git a/CodeExamples/Tests/Test-Value-sub-flt-064-001-+.hl b/CodeExamples/Tests/Test-Value-sub-flt-064-001-+.hl new file mode 100644 index 0000000..4eed885 --- /dev/null +++ b/CodeExamples/Tests/Test-Value-sub-flt-064-001-+.hl @@ -0,0 +1,46 @@ +// -*- c -*- +#include +#include +/* C compilette prototype scalar version*/ +typedef double (*functionPointer)(double, double); +functionPointer genSingleOp(h2_insn_t * ptr) /* C compilette prototype */ +{ + +#[ +flt 64 1 compilette(flt 64 1 a, flt 64 1 b) +{ + flt 64 1 r; + r = a - b; + return r; +} +]# + return (functionPointer) ptr; +} +int main(int argc, char * argv[]) +{ + functionPointer fPtr; + int i, returnValue; + if (argc < 2) + { + printf("Give 2 values\n"); + exit(-1); + } + double in0, in1, res; + for (int i = 0; i < 1; i++) + { + in0 = atof (argv[1]); + in1 = atof (argv[1]); + } + fPtr = h2_malloc (1024); + fPtr = (functionPointer) genSingleOp(fPtr); + res = fPtr(in0, in1); + printf ("Simple operation on 2 variables (wordLen: 64, vectorLen 1):\n"); + returnValue = 0; + for (i= 0; i < 1; i++) + { + printf("%f - %f = %f\n", in0, in1, res); + if (res != (in0 - in1)) + returnValue = -1; + } + return returnValue; +} \ No newline at end of file diff --git a/Demos/Makefile b/Demos/Makefile index 5d42c6e..10ec8cb 100644 --- a/Demos/Makefile +++ b/Demos/Makefile @@ -1,3 +1,17 @@ +buildAll: + -(cd Stencil; make buildAll) + -(cd VectorMatrix; make buildAll) + -(cd Newton-SquareRoot-VariablePrecision; make buildAll) + -(cd AudioFilter ; make buildAll) + -(cd C-SRAM_Applications; make buildAll) + -(cd CelciusFarenheitConversions; make buildAll) + -(cd ImagePixelSum; make buildAll) + -(cd IOTWorkerSpecialization; make buildAll) + -(cd Kahan3Sum; make buildAll) + -(cd ReversePolishNotation; make buildAll) + -(cd Stencil1D; make buildAll) + + clean: -(cd Stencil; make clean) -(cd VectorMatrix; make clean) diff --git a/Makefile b/Makefile index 69b0e52..0a426b3 100755 --- a/Makefile +++ b/Makefile @@ -6,7 +6,22 @@ all: @echo "What action do you target ?" @echo "make buildGrammar # Build grammars (need antlr)" @echo "make DbPopulate # Fill database with instruction sets" - @echo "make clean buildGrammar DbPopulate " + @echo "make clean # Clean grammars generated files and delete database" + @echo "make buildAll # Clean environment Build grammars, fill database and build Demos. HybroGen ready to use" + @echo "make check # To check if your installation is completed" + +buildAll: clean + make buildGrammar + make DbPopulate + make cd ./Demos && make buildAll + +# Uncomment if you whish to use distant database +# DBIDS = --dbIds "DistantHost:DataBaseName:UserDbName:DbPassword" + +# Uncomment if you whish to use distant database +# DBIDS = --dbIds "DistantHost:DataBaseName:UserDbName:DbPassword" + + DbPopulate: ./H2Isa.py -n ${DBIDS} # Create database schema @@ -39,16 +54,49 @@ clean: -(cd Demos/; make clean) doregression: - cd CodeExamples && ./Regression.py ${THEARCH} + @(cd CodeExamples && ./Regression.py ${THEARCH}) aarch64: - make doregression THEARCH=aarch64 + @make doregression THEARCH=aarch64 riscv: - make doregression THEARCH=riscv + @make doregression THEARCH=riscv power: - make doregression THEARCH=power + @make doregression THEARCH=power cxram: - make doregression THEARCH=cxram + @make doregression THEARCH=cxram + + +VERBOSE ?= 0 + +ifeq ($(VERBOSE),1) + REDIRECT := +else + REDIRECT := > /dev/null 2>&1 +endif + + +check: + @echo "[INFO] Start check with Regression test" + @make --no-print-directory aarch64 ${REDIRECT} && (echo "[OK] Regression test on aarch64")|| (echo "[FAIL] Regression test fail for aarch64") + @make --no-print-directory power ${REDIRECT} && (echo "[OK] Regression test on power")|| (echo "[FAIL] Regression test fail for power") + @make --no-print-directory riscv ${REDIRECT} && (echo "[OK] Regression test on riscv")|| (echo "[FAIL] Regression test fail for riscv") +# @echo "[INFO]start check with regressionSingleOp" +# @(cd CodeExamples && ./RegressionSingleOp.py -d -a aarch64 riscv power ${REDIRECT}) +# @(cd CodeExamples && ./RegressionSingleOp.py -z -a aarch64 ${REDIRECT} ) && (echo "[OK] Regression test on aarch64")|| (echo "[FAIL] Regression test fail for aarch64") +# @(cd CodeExamples && ./RegressionSingleOp.py -z -a power ${REDIRECT} ) && (echo "[OK] Regression test on power")|| (echo "[FAIL] Regression test fail for power") +# @(cd CodeExamples && ./RegressionSingleOp.py -z -a riscv ${REDIRECT} ) && (echo "[OK] Regression test on riscv")|| (echo "[FAIL] Regression test fail for riscv") + @echo "[INFO] Start trying Demo Stencil (can takes a lot of time (15-20 minutes))" + @(cd ./Demos/Stencil && make -s --no-print-directory allAarch64Qemu ${REDIRECT} ) && (echo "[OK] Demo stencil on aarch64 works") || (echo "[FAIL] Demo Stencil fail on aarch64") + @(cd ./Demos/Stencil && make -s --no-print-directory allRiscvQemu ${REDIRECT} ) && (echo "[OK] Demo stencil on riscv works") || (echo "[FAIL] Demo Stencil fail on riscv") + @(cd ./Demos/Stencil && make -s --no-print-directory allPowerQemu ${REDIRECT} ) && (echo "[OK] Demo stencil on power works") || (echo "[FAIL] Demo Stencil fail on power") + @echo "[INFO] Start Trying Demo Vector Matrix" + @(cd ./Demos/VectorMatrix && make -s --no-print-directory aarch64 ${REDIRECT} ) && (echo "[OK] Demo Vector Matrix on aarch64 works") || (echo "[FAIL] Demo Vector Matrix fail on aarch64") + @(cd ./Demos/VectorMatrix && make -s --no-print-directory riscv ${REDIRECT} ) && (echo "[OK] Demo Vector Matrix on riscv works") || (echo "[FAIL] Demo Vector Matrix fail on riscv") + @(cd ./Demos/VectorMatrix && make -s --no-print-directory power ${REDIRECT} ) && (echo "[OK] Demo Vector Matrix on power works") || (echo "[FAIL] Demo Vector Matrix fail on power") + @echo "[INFO] Start Trying Demo Newton-SquareRoot-VariablePrecision" + @(cd ./Demos/Newton-SquareRoot-VariablePrecision && make -s --no-print-directory demo-aarch64 ${REDIRECT} ) && (echo "[OK] Demo Newton-SquareRoot-VariablePrecision on aarch64 works") || (echo "[FAIL] Demo Newton-SquareRoot-VariablePrecision fail on aarch64") + @(cd ./Demos/Newton-SquareRoot-VariablePrecision && make -s --no-print-directory demo-power ${REDIRECT} ) && (echo "[OK] Demo Newton-SquareRoot-VariablePrecision on power works") || (echo "[FAIL] Demo Newton-SquareRoot-VariablePrecision fail on power") + @(cd ./Demos/Newton-SquareRoot-VariablePrecision && make -s --no-print-directory demo-riscv ${REDIRECT} ) && (echo "[OK] Demo Newton-SquareRoot-VariablePrecision on riscv works") || (echo "[FAIL] Demo Newton-SquareRoot-VariablePrecision fail on riscv")