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;