Skip to content

Commit

Permalink
Removing a slew of code still compiled with gcc and the need for a bu…
Browse files Browse the repository at this point in the history
…nch of external C linkage

[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 15912]
  • Loading branch information
tgrogers authored and andrewboktor committed Aug 14, 2014
1 parent cd7a97f commit 461575e
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 53 deletions.
6 changes: 5 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ Version 3.2.1+edits (development branch) versus 3.2.1
warning message display
- Removed a spamming print at kernel finish that dumped a warp issuing
histogram.
- Fixing OpenCL functional simulation. Now the functional simulation routine is called instead of mistakenly printing that the functional simulation is not implemented.
- Fixing OpenCL functional simulation. Now the functional simulation routine
is called instead of mistakenly printing that the functional simulation
is not implemented.
- Removed the use of gcc in compilation and the need for a bunch of unnecessary
'extern "c"' statements.
Version 3.2.1 versus 3.2.0
- Added kernel name and launch uids to performance statistics log.
- Added l2_cache_config class to extend baseline cache_config. Allows for
Expand Down
3 changes: 1 addition & 2 deletions cuobjdump_to_ptxplus/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ LEX = flex
LEXFLAGS = -B
YACC = bison
YFLAGS = -t -d --report=all --verbose
CC = gcc
CCFLAGS = -ggdb -fPIC -Wall -Wno-unused-function -Wno-sign-compare
CXX = g++
CXXFLAGS = ${CCFLAGS}
Expand Down Expand Up @@ -61,7 +60,7 @@ $(OUTPUT_DIR)/%.o: %.cpp %.h
$(CXX) ${CXXFLAGS} -c -o $@ $<

$(OUTPUT_DIR)/%.o: %.c %.h
${CC} ${CCFLAGS} -c -o $@ $<
${CXX} ${CCFLAGS} -c -o $@ $<

SRCS = $(shell ls *.cc)

Expand Down
6 changes: 3 additions & 3 deletions cuobjdump_to_ptxplus/cuobjdump_to_ptxplus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ cuobjdumpInstList *g_instList = new cuobjdumpInstList();
cuobjdumpInstList *g_headerList = new cuobjdumpInstList();

int sass_parse();
extern "C" FILE *sass_in;
extern FILE *sass_in;

int ptx_parse();
extern "C" FILE *ptx_in;
extern FILE *ptx_in;

int elf_parse();
extern "C" FILE *elf_in;
extern FILE *elf_in;

extern int g_error_detected;

Expand Down
18 changes: 9 additions & 9 deletions libcuda/cuda_runtime_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ static CUctx_st* GPGPUSim_Context()
return the_context;
}

extern "C" void ptxinfo_addinfo()
void ptxinfo_addinfo()
{
if( !strcmp("__cuda_dummy_entry__",get_ptxinfo_kname()) ) {
// this string produced by ptxas for empty ptx files (e.g., bandwidth test)
Expand Down Expand Up @@ -1249,8 +1249,8 @@ void setCuobjdumpsassfilename(const char* filename){
}
(dynamic_cast<cuobjdumpELFSection*>(cuobjdumpSectionList.front()))->setSASSfilename(filename);
}
extern "C" int cuobjdump_parse();
extern "C" FILE *cuobjdump_in;
extern int cuobjdump_parse();
extern FILE *cuobjdump_in;

//! Return the executable file of the process containing the PTX/SASS code
//!
Expand Down Expand Up @@ -2020,13 +2020,13 @@ int CUDARTAPI __cudaSynchronizeThreads(void**, void*)

////////

extern "C" int ptx_parse();
extern "C" int ptx__scan_string(const char*);
extern "C" FILE *ptx_in;
extern int ptx_parse();
extern int ptx__scan_string(const char*);
extern FILE *ptx_in;

extern "C" int ptxinfo_parse();
extern "C" int ptxinfo_debug;
extern "C" FILE *ptxinfo_in;
extern int ptxinfo_parse();
extern int ptxinfo_debug;
extern FILE *ptxinfo_in;

/// static functions

Expand Down
2 changes: 1 addition & 1 deletion libopencl/opencl_runtime_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ void register_ptx_function( const char *name, function_info *impl )
sg_info->m_kernels[name] = impl;
}

