Changeset 4232
- Timestamp:
- Oct 12, 2014, 5:14:35 PM (4 years ago)
- Location:
- trunk/lib_ir
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib_ir/AgnerTestP/DriverSrcLinux
-
Property
svn:ignore
set to
*
-
Property
svn:ignore
set to
-
trunk/lib_ir/AgnerTestP/PMCTest/Makefile
r4225 r4232 1 all: llc_func.ll PMCTestA.cpp PMCTestB.cpp 2 clang PMCTestB.cpp -c -emit-llvm -msse2 -m64 -o B.bc -I ../../ -lpthread 1 all: llc_func.ll PMCTestA.cpp B.bc 3 2 llvm-as-3.5 llc_func.ll -o llc_func.bc 4 3 llvm-link B.bc llc_func.bc -o B_llc.bc … … 7 6 g++ -O2 -m64 PMCTestA.cpp B_llc_opt.o -lpthread -o PMCTest 8 7 8 asm: B_llc_opt.bc 9 llc-svn -O3 -mattr=+sse2 B_llc_opt.bc 10 vim B_llc_opt.s 11 12 single: single_llc_func.ll PMCTestA.cpp B.bc 13 llvm-as-3.5 single_llc_func.ll -o llc_func.bc 14 llvm-link B.bc llc_func.bc -o B_llc.bc 15 opt-3.5 -O3 -std-compile-opts -mattr=+sse2 B_llc.bc -o B_llc_opt.bc 16 llc-3.5 -O3 -mattr=+sse2 -filetype=obj B_llc_opt.bc -o B_llc_opt.o 17 g++ -O2 -m64 PMCTestA.cpp B_llc_opt.o -lpthread -o PMCTest 18 19 B.bc: PMCTestB.cpp 20 clang PMCTestB.cpp -c -emit-llvm -msse2 -m64 -o B.bc -I ../../ -lpthread 21 9 22 clean: 10 23 rm -f *.bc *.o a.out PMCTest PMCTestB.cpp -
trunk/lib_ir/AgnerTestP/PMCTest/PMCTestB.pytemplate.cpp
r4225 r4232 131 131 132 132 SIMD_type UserData[NUM_THREADS][USER_DATA_SIZE]; 133 SIMD_type one_constant = simd< 4>::himask();133 SIMD_type one_constant = simd<2>::himask(); 134 134 135 135 … … 231 231 // Put the code to test here, 232 232 // or a call to a function defined in a separate module 233 233 {% if NoLoop %} 234 {% for ii in range(0, TestInstrCount) %} 235 UserData[thread][{{ii}}] = {{ TestInstr | replace("[i]", "[" ~ ii ~ "]") }}; 236 {% endfor %} 237 {% else %} 234 238 for (i = 0; i < {{TestInstrCount}}; i++) UserData[thread][i] = {{TestInstr}}; 239 {% endif %} 235 240 236 241 -
trunk/lib_ir/AgnerTestP/PMCTest/gen.py
r4224 r4232 1 1 from jinja2 import Template, Environment, FileSystemLoader 2 import subprocess 3 import argparse 4 import sys 2 5 3 6 Template = "PMCTestB.pytemplate.cpp" 4 7 Output = "PMCTestB.cpp" 8 9 FunctionListI1 = ["add", "sub", "mult", "eq", "lt", "gt", "ult", "ugt"] 10 FunctionListI2 = ["add", "sub", "mult", "eq", "lt", "gt", "ult", "ugt", "vsll", "vsrl", "vsra"] 11 FunctionListI4 = ["add", "sub", "mult", "eq", "lt", "gt", "ult", "ugt", "vsll", "vsrl", "vsra"] 12 FunctionListI8 = ["add", "sub", "mult", "eq", "lt", "gt", "ult", "ugt", "vsll", "vsrl", "vsra"] 13 14 FW = 2 15 16 def C(name): 17 return "{name}_{fw}".format(name=name, fw=FW) 18 19 def CXX(name): 20 if name in ["vsll", "vsrl", "vsra"]: 21 return "simd<{fw}>::{name}i".format(fw=FW, name=name[1:]) 22 return "simd<{fw}>::{name}".format(fw=FW, name=name) 5 23 6 24 #configuring Jinja2 … … 14 32 f.write(content) 15 33 16 def genFile( ):34 def genFile(params_dict): 17 35 fillTemplate(template=Template, output=Output, 18 params=dict(DeclaredIRFunc = "add_1", 19 DataSize = 1000, 20 UserDataInit = "simd<32>::constant<0>()", 21 TestInstrCount = 500, 22 TestInstr = "simd<1>::add(UserData[thread][i], one_constant)" 23 )) 36 params=params_dict) 37 38 header = "Scale, Core, Core cyc, Instruct, Uops, L1D Miss" 39 40 def extract(func): 41 if subprocess.call("llvm-extract-3.5 -func {0} -S llc_func.ll > single_llc_func.ll".format(func), 42 shell=True) != 0: 43 raise Exception("Extract IR func failed.") 44 45 def run(single=False): 46 if single: 47 if subprocess.call("timeout 30s make single", shell=True) != 0: 48 raise Exception("Make failed.") 49 else: 50 if subprocess.call("make", shell=True) != 0: 51 raise Exception("Make failed.") 52 output = subprocess.check_output("./PMCTest") 53 output = output.splitlines() 54 return output[6].split() 24 55 25 56 if __name__ == '__main__': 26 genFile() 57 parser = argparse.ArgumentParser() 58 parser.add_argument("-i", "--instrcount", action="store_true", 59 help="Calc same operation with increasing instr count.") 60 parser.add_argument("-f", "--iterfunc", action="store_true", 61 help="Calc with different function") 62 parser.add_argument("-m", "--master-iterfunc", action="store_true", 63 help="Calc with different function, with LLVM 3.5") 64 parser.add_argument("-c", "--count", type=int, 65 help="Give instruction count") 66 parser.add_argument("-e", "--func", 67 help="Specify one function to generate") 68 parser.add_argument("-w", "--fw", type=int, 69 help="Field width used with --func and --iterfunc") 70 parser.add_argument("-a", "--idisa", action="store_true", 71 help="Call IDISA function (default)") 72 parser.add_argument("-b", "--ir", action="store_true", 73 help="Call IR function") 74 parser.add_argument("-n", "--noloop", action="store_true", 75 help="Do not use loop in perf program") 76 parser.add_argument("-s", "--simple", action="store_true", 77 help="Simple run with add_1 for testing") 78 parser.add_argument("-o", "--output", 79 help="Output perf file") 80 args = parser.parse_args() 27 81 82 params = dict(DeclaredIRFunc = "add_1", 83 DataSize = 2000, 84 UserDataInit = "simd<32>::constant<0>()", 85 TestInstrCount = 1000, 86 TestInstr = "add_1(UserData[thread][i], one_constant)", 87 NoLoop = False 88 ) 89 if args.ir and args.idisa: 90 raise Exception("Cannot select both IR and IDISA") 91 if args.noloop: 92 params["NoLoop"] = True 93 if args.count: 94 params["TestInstrCount"] = args.count 95 if args.master_iterfunc and args.idisa: 96 raise Exception("Cannot select IDISA with --master-iterfunc") 97 98 perf_output = "perf_chat.csv" 99 if args.output: 100 perf_output = args.output 101 102 EXEC = CXX 103 if args.ir: 104 EXEC = C 105 106 if args.simple: 107 params["TestInstrCount"] = args.count 108 genFile(params) 109 print header 110 print run() 111 sys.exit(0) 112 113 if args.func: 114 if args.fw: 115 FW = args.fw 116 117 name = args.func 118 params["DeclaredIRFunc"] = C(name) 119 params["TestInstr"] = EXEC(name) + "(UserData[thread][i], one_constant)" 120 genFile(params) 121 print run() 122 sys.exit(0) 123 124 if args.instrcount: 125 with open(perf_output, "w") as f: 126 f.write(header + "\n") 127 128 for count in xrange(100, 2000, 100): 129 params["TestInstrCount"] = count 130 131 genFile(params) 132 133 with open(perf_output, "a") as f: 134 f.write(str(count) + "," + ",".join(run()) + "\n") 135 sys.exit(0) 136 137 if args.iterfunc: 138 with open(perf_output, "w") as f: 139 f.write(header + "\n") 140 if args.fw: 141 FW = args.fw 142 for name in FunctionListI1: 143 params["DeclaredIRFunc"] = C(name) 144 params["TestInstr"] = EXEC(name) + "(UserData[thread][i], one_constant)" 145 146 genFile(params) 147 with open(perf_output, "a") as f: 148 f.write(name + "," + ",".join(run()) + "\n") 149 sys.exit(0) 150 151 if args.master_iterfunc: 152 with open(perf_output, "w") as f: 153 f.write(header + "\n") 154 if args.fw: 155 FW = args.fw 156 for name in FunctionListI1: 157 params["DeclaredIRFunc"] = C(name) 158 params["TestInstr"] = C(name) + "(UserData[thread][i], one_constant)" 159 160 genFile(params) 161 try: 162 extract(C(name)) 163 with open(perf_output, "a") as f: 164 f.write(name + "," + ",".join(run(single=True)) + "\n") 165 except Exception as e: 166 with open(perf_output, "a") as f: 167 f.write(name + ", " + str(e) + "\n") 168 sys.exit(0) 169 -
trunk/lib_ir/CMakeLists.txt
r4143 r4232 7 7 if (USE_AVX2) 8 8 message("---- Compiling for AVX2") 9 set(CXX_SSE_FLAGS "-msse2 -m64") #"-march=core-avx2") 10 set(LLVM_SSE_FLAGS "-mattr=+sse,+sse2") 11 #set(LLVM_SSE_FLAGS -mattr=+sse,+sse2,+avx2,+bmi2,+bmi -march=x86-64) 9 #set(CXX_SSE_FLAGS "-msse2 -m64") 10 set(CXX_SSE_FLAGS "-mavx2 -m64 -march=core-avx2") 11 #set(LLVM_SSE_FLAGS "-mattr=+sse,+sse2") 12 set(LLVM_SSE_FLAGS -mattr=+sse,+sse2,+avx2,+bmi2,+bmi -march=x86-64) 12 13 else (USE_AVX2) 13 14 set(CXX_SSE_FLAGS "-msse2") … … 35 36 # gen/ is used to test llc backend. 36 37 add_subdirectory(gen) 38 39 add_subdirectory(AgnerTestP/PMCTest) 37 40 38 41 # test packh_2,4,8 only on avx2 -
trunk/lib_ir/xmlwf/src/xmlwf.cpp
r3922 r4232 17 17 #include <sys/stat.h> 18 18 19 #include <simd-lib/s2p.h>20 19 #include <simd-lib/buffer.hpp> 21 20 #include <simd-lib/bitblock_iterator.hpp>
Note: See TracChangeset
for help on using the changeset viewer.