From 0e19bd4dd411c3a40ad9ba0ecabe570cd14acae4 Mon Sep 17 00:00:00 2001 From: Brice Videau Date: Thu, 31 Aug 2023 14:40:46 -0500 Subject: [PATCH] Add stub implementation of CUDA symbols to avoid segfaulting. (#140) * Add stub implementation of CUDA symbols to avoid segfaulting. * Try and be smart. * Change at_exit location. --- cuda/cuda_model.rb | 8 +++-- cuda/gen_cuda.rb | 46 ++++++++++++++++++++++++----- cuda/tracer_cuda_helpers.include.c | 47 ++++++++++++++++++++---------- 3 files changed, 76 insertions(+), 25 deletions(-) diff --git a/cuda/cuda_model.rb b/cuda/cuda_model.rb index 92d1af38..0d49bf1d 100644 --- a/cuda/cuda_model.rb +++ b/cuda/cuda_model.rb @@ -34,8 +34,6 @@ gen_struct_map(typedefs, structs) gen_ffi_type_map(typedefs) -INIT_FUNCTIONS = /cuInit|cuDriverGetVersion|cuGetExportTable|cuDeviceGetCount|cuGetProcAddress/ - HEX_INT_TYPES.push("CUdeviceptr") class TracepointParameter @@ -286,6 +284,12 @@ def upper_snake_case(str) } EOF +register_epilogue "cuInit", < @@ -20,7 +22,37 @@ puts "#define #{CUDA_POINTER_NAMES[c]} #{c.pointer_name}" } -($cuda_commands + $cuda_exports_commands).each { |c| +($cuda_commands).each { |c| + puts <