extern "C" void ptxinfo_addinfo()
void ptxinfo_addinfo()
{
ptxinfo_opencl_addinfo( sg_info->m_kernels );
}
Expand Down
17 changes: 5 additions & 12 deletions src/cuda-sim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ DEBUG?=0
TRACE?=0

CPP = g++ $(SNOW)
CC = gcc $(SNOW)
ifeq ($(INTEL),1)
CPP = icpc
CC = icc
Expand Down Expand Up @@ -80,16 +79,16 @@ libgpgpu_ptx_sim.a: $(OBJS)
ar rcs $(OUTPUT_DIR)/libgpgpu_ptx_sim.a $(OUTPUT_DIR)/ptx.tab.o $(OUTPUT_DIR)/lex.ptx_.o $(OUTPUT_DIR)/ptxinfo.tab.o $(OUTPUT_DIR)/lex.ptxinfo_.o $(OBJS)

$(OUTPUT_DIR)/ptx.tab.o: ptx.tab.c
$(CC) -c $(OPT) -DYYDEBUG ptx.tab.c -o $(OUTPUT_DIR)/ptx.tab.o
$(CPP) -c $(OPT) -DYYDEBUG ptx.tab.c -o $(OUTPUT_DIR)/ptx.tab.o

$(OUTPUT_DIR)/lex.ptx_.o: lex.ptx_.c
$(CC) -c $(OPT) lex.ptx_.c -o $(OUTPUT_DIR)/lex.ptx_.o
$(CPP) -c $(OPT) lex.ptx_.c -o $(OUTPUT_DIR)/lex.ptx_.o

$(OUTPUT_DIR)/ptxinfo.tab.o: ptxinfo.tab.c
$(CC) -c $(OPT) -DYYDEBUG ptxinfo.tab.c -o $(OUTPUT_DIR)/ptxinfo.tab.o
$(CPP) -c $(OPT) -DYYDEBUG ptxinfo.tab.c -o $(OUTPUT_DIR)/ptxinfo.tab.o

$(OUTPUT_DIR)/lex.ptxinfo_.o: lex.ptxinfo_.c
$(CC) -c $(OPT) lex.ptxinfo_.c -o $(OUTPUT_DIR)/lex.ptxinfo_.o
$(CPP) -c $(OPT) lex.ptxinfo_.c -o $(OUTPUT_DIR)/lex.ptxinfo_.o

ptx.tab.c: ptx.y
bison --name-prefix=ptx_ -v -d ptx.y
Expand All @@ -112,7 +111,7 @@ clean:
rm -f Makefile.makedepend Makefile.makedepend.bak

$(OUTPUT_DIR)/%.o: %.c
$(CC) -c $(OPT) $< -o $(OUTPUT_DIR)/$*.o
$(CPP) -c $(OPT) $< -o $(OUTPUT_DIR)/$*.o
$(OUTPUT_DIR)/%.o: %.cc
$(CPP) -c $(CXX_OPT) $< -o $(OUTPUT_DIR)/$*.o

Expand All @@ -123,13 +122,7 @@ instructions.h: instructions.cc
@echo "#include \"ptx_ir.h\"" >> $*.h
@echo "#ifndef instructions_h_included" >> $*.h
@echo "#define instructions_h_included" >> $*.h
@echo "#ifdef __cplusplus" >> $*.h
@echo "extern \"C\" {" >> $*.h
@echo "#endif" >> $*.h
@cat $< | grep "_impl(" | sed 's/{.*//' | sed 's/$$/;/' >> $*.h
@echo "#ifdef __cplusplus" >> $*.h
@echo "}" >> $*.h
@echo "#endif" >> $*.h
@echo "#endif" >> $*.h
@chmod -w $*.h
@echo "created instructions.h"
Expand Down
12 changes: 6 additions & 6 deletions src/cuda-sim/cuda-sim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ void gpgpu_ptx_sim_memcpy_symbol(const char *hostVar, const void *src, size_t co

int g_ptx_sim_mode; // if non-zero run functional simulation only (i.e., no notion of a clock cycle)

extern "C" int ptx_debug;
extern int ptx_debug;

bool g_cuda_launch_blocking = false;

Expand Down Expand Up @@ -1853,28 +1853,28 @@ struct gpgpu_ptx_sim_kernel_info get_ptxinfo_kinfo()
return g_ptxinfo_kinfo;
}

