summaryrefslogtreecommitdiffstats
path: root/debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/0002-gcc13-cuda12-source-fixes.patch
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-03 14:05:38 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-03 14:05:38 -0400
commitcc79b478843f0230fe6aa8ecd822de7ba71c891e (patch)
tree5de760ddec4e45cc23d39ce7502635f5c0711217 /debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/0002-gcc13-cuda12-source-fixes.patch
parent40351167dd209012ab485e6164ce94f0b8965422 (diff)
downloadopen-iov-cc79b478843f0230fe6aa8ecd822de7ba71c891e.tar.gz
open-iov-cc79b478843f0230fe6aa8ecd822de7ba71c891e.zip
vgsp: host CUDA bridge + sema release recovery; greeneye simulator wave
- kernel: gsp_cuda_bridge (QMD launch capture, debugfs job/out/done, param+output resolution cached from inline writes), sema drain fixes (never hold/starve a channel), GR ring autopin + counter autoreg, per-page push reads, counter-derive gate; module builds clean - tools/cuda-bridge: CUDA driver-API daemon executing mail/vadd kernels on the physical GPU, CUBB2/CBD2 v2 protocol, layout check + self-tests - tools/guest-diag + tools/cuda-ab: scanner/pin fixes, victory push-only mode - debug/risc-v-gsp-rm-vm: Phase S simulator wave (GSP device model, boot ladder, triage/re-demo harnesses, docs 30-41), GPGPU-sim scaffolding - STATE-CURRENT/docs updates
Diffstat (limited to 'debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/0002-gcc13-cuda12-source-fixes.patch')
-rw-r--r--debug/risc-v-gsp-rm-vm/gpgpu-sim/patches/0002-gcc13-cuda12-source-fixes.patch77
1 files changed, 77 insertions, 0 deletions
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;