Skip to content
This repository was archived by the owner on May 27, 2021. It is now read-only.

Commit 04be434

Browse files
authored
Merge pull request #523 from JuliaGPU/tb/threadfence
Add a system-wide thread fence to the exception flag setter.
2 parents c08d25f + 069eca5 commit 04be434

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/device/runtime.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ function signal_exception()
111111
ptr = exception_flag()
112112
if ptr !== C_NULL
113113
unsafe_store!(convert(Ptr{Int}, ptr), 1)
114+
threadfence_system()
114115
else
115116
@cuprintf("""
116117
WARNING: could not signal exception status to the host, execution will continue.

src/exceptions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function create_exceptions!(mod::CuModule)
2525
try
2626
flag_ptr = CuGlobal{Ptr{Cvoid}}(mod, "exception_flag")
2727
exception_flag = get!(exception_flags, ctx, Mem.alloc(Mem.Host, sizeof(Int),
28-
Mem.HOSTALLOC_DEVICEMAP))
28+
Mem.HOSTALLOC_DEVICEMAP))
2929
flag_ptr[] = reinterpret(Ptr{Cvoid}, convert(CuPtr{Cvoid}, exception_flag))
3030
catch err
3131
# modules that do not throw exceptions will not contain the indicator flag

0 commit comments

Comments
 (0)