extern "C" void ptxinfo_function(const char *fname )
void ptxinfo_function(const char *fname )
{
clear_ptxinfo();
g_ptxinfo_kname = strdup(fname);
}

extern "C" void ptxinfo_regs( unsigned nregs )
void ptxinfo_regs( unsigned nregs )
{
g_ptxinfo_kinfo.regs=nregs;
}

extern "C" void ptxinfo_lmem( unsigned declared, unsigned system )
void ptxinfo_lmem( unsigned declared, unsigned system )
{
g_ptxinfo_kinfo.lmem=declared+system;
}

extern "C" void ptxinfo_smem( unsigned declared, unsigned system )
void ptxinfo_smem( unsigned declared, unsigned system )
{
g_ptxinfo_kinfo.smem=declared+system;
}

extern "C" void ptxinfo_cmem( unsigned nbytes, unsigned bank )
void ptxinfo_cmem( unsigned nbytes, unsigned bank )
{
g_ptxinfo_kinfo.cmem+=nbytes;
}
Expand Down
10 changes: 5 additions & 5 deletions src/cuda-sim/ptx_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ bool g_override_embedded_ptx = false;

/// extern prototypes

extern "C" int ptx_parse();
extern "C" int ptx__scan_string(const char*);
extern int ptx_parse();
extern int ptx__scan_string(const char*);

const char *g_ptxinfo_filename;
extern "C" int ptxinfo_parse();
extern "C" int ptxinfo_debug;
extern "C" FILE *ptxinfo_in;
extern int ptxinfo_parse();
extern int ptxinfo_debug;
extern FILE *ptxinfo_in;

static bool g_save_embedded_ptx;
bool g_keep_intermediate_files;
Expand Down
4 changes: 2 additions & 2 deletions src/cuda-sim/ptx_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "ptx.tab.h"
#include <stdarg.h>

extern "C" int ptx_error( const char *s );
extern int ptx_error( const char *s );
extern int ptx_lineno;

static const struct core_config *g_shader_core_config;
Expand Down Expand Up @@ -240,7 +240,7 @@ void parse_assert_impl( int test_value, const char *file, unsigned line, const c
parse_error_impl(file,line, msg);
}

extern "C" char linebuf[1024];
extern char linebuf[1024];


void set_return()
Expand Down
4 changes: 0 additions & 4 deletions src/cuda-sim/ptx_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ extern int g_error_detected;
#ifdef __cplusplus
class symbol_table* init_parser(const char*);
const class ptx_instruction *ptx_instruction_lookup( const char *filename, unsigned linenumber );
extern "C" {
#endif

const char *decode_token( int type );
Expand Down Expand Up @@ -94,9 +93,6 @@ void change_double_operand_type( int addr_type );
void change_operand_neg( );
void set_immediate_operand_type( );
void version_header(double a);
#ifdef __cplusplus
}
#endif

#define NON_ARRAY_IDENTIFIER 1
#define ARRAY_IDENTIFIER_NO_DIM 2
Expand Down
8 changes: 0 additions & 8 deletions src/option_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ enum option_dtype {
OPT_CSTR
};

#ifdef __cplusplus
extern "C" {
#endif

// create and destroy option parser
option_parser_t option_parser_create();
void option_parser_destroy(option_parser_t opp);
Expand Down Expand Up @@ -81,7 +77,3 @@ void option_parser_delimited_string(option_parser_t opp,
void option_parser_print(option_parser_t opp,
FILE *fout);

#ifdef __cplusplus
};
#endif

0 comments on commit 461575e

Please sign in to comment.