diff options
Diffstat (limited to 'debug/risc-v-gsp-rm-vm/gpgpu-sim/patches')
3 files changed, 135 insertions, 0 deletions
diff --git a/debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/.gitkeep b/debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/.gitkeep new file mode 100644 index 0000000..c93f122 --- /dev/null +++ b/debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/.gitkeep @@ -0,0 +1,2 @@ +# Overlay patches are applied by ../setup.sh in lexical filename order. +# Empty is valid in Phase 0; the CUDA 12 build/runtime port (WP0.1) lands here. diff --git a/debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/0001-cuda12-toolchain-and-soname.patch b/debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/0001-cuda12-toolchain-and-soname.patch new file mode 100644 index 0000000..af1fb31 --- /dev/null +++ b/debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/0001-cuda12-toolchain-and-soname.patch @@ -0,0 +1,56 @@ +diff --git a/Makefile b/Makefile +index d248211..1ab7c0c 100644 +--- a/Makefile ++++ b/Makefile +@@ -168,6 +168,8 @@ $(SIM_LIB_DIR)/libcudart.so: makedirs $(LIBS) cudalib + if [ ! -f $(SIM_LIB_DIR)/libcudart.so.10.0 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.10.0; fi + if [ ! -f $(SIM_LIB_DIR)/libcudart.so.10.1 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.10.1; fi + if [ ! -f $(SIM_LIB_DIR)/libcudart.so.11.0 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.11.0; fi ++ if [ ! -f $(SIM_LIB_DIR)/libcudart.so.12 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.12; fi ++ if [ ! -f $(SIM_LIB_DIR)/libcudart.so.12.0 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.12.0; 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\ +diff --git a/linux-so-version.txt b/linux-so-version.txt +index 3db07ac..55d3727 100644 +--- a/linux-so-version.txt ++++ b/linux-so-version.txt +@@ -10,5 +10,7 @@ libcudart.so.10.1{ + }; + libcudart.so.11.0{ + }; ++libcudart.so.12{ ++}; + libcuda.so.1{ + }; +diff --git a/setup_environment b/setup_environment +index 07d0788..cd054ea 100644 +--- a/setup_environment ++++ b/setup_environment +@@ -44,11 +44,11 @@ if [ $? = 1 ]; then + return; + fi + +-CC_VERSION=`gcc --version | head -1 | awk '{for(i=1;i<=NF;i++){ if(match($i,/^[0-9]\.[0-9]\.[0-9]$/)) {print $i; exit 0}}}'` ++CC_VERSION=`gcc --version | head -1 | awk '{for(i=1;i<=NF;i++){ if(match($i,/^[0-9]+\.[0-9]+\.[0-9]+$/)) {print $i; exit 0}}}'` + + CUDA_VERSION_STRING=`$CUDA_INSTALL_PATH/bin/nvcc --version | awk '/release/ {print $5;}' | sed 's/,//'`; + export CUDA_VERSION_NUMBER=`echo $CUDA_VERSION_STRING | sed 's/\./ /' | awk '{printf("%02u%02u", 10*int($1), 10*$2);}'` +-if [ $CUDA_VERSION_NUMBER -gt 11100 -o $CUDA_VERSION_NUMBER -lt 2030 ]; then ++if [ $CUDA_VERSION_NUMBER -gt 12999 -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)"; + echo $CUDA_VERSION_NUMBER + return +diff --git a/version_detection.mk b/version_detection.mk +index ee71a62..693e913 100644 +--- a/version_detection.mk ++++ b/version_detection.mk +@@ -43,7 +43,7 @@ CUDA_VERSION_STRING:=$(shell $(CUDA_INSTALL_PATH)/bin/nvcc --version | awk '/rel + CUDART_VERSION:=$(shell echo $(CUDA_VERSION_STRING) | sed 's/\./ /' | awk '{printf("%02u%02u", 10*int($$1), 10*$$2);}') + + # Detect GCC Version +-CC_VERSION := $(shell gcc --version | head -1 | awk '{for(i=1;i<=NF;i++){ if(match($$i,/^[0-9]\.[0-9]\.[0-9]$$/)) {print $$i; exit 0 }}}') ++CC_VERSION := $(shell gcc --version | head -1 | awk '{for(i=1;i<=NF;i++){ if(match($$i,/^[0-9]+\.[0-9]+\.[0-9]+$$/)) {print $$i; exit 0 }}}') + + # Detect Support for C++11 (C++0x) from GCC Version + GNUC_CPP0X := $(shell gcc --version | perl -ne 'if (/gcc\s+\(.*\)\s+([0-9.]+)/){ if($$1 >= 4.3) {$$n=1} else {$$n=0;} } END { print $$n; }') diff --git a/debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/0002-gcc13-cuda12-source-fixes.patch b/debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/0002-gcc13-cuda12-source-fixes.patch new file mode 100644 index 0000000..a9367f8 --- /dev/null +++ b/debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/0002-gcc13-cuda12-source-fixes.patch @@ -0,0 +1,77 @@ +diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc +index fd05f55..c6475c1 100644 +--- a/libcuda/cuda_runtime_api.cc ++++ b/libcuda/cuda_runtime_api.cc +@@ -3595,7 +3595,10 @@ unsigned CUDARTAPI __cudaPushCallConfiguration(dim3 gridDim, dim3 blockDim, + if (g_debug_execution >= 3) { + announce_call(__my_func__); + } +- cudaConfigureCallInternal(gridDim, blockDim, sharedMem, stream); ++ // Must return: falling off the end of this non-void function is undefined ++ // behaviour (gcc 13 -O3 miscompiles it into a non-returning loop). ++ return (unsigned)cudaConfigureCallInternal(gridDim, blockDim, sharedMem, ++ stream); + } + + cudaError_t CUDARTAPI __cudaPopCallConfiguration(dim3 *gridDim, dim3 *blockDim, +diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h +index 49f3e9f..722dd15 100644 +--- a/src/abstract_hardware_model.h ++++ b/src/abstract_hardware_model.h +@@ -486,6 +486,18 @@ struct cudaArray { + + // Struct that record other attributes in the textureReference declaration + // - These attributes are passed thru __cudaRegisterTexture() ++#if defined(CUDART_VERSION) && CUDART_VERSION >= 12000 ++// CUDA 12 removed the legacy cudaBindTexture/textureReference runtime API. ++// Provide a placeholder layout for the simulator's legacy texture path so ++// that host-side emulation code still compiles; CUDA 12 apps cannot call the ++// removed API, so this path is unreachable for them. ++struct textureReference { ++ int normalized; ++ int filterMode; ++ int addressMode[3]; ++}; ++#endif ++ + struct textureReferenceAttr { + const struct textureReference *m_texref; + int m_dim; +diff --git a/src/cuda-sim/Makefile b/src/cuda-sim/Makefile +index 85d1c8c..1a7454b 100644 +--- a/src/cuda-sim/Makefile ++++ b/src/cuda-sim/Makefile +@@ -129,9 +129,9 @@ $(OUTPUT_DIR)/instructions.h: instructions.cc + + $(OUTPUT_DIR)/ptx_parser_decode.def: $(OUTPUT_DIR)/ptx.tab.c + ifeq ($(shell uname),Linux) +- cat $(OUTPUT_DIR)/ptx.tab.h | grep "=" | sed 's/^[ ]\+//' | sed 's/[=,]//g' | sed 's/\([_A-Z1-9]\+\)[ ]\+\([0-9]\+\)/\1 \1/' | sed 's/^/DEF(/' | sed 's/ /,"/' | sed 's/$$/")/' > $(OUTPUT_DIR)/ptx_parser_decode.def ++ cat $(OUTPUT_DIR)/ptx.tab.h | grep "=" | sed 's/^[ ]\+//' | sed 's/[=,]//g' | sed 's/"/\\"/g' | sed 's/\([_A-Z1-9]\+\)[ ]\+\([0-9]\+\)/\1 \1/' | sed 's/^/DEF(/' | sed 's/ /,"/' | sed 's/$$/")/' > $(OUTPUT_DIR)/ptx_parser_decode.def + else +- cat $(OUTPUT_DIR)/ptx.tab.h | grep "=" | sed -E 's/^ +//' | sed 's/[=,]//g' | sed -E 's/([_A-Z1-9]+).*/\1 \1/' | sed 's/^/DEF(/' | sed 's/ /,"/' | sed 's/$$/")/' > $(OUTPUT_DIR)/ptx_parser_decode.def ++ cat $(OUTPUT_DIR)/ptx.tab.h | grep "=" | sed -E 's/^ +//' | sed 's/[=,]//g' | sed 's/"/\\"/g' | sed -E 's/([_A-Z1-9]+).*/\1 \1/' | sed 's/^/DEF(/' | sed 's/ /,"/' | sed 's/$$/")/' > $(OUTPUT_DIR)/ptx_parser_decode.def + endif + + $(OUTPUT_DIR)/instructions.o: $(OUTPUT_DIR)/instructions.h $(OUTPUT_DIR)/ptx.tab.c +diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc +index 71f0703..084a889 100644 +--- a/src/cuda-sim/cuda-sim.cc ++++ b/src/cuda-sim/cuda-sim.cc +@@ -128,7 +128,9 @@ void gpgpu_t::gpgpu_ptx_sim_bindNameToTexture( + } else { + const struct textureReference *tr = *m_NameToTextureRef[texname].begin(); + assert(tr != NULL); ++#if CUDART_VERSION < 12000 + // asserts that all texrefs in set have same fields ++ // (textureReference is opaque from CUDA 12 onward) + assert(tr->normalized == texref->normalized && + tr->filterMode == texref->filterMode && + tr->addressMode[0] == texref->addressMode[0] && +@@ -139,6 +141,7 @@ void gpgpu_t::gpgpu_ptx_sim_bindNameToTexture( + tr->channelDesc.z == texref->channelDesc.z && + tr->channelDesc.w == texref->channelDesc.w && + tr->channelDesc.f == texref->channelDesc.f); ++#endif + } + m_NameToTextureRef[texname].insert(texref); + m_TextureRefToName[texref] = texname; |
