@@ -16,6 +16,30 @@ GPUCompiler.kernel_state_type(@nospecialize(job::PTXCompilerJob)) = PTXKernelSta
16
16
ptx_kernel_state () =
17
17
unsafe_load (convert (Ptr{PTXKernelState}, GPUCompiler. kernel_state_pointer ()))
18
18
19
+ # a version of the test runtime that has some side effects, loading the kernel state
20
+ # (so that we can test if kernel state arguments are appropriately optimized away)
21
+ module PTXTestRuntime
22
+ using .. GPUCompiler
23
+ import .. PTXKernelState
24
+
25
+ kernel_state () = unsafe_load (convert (Ptr{PTXKernelState}, GPUCompiler. kernel_state_pointer ()))
26
+
27
+ function signal_exception ()
28
+ kernel_state ()
29
+ return
30
+ end
31
+
32
+ # dummy methods
33
+ # HACK: if malloc returns 0 or traps, all calling functions (like jl_box_*)
34
+ # get reduced to a trap, which really messes with our test suite.
35
+ malloc (sz) = Ptr {Cvoid} (Int (0xDEADBEEF ))
36
+ report_oom (sz) = return
37
+ report_exception (ex) = return
38
+ report_exception_name (ex) = return
39
+ report_exception_frame (idx, func, file, line) = return
40
+ end
41
+ GPUCompiler. runtime_module (:: PTXCompilerJob ) = PTXTestRuntime
42
+
19
43
function ptx_job (@nospecialize (func), @nospecialize (types); kernel:: Bool = false ,
20
44
minthreads= nothing , maxthreads= nothing , blocks_per_sm= nothing ,
21
45
maxregs= nothing , kwargs... )
0 commit comments