From 09310926dce32645556786edff790c6f8579b932 Mon Sep 17 00:00:00 2001 From: tgrogers Date: Fri, 5 Jun 2015 14:19:06 -0700 Subject: Adding in changes to put generated code files in the build directory instead of the source directory - since this causes issues for parallel buildwq --- cuobjdump_to_ptxplus/Makefile | 40 +++++++++++++++++++++++++--------------- libcuda/Makefile | 15 +++++++++------ src/intersim2/Makefile | 12 ++++++------ 3 files changed, 40 insertions(+), 27 deletions(-) diff --git a/cuobjdump_to_ptxplus/Makefile b/cuobjdump_to_ptxplus/Makefile index 0358970..242a066 100644 --- a/cuobjdump_to_ptxplus/Makefile +++ b/cuobjdump_to_ptxplus/Makefile @@ -27,41 +27,52 @@ $(OUTPUT_DIR)/cuobjdump_to_ptxplus: $(OUTPUT_DIR)/cuobjdumpInst.o $(OUTPUT_DIR)/ ${LD} ${LDFLAGS} -o $@ $(OUTPUT_DIR)/cuobjdumpInst.o $(OUTPUT_DIR)/cuobjdumpInstList.o $(OUTPUT_DIR)/cuobjdump_to_ptxplus.o $(PTX_PARSER_OBJECTS) $(SASS_PARSER_OBJECTS) $(ELF_PARSER_OBJECTS) $(HEADER_PARSER_OBJECTS) -lex.ptx_.c : ../src/cuda-sim/ptx.l - ${LEX} ${LEXFLAGS} ../src/cuda-sim/ptx.l +$(OUTPUT_DIR)/lex.ptx_.c : ../src/cuda-sim/ptx.l + ${LEX} ${LEXFLAGS} -o$(OUTPUT_DIR)/lex.ptx_.c ../src/cuda-sim/ptx.l -ptx.tab.c : ../src/cuda-sim/ptx.y - ${YACC} ${YFLAGS} --name-prefix=ptx_ -v ../src/cuda-sim/ptx.y +$(OUTPUT_DIR)/ptx.tab.c : ../src/cuda-sim/ptx.y + ${YACC} ${YFLAGS} --name-prefix=ptx_ -v ../src/cuda-sim/ptx.y --file-prefix=$(OUTPUT_DIR)/ptx -ptx.tab.h : ptx.tab.c +$(OUTPUT_DIR)/ptx.tab.h :$(OUTPUT_DIR)/ptx.tab.c -$(OUTPUT_DIR)/lex.ptx_.o : lex.ptx_.c ptx.tab.h - ${CXX} ${CXXFLAGS} -c lex.ptx_.c -o $@ +$(OUTPUT_DIR)/lex.ptx_.o : $(OUTPUT_DIR)/lex.ptx_.c $(OUTPUT_DIR)/ptx.tab.h + ${CXX} ${CXXFLAGS} -c $(OUTPUT_DIR)/lex.ptx_.c -o $@ -$(OUTPUT_DIR)/ptx.tab.o : ptx.tab.c ptx_parser.h - ${CXX} ${CXXFLAGS} -c ptx.tab.c -o $@ +$(OUTPUT_DIR)/ptx.tab.o : $(OUTPUT_DIR)/ptx.tab.c ptx_parser.h + ${CXX} ${CXXFLAGS} -c $(OUTPUT_DIR)/ptx.tab.c -o $@ - -%_lexer.cc: %.l %_parser.hh +$(OUTPUT_DIR)/%_lexer.cc: %.l $(OUTPUT_DIR)/%_parser.hh $(LEX) $(LEXFLAGS) -P $*_ -o$@ $< -%_parser.cc: %.y - $(YACC) $(YFLAGS) -p $*_ -o$@ $< +$(OUTPUT_DIR)/%_parser.cc: %.y + $(YACC) $(YFLAGS) -p $*_ -o$@ $< --file-prefix=$(OUTPUT_DIR)/$@ # The ':' is needed otherwise make gets confused and doesn't understand that it knows how to make %Parser.hpp from %Parser.cpp. # : in bash is equivalent to NOP (no operation) -%_parser.hh: %_parser.cc +$(OUTPUT_DIR)/%_parser.hh: $(OUTPUT_DIR)/%_parser.cc + : + +$(OUTPUT_DIR)/%_parser.hh: %_parser.cc : $(OUTPUT_DIR)/%.o: %.cc $(CXX) ${CXXFLAGS} -c -o $@ $< +$(OUTPUT_DIR)/%.o: $(OUTPUT_DIR)/%.cc + $(CXX) ${CXXFLAGS} -c -o $@ $< + $(OUTPUT_DIR)/%.o: %.cpp %.h $(CXX) ${CXXFLAGS} -c -o $@ $< +$(OUTPUT_DIR)/%.o: $(OUTPUT_DIR)/%.cpp $(OUTPUT_DIR)/%.h + $(CXX) ${CXXFLAGS} -c -o $@ $< + $(OUTPUT_DIR)/%.o: %.c %.h ${CXX} ${CCFLAGS} -c -o $@ $< +$(OUTPUT_DIR)/%.o: $(OUTPUT_DIR)/%.c $(OUTPUT_DIR)/%.h + ${CXX} ${CCFLAGS} -c -o $@ $< + SRCS = $(shell ls *.cc) $(OUTPUT_DIR)/Makefile.makedepend: depend @@ -79,4 +90,3 @@ clean: rm -f $(OUTPUT_DIR)/Makefile.makedepend $(OUTPUT_DIR)/Makefile.makedepend.bak include $(OUTPUT_DIR)/Makefile.makedepend - diff --git a/libcuda/Makefile b/libcuda/Makefile index b1a6552..13932e2 100644 --- a/libcuda/Makefile +++ b/libcuda/Makefile @@ -108,20 +108,23 @@ lib$(PROG).a: $(OBJS) ar rcs $(OUTPUT_DIR)/lib$(PROG).a $(OBJS) $(OUTPUT_DIR)/%.o: %.cc - $(CPP) $(CXXFLAGS) -I./ -I$(CUDA_INSTALL_PATH)/include -c $< -o $@ + $(CPP) $(CXXFLAGS) -I./ -I$(OUTPUT_DIR) -I$(CUDA_INSTALL_PATH)/include -c $< -o $@ $(OUTPUT_DIR)/%.o: %.c - $(CC) $(CCFLAGS) -I./ -I$(CUDA_INSTALL_PATH)/include -c $< -o $@ + $(CC) $(CCFLAGS) -I./ -I$(OUTPUT_DIR) -I$(CUDA_INSTALL_PATH)/include -c $< -o $@ -cuobjdump_parser.c: cuobjdump.y - $(YACC) $(YFLAGS) -p cuobjdump_ -o$@ $< +$(OUTPUT_DIR)/%.o: $(OUTPUT_DIR)/%.c + $(CC) $(CCFLAGS) -I./ -I$(OUTPUT_DIR) -I$(CUDA_INSTALL_PATH)/include -c $< -o $@ -cuobjdump_lexer.c: cuobjdump.l cuobjdump_parser.h +$(OUTPUT_DIR)/cuobjdump_parser.c: cuobjdump.y + $(YACC) $(YFLAGS) -p cuobjdump_ -o$@ $< --file-prefix=$(OUTPUT_DIR)/cuobjdump + +$(OUTPUT_DIR)/cuobjdump_lexer.c: cuobjdump.l $(OUTPUT_DIR)/cuobjdump_parser.h $(LEX) $(LEXFLAGS) -P cuobjdump_ -o$@ $< # The next rule means just get parser.c and you will get parser.h with it # in other words, get parser.c and do nothing to get parser.h -%_parser.h: %_parser.c +$(OUTPUT_DIR)/%_parser.h: $(OUTPUT_DIR)/%_parser.c : $(OUTPUT_DIR)/Makefile.makedepend: depend diff --git a/src/intersim2/Makefile b/src/intersim2/Makefile index fd9fba8..ef948d6 100644 --- a/src/intersim2/Makefile +++ b/src/intersim2/Makefile @@ -126,10 +126,10 @@ endif # rules to compile simulator -${LEX_OBJS}: lex.yy.c y.tab.h +${LEX_OBJS}: $(OBJDIR)/lex.yy.c $(OBJDIR)/y.tab.h $(CC) $(CPPFLAGS) -c $< -o $@ -${YACC_OBJS}: y.tab.c y.tab.h +${YACC_OBJS}: $(OBJDIR)/y.tab.c $(OBJDIR)/y.tab.h $(CC) $(CPPFLAGS) -c $< -o $@ ${OBJDIR}/%.o: %.cpp @@ -168,8 +168,8 @@ clean: rm -f y.tab.c y.tab.h lex.yy.c rm -f moc_bgui.cpp -y.tab.c y.tab.h: config.y - $(YACC) -d $< +$(OBJDIR)/y.tab.c $(OBJDIR)/y.tab.h: config.y + $(YACC) -d $< --file-prefix=$(OBJDIR)/y -lex.yy.c: config.l - $(LEX) $< +$(OBJDIR)/lex.yy.c: config.l + $(LEX) -o$@ $< -- cgit v1.3 From cdcb9dde7313f2b90914361df752b9dfd7aa0ed8 Mon Sep 17 00:00:00 2001 From: tgrogers Date: Fri, 5 Jun 2015 14:22:32 -0700 Subject: Adding a description of the makefile changes --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 216490e..512993b 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ Version 3.2.3+edits (development branch) versus 3.2.3 - Added support for bar.arrive and bar.red instructions. - Initial support for CUDA 5.0,5.5 and 6.0 to get template running. - Removed intersim2 svn repository files +- Changed the makefile for cuobjdump_toptxplus,libcuda,intersim2 so that it outputs temporary files into the build directory - Bug fixes: - Fixed bug #81, fix ordering of pushing branch entries to the stack -- cgit v1.3 From b2fc784cbb1c2e65736cea88d61509d08fddd83f Mon Sep 17 00:00:00 2001 From: ElTantawy Date: Thu, 12 May 2016 13:36:03 -0700 Subject: initial support for cuda 7.5 parsing --- libcuda/cuobjdump.l | 60 +++++++++++++++++++++++++++++++++++++++-------------- libcuda/cuobjdump.y | 30 +++++++++++++++++++++------ 2 files changed, 69 insertions(+), 21 deletions(-) diff --git a/libcuda/cuobjdump.l b/libcuda/cuobjdump.l index d7086ad..c86a861 100644 --- a/libcuda/cuobjdump.l +++ b/libcuda/cuobjdump.l @@ -52,8 +52,11 @@ void cuobjdump_error(const char*); %s ptxcode %s sasscode %s elfcode -%s header +%s elfheader +%s ptxheader %s endheader +%s identifier +%s identifierF alpha [a-zA-Z] numeric [0-9] @@ -67,16 +70,20 @@ newlines {newline}+ "ptxasOptions"{notnewline}*{newline} [1-9]{numeric}* yylval.string_value = strdup(yytext); return DECIMAL; +"has debug info"{newline} + "Fatbin ptx code:"{newline} { yy_push_state(ptxcode); - yy_push_state(header); + yy_push_state(identifier); + yy_push_state(ptxheader); yylval.string_value = strdup(yytext); return PTXHEADER; } "Fatbin elf code:"{newline} { yy_push_state(elfcode); - yy_push_state(header); + yy_push_state(identifier); + yy_push_state(elfheader); yylval.string_value = strdup(yytext); return ELFHEADER; } @@ -94,22 +101,45 @@ newlines {newline}+ /*SASS code tokens*/ {notnewline}*{newline} yylval.string_value = strdup(yytext); return SASSLINE; +"identifier = " BEGIN(identifierF); return H_IDENTIFIER; +"\n" yy_pop_state(); + +{notnewline}+ yylval.string_value = strdup(yytext); yy_pop_state(); return FILENAME; + + + + /*Header tokens*/ +[[:alnum:]_]+ yylval.string_value = strdup(yytext); return IDENTIFIER; +"================" return H_SEPARATOR; +"arch = " return H_ARCH; +"code version = " return H_CODEVERSION; +\[{numeric},{numeric}\] return CODEVERSION; +"producer = " return H_PRODUCER; +"" return H_UNKNOWN; +"host = " return H_HOST; +"compile_size = " BEGIN(endheader); return H_COMPILESIZE; + + /*Header tokens*/ -
[[:alnum:]_]+ yylval.string_value = strdup(yytext); return IDENTIFIER; -
"================" return H_SEPARATOR; -
"arch = " return H_ARCH; -
"code version = " return H_CODEVERSION; -
\[{numeric},{numeric}\] return CODEVERSION; -
"producer = " return H_PRODUCER; -
"host = " return H_HOST; -
"compile_size = " return H_COMPILESIZE; -
"compressed"{newline} -
"identifier = " BEGIN(endheader); return H_IDENTIFIER; -
"has debug info"{newline} +[[:alnum:]_]+ yylval.string_value = strdup(yytext); return IDENTIFIER; +"================" return H_SEPARATOR; +"arch = " return H_ARCH; +"code version = " return H_CODEVERSION; +\[{numeric},{numeric}\] return CODEVERSION; +"producer = " return H_PRODUCER; +"host = " return H_HOST; +"compile_size = " return H_COMPILESIZE; +"compressed"{newline} yy_pop_state(); return H_COMPRESSED; + + + + + /* Looking for the identifier (filename) then the header is done */ /* [[:alnum:]_\./]+ yylval.string_value = strdup(yytext); yy_pop_state(); return FILENAME; */ -{notnewline}+ yylval.string_value = strdup(yytext); yy_pop_state(); return FILENAME; +{notnewline}+ yylval.string_value = strdup(yytext); yy_pop_state(); return IDENTIFIER; + {newline} return NEWLINE; diff --git a/libcuda/cuobjdump.y b/libcuda/cuobjdump.y index ec97283..f86d445 100644 --- a/libcuda/cuobjdump.y +++ b/libcuda/cuobjdump.y @@ -39,6 +39,7 @@ void setCuobjdumpelffilename(const char* filename); void setCuobjdumpsassfilename(const char* filename); int elfserial = 1; int ptxserial = 1; +int yydebug=1; FILE *ptxfile; FILE *elffile; FILE *sassfile; @@ -47,7 +48,7 @@ char filename [1024]; %union { char* string_value; } -%token H_SEPARATOR H_ARCH H_CODEVERSION H_PRODUCER H_HOST H_COMPILESIZE H_IDENTIFIER +%token H_SEPARATOR H_ARCH H_CODEVERSION H_PRODUCER H_HOST H_COMPILESIZE H_IDENTIFIER H_UNKNOWN H_COMPRESSED %token CODEVERSION %token STRING %token FILENAME @@ -61,6 +62,7 @@ char filename [1024]; %% + program : {printf("######### cuobjdump parser ########\n");} emptylines section | program section; @@ -73,7 +75,7 @@ section : PTXHEADER { snprintf(filename, 1024, "_cuobjdump_%d.ptx", ptxserial++); ptxfile = fopen(filename, "w"); setCuobjdumpptxfilename(filename); - } headerinfo ptxcode { + } headerinfo identifier ptxcode { fclose(ptxfile); } | ELFHEADER { @@ -81,7 +83,8 @@ section : PTXHEADER { snprintf(filename, 1024, "_cuobjdump_%d.elf", elfserial); elffile = fopen(filename, "w"); setCuobjdumpelffilename(filename); - } headerinfo elfcode { + } headerinfo identifier{ + } elfcode { fclose(elffile); snprintf(filename, 1024, "_cuobjdump_%d.sass", elfserial++); sassfile = fopen(filename, "w"); @@ -91,17 +94,32 @@ section : PTXHEADER { }; headerinfo : H_SEPARATOR NEWLINE + H_ARCH IDENTIFIER NEWLINE + H_CODEVERSION CODEVERSION NEWLINE + H_PRODUCER H_UNKNOWN NEWLINE + H_HOST IDENTIFIER NEWLINE + H_COMPILESIZE IDENTIFIER emptylines {setCuobjdumparch($4);}; + | H_SEPARATOR NEWLINE H_ARCH IDENTIFIER NEWLINE H_CODEVERSION CODEVERSION NEWLINE H_PRODUCER IDENTIFIER NEWLINE H_HOST IDENTIFIER NEWLINE - H_COMPILESIZE IDENTIFIER NEWLINE - H_IDENTIFIER FILENAME emptylines {setCuobjdumparch($4); setCuobjdumpidentifier($19);}; + H_COMPILESIZE IDENTIFIER emptylines {setCuobjdumparch($4);}; + | H_SEPARATOR NEWLINE + H_ARCH IDENTIFIER NEWLINE + H_CODEVERSION CODEVERSION NEWLINE + H_PRODUCER IDENTIFIER NEWLINE + H_HOST IDENTIFIER NEWLINE + H_COMPILESIZE IDENTIFIER NEWLINE + H_COMPRESSED emptylines {setCuobjdumparch($4);}; + +identifier : H_IDENTIFIER FILENAME {setCuobjdumpidentifier($2);}; + | ; ptxcode : ptxcode PTXLINE {fprintf(ptxfile, "%s", $2);} | ; -elfcode : elfcode ELFLINE {fprintf(elffile, "%s", $2);} +elfcode : elfcode ELFLINE {printf(elffile, "%s", $2);} | ; sasscode : sasscode SASSLINE {fprintf(sassfile, "%s", $2);} -- cgit v1.3 From c0ed7da45b3836cefc08c6072fd183d2b33bbdeb Mon Sep 17 00:00:00 2001 From: Ahmed ElTantawy Date: Thu, 12 May 2016 14:25:14 -0700 Subject: updating Makefile and setup environment for 7.5 support --- Makefile | 2 +- setup_environment | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 080ca2d..9e2c576 100644 --- a/Makefile +++ b/Makefile @@ -155,7 +155,7 @@ $(SIM_LIB_DIR)/libcudart.so: makedirs $(LIBS) cudalib if [ ! -f $(SIM_LIB_DIR)/libcudart.so.5.0 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.5.0; fi if [ ! -f $(SIM_LIB_DIR)/libcudart.so.5.5 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.5.5; fi if [ ! -f $(SIM_LIB_DIR)/libcudart.so.6.0 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.6.0; fi - + if [ ! -f $(SIM_LIB_DIR)/libcudart.so.7.5 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.7.5; fi $(SIM_LIB_DIR)/libcudart.dylib: makedirs $(LIBS) cudalib g++ -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.1,-current_version,1.1\ $(SIM_OBJ_FILES_DIR)/libcuda/*.o \ diff --git a/setup_environment b/setup_environment index c55d71f..2684514 100644 --- a/setup_environment +++ b/setup_environment @@ -43,7 +43,7 @@ CC_VERSION=`gcc --version | head -1 | awk '{for(i=1;i<=NF;i++){ if(match($i,/^[0 CUDA_VERSION_STRING=`$CUDA_INSTALL_PATH/bin/nvcc --version | awk '/release/ {print $5;}' | sed 's/,//'`; CUDA_VERSION_NUMBER=`echo $CUDA_VERSION_STRING | sed 's/\./ /' | awk '{printf("%02u%02u", 10*int($1), 10*$2);}'` -if [ $CUDA_VERSION_NUMBER -gt 6000 -o $CUDA_VERSION_NUMBER -lt 2030 ]; then +if [ $CUDA_VERSION_NUMBER -gt 7500 -o $CUDA_VERSION_NUMBER -lt 2030 ]; then echo "ERROR ** GPGPU-Sim version $GPGPUSIM_VERSION_STRING not tested with CUDA version $CUDA_VERSION_STRING (please see README)"; return elif [ $CUDA_VERSION_NUMBER -gt 4020 ]; then -- cgit v1.3 From b27f110d3ca92f7af869b298105ae014581367e9 Mon Sep 17 00:00:00 2001 From: speverel Date: Thu, 12 May 2016 14:45:11 -0700 Subject: Commented out line that checks for identifier in PTX file so that sim runs in 7.5 --- libcuda/cuda_runtime_api.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc index eed4017..496d83c 100644 --- a/libcuda/cuda_runtime_api.cc +++ b/libcuda/cuda_runtime_api.cc @@ -1525,7 +1525,7 @@ cuobjdumpPTXSection* findPTXSectionInList(std::list sectionli ){ cuobjdumpPTXSection* ptxsection; if((ptxsection=dynamic_cast(*iter)) != NULL){ - if(ptxsection->getIdentifier() == identifier) + //if(ptxsection->getIdentifier() == identifier) return ptxsection; } } -- cgit v1.3 From 4bdf48ed2098e036da1503405c30b71f39be0e94 Mon Sep 17 00:00:00 2001 From: sspenst Date: Thu, 12 May 2016 16:54:39 -0700 Subject: added an assertion to pruneSectionList --- libcuda/cuda_runtime_api.cc | 2 ++ libcuda/cuobjdump.y | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc index 496d83c..7495767 100644 --- a/libcuda/cuda_runtime_api.cc +++ b/libcuda/cuda_runtime_api.cc @@ -1484,6 +1484,8 @@ std::list pruneSectionList(std::list cuobj delete *iter; } } + + assert(!prunedList.empty() && "WARNING: Change -gpgpu_ptx_force_max_capability in gpgpusim.config to match the largest Gencode argument in the Makefile"); return prunedList; } diff --git a/libcuda/cuobjdump.y b/libcuda/cuobjdump.y index f86d445..5fc0c8f 100644 --- a/libcuda/cuobjdump.y +++ b/libcuda/cuobjdump.y @@ -39,7 +39,7 @@ void setCuobjdumpelffilename(const char* filename); void setCuobjdumpsassfilename(const char* filename); int elfserial = 1; int ptxserial = 1; -int yydebug=1; + FILE *ptxfile; FILE *elffile; FILE *sassfile; -- cgit v1.3 From 0b95282e887e6cc6eb48d93d5aa51252588c3260 Mon Sep 17 00:00:00 2001 From: Ahmed ElTantawy Date: Fri, 13 May 2016 08:06:17 -0700 Subject: getting the parsing compatible with previous version - tested on 4.2, 5.5 and 7.5 --- libcuda/cuobjdump.l | 20 +++++++++++++------- libcuda/cuobjdump.y | 21 +++++++++------------ 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/libcuda/cuobjdump.l b/libcuda/cuobjdump.l index c86a861..f63ee73 100644 --- a/libcuda/cuobjdump.l +++ b/libcuda/cuobjdump.l @@ -55,8 +55,9 @@ void cuobjdump_error(const char*); %s elfheader %s ptxheader %s endheader -%s identifier -%s identifierF +%x identifier +%x conidentifier +%s endidentifier alpha [a-zA-Z] numeric [0-9] @@ -101,10 +102,16 @@ newlines {newline}+ /*SASS code tokens*/ {notnewline}*{newline} yylval.string_value = strdup(yytext); return SASSLINE; -"identifier = " BEGIN(identifierF); return H_IDENTIFIER; -"\n" yy_pop_state(); +{newline}"compressed"{newline} BEGIN(conidentifier); return H_COMPRESSED; +{newline}"identifier = " BEGIN(endidentifier); return H_IDENTIFIER; +{newline}{newline} yy_pop_state(); -{notnewline}+ yylval.string_value = strdup(yytext); yy_pop_state(); return FILENAME; + +"identifier = " BEGIN(endidentifier); return H_IDENTIFIER; +{newline} yy_pop_state(); + + +{notnewline}+ yylval.string_value = strdup(yytext); yy_pop_state(); return FILENAME; @@ -128,8 +135,7 @@ newlines {newline}+ \[{numeric},{numeric}\] return CODEVERSION; "producer = " return H_PRODUCER; "host = " return H_HOST; -"compile_size = " return H_COMPILESIZE; -"compressed"{newline} yy_pop_state(); return H_COMPRESSED; +"compile_size = " BEGIN(endheader); return H_COMPILESIZE; diff --git a/libcuda/cuobjdump.y b/libcuda/cuobjdump.y index 5fc0c8f..29509e8 100644 --- a/libcuda/cuobjdump.y +++ b/libcuda/cuobjdump.y @@ -39,7 +39,7 @@ void setCuobjdumpelffilename(const char* filename); void setCuobjdumpsassfilename(const char* filename); int elfserial = 1; int ptxserial = 1; - +int yydebug = 1; FILE *ptxfile; FILE *elffile; FILE *sassfile; @@ -75,7 +75,7 @@ section : PTXHEADER { snprintf(filename, 1024, "_cuobjdump_%d.ptx", ptxserial++); ptxfile = fopen(filename, "w"); setCuobjdumpptxfilename(filename); - } headerinfo identifier ptxcode { + } headerinfo compressedkeyword identifier ptxcode { fclose(ptxfile); } | ELFHEADER { @@ -84,6 +84,7 @@ section : PTXHEADER { elffile = fopen(filename, "w"); setCuobjdumpelffilename(filename); } headerinfo identifier{ + printf("\nHeader Info and Identifier Parsed\n"); } elfcode { fclose(elffile); snprintf(filename, 1024, "_cuobjdump_%d.sass", elfserial++); @@ -98,24 +99,20 @@ headerinfo : H_SEPARATOR NEWLINE H_CODEVERSION CODEVERSION NEWLINE H_PRODUCER H_UNKNOWN NEWLINE H_HOST IDENTIFIER NEWLINE - H_COMPILESIZE IDENTIFIER emptylines {setCuobjdumparch($4);}; + H_COMPILESIZE IDENTIFIER {setCuobjdumparch($4);}; | H_SEPARATOR NEWLINE H_ARCH IDENTIFIER NEWLINE H_CODEVERSION CODEVERSION NEWLINE H_PRODUCER IDENTIFIER NEWLINE H_HOST IDENTIFIER NEWLINE - H_COMPILESIZE IDENTIFIER emptylines {setCuobjdumparch($4);}; - | H_SEPARATOR NEWLINE - H_ARCH IDENTIFIER NEWLINE - H_CODEVERSION CODEVERSION NEWLINE - H_PRODUCER IDENTIFIER NEWLINE - H_HOST IDENTIFIER NEWLINE - H_COMPILESIZE IDENTIFIER NEWLINE - H_COMPRESSED emptylines {setCuobjdumparch($4);}; + H_COMPILESIZE IDENTIFIER {setCuobjdumparch($4);}; -identifier : H_IDENTIFIER FILENAME {setCuobjdumpidentifier($2);}; +identifier : H_IDENTIFIER FILENAME emptylines {setCuobjdumpidentifier($2);}; | ; +compressedkeyword : H_COMPRESSED emptylines + | ; + ptxcode : ptxcode PTXLINE {fprintf(ptxfile, "%s", $2);} | ; -- cgit v1.3 From 7ac360c0a2defc5612fec6a106c703145e642aaa Mon Sep 17 00:00:00 2001 From: Ahmed ElTantawy Date: Fri, 13 May 2016 09:38:58 -0700 Subject: detailed error message when minimum found ptx capability is still larger than the maximum forced capability --- libcuda/cuda_runtime_api.cc | 22 ++++++++++++++-------- libcuda/cuobjdump.y | 6 ++---- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc index 7495767..f2e3359 100644 --- a/libcuda/cuda_runtime_api.cc +++ b/libcuda/cuda_runtime_api.cc @@ -1457,18 +1457,22 @@ std::list pruneSectionList(std::list cuobj std::list prunedList; - //Find the highest capability (that is lower than the forces maximum) for each cubin file + //Find the highest capability (that is lower than the forced maximum) for each cubin file //and set it in cuobjdumpSectionMap. Do this only for ptx sections std::map cuobjdumpSectionMap; + int min_ptx_capability_found=0; for ( std::list::iterator iter = cuobjdumpSectionList.begin(); iter != cuobjdumpSectionList.end(); iter++){ unsigned capability = (*iter)->getArch(); - if(dynamic_cast(*iter) != NULL && - (capability <= forced_max_capability || - forced_max_capability==0)) { - if(cuobjdumpSectionMap[(*iter)->getIdentifier()] < capability) - cuobjdumpSectionMap[(*iter)->getIdentifier()] = capability; + if(dynamic_cast(*iter) != NULL){ + if(capabilitygetIdentifier()] < capability) || + (cuobjdumpSectionMap.find((*iter)->getIdentifier())==cuobjdumpSectionMap.end())) + cuobjdumpSectionMap[(*iter)->getIdentifier()] = capability; + } } } @@ -1484,8 +1488,10 @@ std::list pruneSectionList(std::list cuobj delete *iter; } } - - assert(!prunedList.empty() && "WARNING: Change -gpgpu_ptx_force_max_capability in gpgpusim.config to match the largest Gencode argument in the Makefile"); + if(prunedList.empty()){ + printf("Error: No PTX sections found with sm capability that is lower than current forced maximum capability \n minimum ptx capability found = %u, maximum forced ptx capability = %u \n User might want to change either the forced maximum capability from gpgpusim configuration or update the compilation to generate the required PTX version",min_ptx_capability_found,forced_max_capability); + abort(); + } return prunedList; } diff --git a/libcuda/cuobjdump.y b/libcuda/cuobjdump.y index 29509e8..dce7e3d 100644 --- a/libcuda/cuobjdump.y +++ b/libcuda/cuobjdump.y @@ -39,7 +39,6 @@ void setCuobjdumpelffilename(const char* filename); void setCuobjdumpsassfilename(const char* filename); int elfserial = 1; int ptxserial = 1; -int yydebug = 1; FILE *ptxfile; FILE *elffile; FILE *sassfile; @@ -84,7 +83,6 @@ section : PTXHEADER { elffile = fopen(filename, "w"); setCuobjdumpelffilename(filename); } headerinfo identifier{ - printf("\nHeader Info and Identifier Parsed\n"); } elfcode { fclose(elffile); snprintf(filename, 1024, "_cuobjdump_%d.sass", elfserial++); @@ -107,8 +105,8 @@ headerinfo : H_SEPARATOR NEWLINE H_HOST IDENTIFIER NEWLINE H_COMPILESIZE IDENTIFIER {setCuobjdumparch($4);}; -identifier : H_IDENTIFIER FILENAME emptylines {setCuobjdumpidentifier($2);}; - | ; +identifier : H_IDENTIFIER FILENAME emptylines {setCuobjdumpidentifier($2);} + | {setCuobjdumpidentifier("default");}; compressedkeyword : H_COMPRESSED emptylines | ; -- cgit v1.3 From 1f25b1cc7a71898eda0216ec0a74cb55266cd4f0 Mon Sep 17 00:00:00 2001 From: Ahmed ElTantawy Date: Fri, 13 May 2016 09:47:22 -0700 Subject: remove the hackish comment and assign a default identifier for CUDA>=7.5 --- libcuda/cuda_runtime_api.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc index f2e3359..fc6ca03 100644 --- a/libcuda/cuda_runtime_api.cc +++ b/libcuda/cuda_runtime_api.cc @@ -1533,7 +1533,7 @@ cuobjdumpPTXSection* findPTXSectionInList(std::list sectionli ){ cuobjdumpPTXSection* ptxsection; if((ptxsection=dynamic_cast(*iter)) != NULL){ - //if(ptxsection->getIdentifier() == identifier) + if(ptxsection->getIdentifier() == identifier) return ptxsection; } } @@ -1632,10 +1632,13 @@ void** CUDARTAPI __cudaRegisterFatBinary( void *fatCubin ) // - Obtains the pointer to the actual fatbin structure from the FatBin handle (fatCubin). // - An integer inside the fatbin structure contains the relative offset to the source code file name. // - This offset differs among different CUDA and GCC versions. + #if (CUDART_VERSION <= 6000) char * pfatbin = (char*) fatDeviceText->d; int offset = *((int*)(pfatbin+48)); char * filename = (pfatbin+16+offset); - + #else + char * filename = "default"; + #endif // The extracted file name is associated with a fat_cubin_handle passed // into cudaLaunch(). Inside cudaLaunch(), the associated file name is // used to find the PTX/SASS section from cuobjdump, which contains the -- cgit v1.3 From 2cbd1535c4babf19d3fa5a32f05633493d295146 Mon Sep 17 00:00:00 2001 From: sspenst Date: Fri, 13 May 2016 11:51:08 -0700 Subject: changed the SM version flag for generating ptxinfo to be dynamic instead of 20 --- libcuda/cuda_runtime_api.cc | 22 ++++++++++++++++------ src/cuda-sim/ptx_loader.cc | 5 +++-- src/cuda-sim/ptx_loader.h | 2 +- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc index fc6ca03..910bebd 100644 --- a/libcuda/cuda_runtime_api.cc +++ b/libcuda/cuda_runtime_api.cc @@ -1469,8 +1469,8 @@ std::list pruneSectionList(std::list cuobj if(capabilitygetIdentifier()] < capability) || - (cuobjdumpSectionMap.find((*iter)->getIdentifier())==cuobjdumpSectionMap.end())) + if((cuobjdumpSectionMap.find((*iter)->getIdentifier())==cuobjdumpSectionMap.end()) + || (cuobjdumpSectionMap[(*iter)->getIdentifier()] < capability)) cuobjdumpSectionMap[(*iter)->getIdentifier()] = capability; } } @@ -1489,7 +1489,7 @@ std::list pruneSectionList(std::list cuobj } } if(prunedList.empty()){ - printf("Error: No PTX sections found with sm capability that is lower than current forced maximum capability \n minimum ptx capability found = %u, maximum forced ptx capability = %u \n User might want to change either the forced maximum capability from gpgpusim configuration or update the compilation to generate the required PTX version",min_ptx_capability_found,forced_max_capability); + printf("Error: No PTX sections found with sm capability that is lower than current forced maximum capability \n minimum ptx capability found = %u, maximum forced ptx capability = %u \n User might want to change either the forced maximum capability from gpgpusim configuration or update the compilation to generate the required PTX version\n",min_ptx_capability_found,forced_max_capability); abort(); } return prunedList; @@ -1575,6 +1575,16 @@ void cuobjdumpParseBinary(unsigned int handle){ fatbin_registered[handle] = true; CUctx_st *context = GPGPUSim_Context(); + unsigned max_capability = 0; + for ( std::list::iterator iter = cuobjdumpSectionList.begin(); + iter != cuobjdumpSectionList.end(); + iter++){ + unsigned capability = (*iter)->getArch(); + if (capability > max_capability) max_capability = capability; + } + + if (max_capability > 20) printf("WARNING: No guarantee that PTX will be parsed for SM version %u\n", max_capability); + std::string fname = fatbinmap[handle]; cuobjdumpPTXSection* ptx = findPTXSection(fname); @@ -1597,13 +1607,13 @@ void cuobjdumpParseBinary(unsigned int handle){ symtab=gpgpu_ptx_sim_load_ptx_from_string(ptxplus_str, handle); printf("Adding %s with cubin handle %u\n", ptx->getPTXfilename().c_str(), handle); context->add_binary(symtab, handle); - gpgpu_ptxinfo_load_from_string( ptxcode, handle); + gpgpu_ptxinfo_load_from_string( ptxcode, handle, max_capability ); delete[] ptxplus_str; } else { symtab=gpgpu_ptx_sim_load_ptx_from_string(ptxcode, handle); printf("Adding %s with cubin handle %u\n", ptx->getPTXfilename().c_str(), handle); context->add_binary(symtab, handle); - gpgpu_ptxinfo_load_from_string( ptxcode, handle); + gpgpu_ptxinfo_load_from_string( ptxcode, handle, max_capability ); } load_static_globals(symtab,STATIC_ALLOC_LIMIT,0xFFFFFFFF,context->get_device()->get_gpgpu()); load_constants(symtab,STATIC_ALLOC_LIMIT,context->get_device()->get_gpgpu()); @@ -1704,7 +1714,7 @@ void** CUDARTAPI __cudaRegisterFatBinary( void *fatCubin ) } else { symtab=gpgpu_ptx_sim_load_ptx_from_string(ptx,source_num); context->add_binary(symtab,fat_cubin_handle); - gpgpu_ptxinfo_load_from_string( ptx, source_num ); + gpgpu_ptxinfo_load_from_string( ptx, source_num, max_capability ); } source_num++; load_static_globals(symtab,STATIC_ALLOC_LIMIT,0xFFFFFFFF,context->get_device()->get_gpgpu()); diff --git a/src/cuda-sim/ptx_loader.cc b/src/cuda-sim/ptx_loader.cc index e293065..5a17ec3 100644 --- a/src/cuda-sim/ptx_loader.cc +++ b/src/cuda-sim/ptx_loader.cc @@ -182,7 +182,7 @@ symbol_table *gpgpu_ptx_sim_load_ptx_from_string( const char *p, unsigned source return symtab; } -void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num ) +void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num, unsigned sm_version=20 ) { char fname[1024]; snprintf(fname,1024,"_ptx_XXXXXX"); @@ -216,7 +216,8 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num extra_flags[0]=0; #if CUDART_VERSION >= 3000 - snprintf(extra_flags,1024,"--gpu-name=sm_20"); + if (sm_version == 0) sm_version = 20; + snprintf(extra_flags,1024,"--gpu-name=sm_%u",sm_version); #endif snprintf(commandline,1024,"$CUDA_INSTALL_PATH/bin/ptxas %s -v %s --output-file /dev/null 2> %s", diff --git a/src/cuda-sim/ptx_loader.h b/src/cuda-sim/ptx_loader.h index cb02eda..e10db1c 100644 --- a/src/cuda-sim/ptx_loader.h +++ b/src/cuda-sim/ptx_loader.h @@ -32,7 +32,7 @@ extern bool g_override_embedded_ptx; class symbol_table *gpgpu_ptx_sim_load_ptx_from_string( const char *p, unsigned source_num ); -void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num ); +void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num, unsigned sm_version ); char* gpgpu_ptx_sim_convert_ptx_and_sass_to_ptxplus(const std::string ptx_str, const std::string sass_str, const std::string elf_str); bool keep_intermediate_files(); -- cgit v1.3 From eafd8c0f7d4235b922e4ca8c8bb92ea5628d8011 Mon Sep 17 00:00:00 2001 From: sspenst Date: Fri, 13 May 2016 15:21:27 -0700 Subject: changed gpgpu_ptxinfo_load_from_string definition for Ahmed --- src/cuda-sim/ptx_loader.cc | 2 +- src/cuda-sim/ptx_loader.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cuda-sim/ptx_loader.cc b/src/cuda-sim/ptx_loader.cc index 5a17ec3..f7bf70e 100644 --- a/src/cuda-sim/ptx_loader.cc +++ b/src/cuda-sim/ptx_loader.cc @@ -182,7 +182,7 @@ symbol_table *gpgpu_ptx_sim_load_ptx_from_string( const char *p, unsigned source return symtab; } -void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num, unsigned sm_version=20 ) +void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num, unsigned sm_version ) { char fname[1024]; snprintf(fname,1024,"_ptx_XXXXXX"); diff --git a/src/cuda-sim/ptx_loader.h b/src/cuda-sim/ptx_loader.h index e10db1c..d3d0c92 100644 --- a/src/cuda-sim/ptx_loader.h +++ b/src/cuda-sim/ptx_loader.h @@ -32,7 +32,7 @@ extern bool g_override_embedded_ptx; class symbol_table *gpgpu_ptx_sim_load_ptx_from_string( const char *p, unsigned source_num ); -void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num, unsigned sm_version ); +void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num, unsigned sm_version=20 ); char* gpgpu_ptx_sim_convert_ptx_and_sass_to_ptxplus(const std::string ptx_str, const std::string sass_str, const std::string elf_str); bool keep_intermediate_files(); -- cgit v1.3 From 7dae3f76faa2742587a07ca01d87a55fab5598bb Mon Sep 17 00:00:00 2001 From: Ahmed ElTantawy Date: Sun, 15 May 2016 08:08:54 -0700 Subject: updating CHANGES --- CHANGES | 7 +++++-- libopencl/opencl_runtime_api.cc | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 512993b..ce80cfd 100644 --- a/CHANGES +++ b/CHANGES @@ -5,10 +5,13 @@ Version 3.2.3+edits (development branch) versus 3.2.3 the two default cache sizes, 16KB/48KB with 32/64 sets. - Added support for named barriers. - Added support for bar.arrive and bar.red instructions. -- Initial support for CUDA 5.0,5.5 and 6.0 to get template running. +- Initial support for CUDA 5.0,5.5,6.0 and 7.5 to get basic sdk running (e.g., template, vectorAdd, ...) - Removed intersim2 svn repository files - Changed the makefile for cuobjdump_toptxplus,libcuda,intersim2 so that it outputs temporary files into the build directory - +- Bug fixes: + - Fixed a bug where sm_version was hard coded to sm_20. Now, it extracts the highest sm version that is lower than + the forced_max_capability configuration in GPGPUSim. + - Bug fixes: - Fixed bug #81, fix ordering of pushing branch entries to the stack - Fixed a bug where for each icache miss we also count a hit diff --git a/libopencl/opencl_runtime_api.cc b/libopencl/opencl_runtime_api.cc index 9da895d..020384f 100644 --- a/libopencl/opencl_runtime_api.cc +++ b/libopencl/opencl_runtime_api.cc @@ -268,7 +268,7 @@ cl_int _cl_kernel::bind_args( gpgpu_ptx_sim_arg_list_t &arg_list ) if( i->first != k ) return CL_INVALID_KERNEL_ARGS; arg_info arg = i->second; - gpgpu_ptx_sim_arg param( arg.m_arg_value, arg.m_arg_size, 0 ); + gpgpu_ptx_sim_arg param( arg.m_arg_value, arg.m_arg_size, 0); arg_list.push_front( param ); k++; } @@ -575,7 +575,7 @@ void _cl_program::Build(const char *options) } info.m_asm = tmp; info.m_symtab = gpgpu_ptx_sim_load_ptx_from_string( tmp, source_num ); - gpgpu_ptxinfo_load_from_string( tmp, source_num ); + gpgpu_ptxinfo_load_from_string( tmp, source_num); free(tmp); } printf("GPGPU-Sim OpenCL API: finished compiling OpenCL kernels.\n"); -- cgit v1.3 From 4ac4dafdb8b0a90168630ed53b1a2c3166e79a73 Mon Sep 17 00:00:00 2001 From: Ahmed ElTantawy Date: Sun, 15 May 2016 10:26:48 -0700 Subject: Crediting lonestartGPU in the CHANGES for their help in CUDA 5.5 support --- CHANGES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index ce80cfd..9e6d112 100644 --- a/CHANGES +++ b/CHANGES @@ -5,7 +5,7 @@ Version 3.2.3+edits (development branch) versus 3.2.3 the two default cache sizes, 16KB/48KB with 32/64 sets. - Added support for named barriers. - Added support for bar.arrive and bar.red instructions. -- Initial support for CUDA 5.0,5.5,6.0 and 7.5 to get basic sdk running (e.g., template, vectorAdd, ...) +- Initial support for CUDA 5.0,5.5,6.0 and 7.5 to get basic sdk running (e.g., template, vectorAdd, ...). The issues required for CUDA 5.5 support were identified by the loneStarGPU group at The University of Texas at Austin - Removed intersim2 svn repository files - Changed the makefile for cuobjdump_toptxplus,libcuda,intersim2 so that it outputs temporary files into the build directory - Bug fixes: -- cgit v1.3 From a625477b025d21332368a5c31a9b779c6bb0351f Mon Sep 17 00:00:00 2001 From: Ahmed ElTantawy Date: Sun, 15 May 2016 10:40:37 -0700 Subject: fixing the credits --- CHANGES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 9e6d112..effc345 100644 --- a/CHANGES +++ b/CHANGES @@ -5,7 +5,7 @@ Version 3.2.3+edits (development branch) versus 3.2.3 the two default cache sizes, 16KB/48KB with 32/64 sets. - Added support for named barriers. - Added support for bar.arrive and bar.red instructions. -- Initial support for CUDA 5.0,5.5,6.0 and 7.5 to get basic sdk running (e.g., template, vectorAdd, ...). The issues required for CUDA 5.5 support were identified by the loneStarGPU group at The University of Texas at Austin +- Initial support for CUDA 5.0,5.5,6.0 and 7.5 to get basic sdk running (e.g., template, vectorAdd, ...). The issues required for CUDA 5.5 support were identified by the loneStarGPU group at The University of Texas at Austin and Texas State University. - Removed intersim2 svn repository files - Changed the makefile for cuobjdump_toptxplus,libcuda,intersim2 so that it outputs temporary files into the build directory - Bug fixes: -- cgit v1.3