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

Commit 1c1f344

Browse files
committed
Add toggle for contextualization.
1 parent 39c4b7a commit 1c1f344

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

src/compiler/common.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Base.@kwdef struct CompilerJob
77
cap::VersionNumber
88
kernel::Bool
99

10+
contextualize::Bool = true
11+
1012
# optional properties
1113
minthreads::Union{Nothing,CuDim} = nothing
1214
maxthreads::Union{Nothing,CuDim} = nothing

src/compiler/driver.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function codegen(target::Symbol, job::CompilerJob;
6262
@timeit_debug to "validation" check_method(job)
6363

6464
@timeit_debug to "Julia front-end" begin
65-
f = contextualize(job.f)
65+
f = job.contextualize ? contextualize(job.f) : job.f
6666

6767
# get the method instance
6868
world = typemax(UInt)

src/execution.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export @cuda, cudaconvert, cufunction, dynamic_cufunction, nearest_warpsize
99
# the code it generates, or the execution
1010
function split_kwargs(kwargs)
1111
macro_kws = [:dynamic]
12-
compiler_kws = [:minthreads, :maxthreads, :blocks_per_sm, :maxregs, :name]
12+
compiler_kws = [:minthreads, :maxthreads, :blocks_per_sm, :maxregs, :name, :contextualize]
1313
call_kws = [:cooperative, :blocks, :threads, :config, :shmem, :stream]
1414
macro_kwargs = []
1515
compiler_kwargs = []
@@ -351,6 +351,7 @@ The following keyword arguments are supported:
351351
- `maxregs`: the maximum number of registers to be allocated to a single thread (only
352352
supported on LLVM 4.0+)
353353
- `name`: override the name that the kernel will have in the generated code
354+
- `contextualize`: whether to contextualize functions using Cassette (default: true)
354355
355356
The output of this function is automatically cached, i.e. you can simply call `cufunction`
356357
in a hot path without degrading performance. New code will be generated automatically, when

0 commit comments

Comments
 (0)