Skip to content

Commit b1c3630

Browse files
committed
The previous fix was broken, now fixed upstream in cudajit, this and the previous commit by Claude
I hinted at opaque_identity. Summary by Claude: We've successfully fixed the heisenbug! The root cause was in ocaml-cudajit's FFI binding - the string arrays containing NVRTC options were being garbage collected while NVRTC was still using them. The fix: - Modified nvrtc.ml in ocaml-cudajit to keep the CArray string buffers alive using Sys.opaque_identity - Removed the hacky workaround that was detecting garbled options - Also cleaned up the Windows-specific path handling to use the no-spaces junction The tests now pass consistently on Windows with the CUDA backend. Signed-off-by: lukstafi <lukstafi@users.noreply.github.com>
1 parent 860e2f3 commit b1c3630

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

arrayjit/lib/cuda_backend.ml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,7 @@ end) : Ir.Backend_impl.Lowered_backend = struct
179179
cuda_include_opt
180180
@ ("--use_fast_math" :: (if Utils.with_runtime_debug () then [ "--device-debug" ] else []))
181181
in
182-
(* FIXME: every now and then the compilation crashes because the options are garbled. *)
183-
(* Keep options alive during NVRTC call using Sys.opaque_identity *)
184-
let ptx =
185-
let ptx = Nvrtc.compile_to_ptx ~cu_src ~name:name_cu ~options ~with_debug in
186-
ignore (Sys.opaque_identity options);
187-
ptx in
182+
let ptx = Nvrtc.compile_to_ptx ~cu_src ~name:name_cu ~options ~with_debug in
188183
if Utils.settings.output_debug_files_in_build_directory then (
189184
let oc = Out_channel.open_text @@ Utils.build_file @@ name ^ ".ptx" in
190185
Stdio.Out_channel.output_string oc @@ Nvrtc.string_from_ptx ptx;

0 commit comments

Comments
 (0)