Skip to content

Commit b65eb81

Browse files
committed
Remove parent field, it's unused.
1 parent bff2f50 commit b65eb81

File tree

8 files changed

+23
-36
lines changed

8 files changed

+23
-36
lines changed

src/driver.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ const __llvm_initialized = Ref(false)
199199
# cached compilation
200200
dyn_entry_fn = get!(jobs, dyn_job) do
201201
config = CompilerConfig(dyn_job.config; toplevel=false)
202-
dyn_ir, dyn_meta =
203-
codegen(:llvm, CompilerJob(dyn_job; config, parent=job))
202+
dyn_ir, dyn_meta = codegen(:llvm, CompilerJob(dyn_job; config))
204203
dyn_entry_fn = LLVM.name(dyn_meta.entry)
205204
merge!(compiled, dyn_meta.compiled)
206205
@assert context(dyn_ir) == context(ir)

src/interface.jl

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export CompilerConfig
6363

6464
# the configuration of the compiler
6565

66-
const CONFIG_KWARGS = [:kernel, :entry_abi, :name, :always_inline, :libraries,
67-
:optimize, :cleanup, :validate, :strip, :only_entry]
66+
const CONFIG_KWARGS = [:kernel, :name, :entry_abi, :always_inline, :opt_level,
67+
:libraries, :optimize, :cleanup, :validate, :strip]
6868

6969
"""
7070
CompilerConfig(target, params; kernel=true, entry_abi=:specfunc, name=nothing,
@@ -77,6 +77,8 @@ Several keyword arguments can be used to customize the compilation process:
7777
7878
- `kernel`: specifies if the function should be compiled as a kernel (the default) or as a
7979
plain function. This toggles certain optimizations, rewrites and validations.
80+
- `name`: the name that will be used for the entrypoint function. If `nothing` (the
81+
default), the name will be generated automatically.
8082
- `entry_abi`: can be either `:specfunc` (the default), or `:func`.
8183
- `:specfunc` expects the arguments to be passed in registers, simple return values are
8284
returned in registers as well, and complex return values are returned on the stack
@@ -86,10 +88,9 @@ Several keyword arguments can be used to customize the compilation process:
8688
of boxed Julia values and the third argument being the number of values, the return
8789
value will also be boxed. The `:func` abi will internally call the `:specfunc` abi, but
8890
is generally easier to invoke directly.
89-
- `name`: the name that will be used for the entrypoint function. If `nothing` (the
90-
default), the name will be generated automatically.
9191
- `always_inline` specifies if the Julia front-end should inline all functions into one if
9292
possible.
93+
- `opt_level`: the optimization level to use (default: 2)
9394
- `libraries`: link the GPU runtime and `libdevice` libraries (default: true)
9495
- `optimize`: optimize the code (default: true)
9596
- `cleanup`: run cleanup passes on the code (default: true)
@@ -172,8 +173,6 @@ using Core: MethodInstance
172173

173174
# a specific invocation of the compiler, bundling everything needed to generate code
174175

175-
const JOB_KWARGS = [:parent]
176-
177176
"""
178177
CompilerJob(source::MethodInstance, config::CompilerConfig, [world=tls_world_age()])
179178
@@ -185,25 +184,20 @@ struct CompilerJob{T,P}
185184
config::CompilerConfig{T,P}
186185
world::UInt
187186

188-
# internal
189-
parent::Union{Nothing, CompilerJob}
190-
191-
CompilerJob(source::MethodInstance, config::CompilerConfig{T,P}, world=tls_world_age();
192-
parent::Union{Nothing, CompilerJob}=nothing) where {T,P} =
193-
new{T,P}(source, config, world, parent)
187+
CompilerJob(source::MethodInstance, config::CompilerConfig{T,P},
188+
world=tls_world_age()) where {T,P} =
189+
new{T,P}(source, config, world)
194190
end
195191

196192
# copy constructor
197-
CompilerJob(job::CompilerJob; source=job.source, config=job.config, world=job.world,
198-
parent=job.parent) =
199-
CompilerJob(source, config, world; parent)
193+
CompilerJob(job::CompilerJob; source=job.source, config=job.config, world=job.world) =
194+
CompilerJob(source, config, world)
200195

201196
function Base.hash(job::CompilerJob, h::UInt)
202197
h = hash(job.source, h)
203198
h = hash(job.config, h)
204199
h = hash(job.world, h)
205200

206-
h = hash(job.parent, h)
207201
return h
208202
end
209203

test/helpers/bpf.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ struct CompilerParams <: AbstractCompilerParams end
77
GPUCompiler.runtime_module(::CompilerJob{<:Any,CompilerParams}) = TestRuntime
88

99
function create_job(@nospecialize(func), @nospecialize(types); kwargs...)
10-
config_kwargs, job_kwargs, kwargs =
11-
split_kwargs(kwargs, GPUCompiler.CONFIG_KWARGS, GPUCompiler.JOB_KWARGS)
10+
config_kwargs, kwargs = split_kwargs(kwargs, GPUCompiler.CONFIG_KWARGS)
1211
source = methodinstance(typeof(func), Base.to_tuple_type(types), Base.get_world_counter())
1312
target = BPFCompilerTarget()
1413
params = CompilerParams()
1514
config = CompilerConfig(target, params; kernel=false, config_kwargs...)
16-
CompilerJob(source, config; job_kwargs...), kwargs
15+
CompilerJob(source, config), kwargs
1716
end
1817

1918
function code_llvm(io::IO, @nospecialize(func), @nospecialize(types); kwargs...)

test/helpers/gcn.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ struct CompilerParams <: AbstractCompilerParams end
77
GPUCompiler.runtime_module(::CompilerJob{<:Any,CompilerParams}) = TestRuntime
88

99
function create_job(@nospecialize(func), @nospecialize(types); kwargs...)
10-
config_kwargs, job_kwargs, kwargs =
11-
split_kwargs(kwargs, GPUCompiler.CONFIG_KWARGS, GPUCompiler.JOB_KWARGS)
10+
config_kwargs, kwargs = split_kwargs(kwargs, GPUCompiler.CONFIG_KWARGS)
1211
source = methodinstance(typeof(func), Base.to_tuple_type(types), Base.get_world_counter())
1312
target = GCNCompilerTarget(dev_isa="gfx900")
1413
params = CompilerParams()
1514
config = CompilerConfig(target, params; kernel=false, config_kwargs...)
16-
CompilerJob(source, config; job_kwargs...), kwargs
15+
CompilerJob(source, config), kwargs
1716
end
1817

1918
function code_typed(@nospecialize(func), @nospecialize(types); kwargs...)

test/helpers/metal.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ struct CompilerParams <: AbstractCompilerParams end
77
GPUCompiler.runtime_module(::CompilerJob{<:Any,CompilerParams}) = TestRuntime
88

99
function create_job(@nospecialize(func), @nospecialize(types); kwargs...)
10-
config_kwargs, job_kwargs, kwargs =
11-
split_kwargs(kwargs, GPUCompiler.CONFIG_KWARGS, GPUCompiler.JOB_KWARGS)
10+
config_kwargs, kwargs = split_kwargs(kwargs, GPUCompiler.CONFIG_KWARGS)
1211
source = methodinstance(typeof(func), Base.to_tuple_type(types), Base.get_world_counter())
1312
target = MetalCompilerTarget(; macos=v"12.2", metal=v"3.0", air=v"3.0")
1413
params = CompilerParams()
1514
config = CompilerConfig(target, params; kernel=false, config_kwargs...)
16-
CompilerJob(source, config; job_kwargs...), kwargs
15+
CompilerJob(source, config), kwargs
1716
end
1817

1918
function code_typed(@nospecialize(func), @nospecialize(types); kwargs...)

test/helpers/native.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ GPUCompiler.can_safepoint(@nospecialize(job::NativeCompilerJob)) = job.config.pa
2222

2323
function create_job(@nospecialize(func), @nospecialize(types);
2424
entry_safepoint::Bool=false, method_table=test_method_table, kwargs...)
25-
config_kwargs, job_kwargs, kwargs =
26-
split_kwargs(kwargs, GPUCompiler.CONFIG_KWARGS, GPUCompiler.JOB_KWARGS)
25+
config_kwargs, kwargs = split_kwargs(kwargs, GPUCompiler.CONFIG_KWARGS)
2726
source = methodinstance(typeof(func), Base.to_tuple_type(types), Base.get_world_counter())
2827
target = NativeCompilerTarget()
2928
params = CompilerParams(entry_safepoint, method_table)
3029
config = CompilerConfig(target, params; kernel=false, config_kwargs...)
31-
CompilerJob(source, config; job_kwargs...), kwargs
30+
CompilerJob(source, config), kwargs
3231
end
3332

3433
function code_typed(@nospecialize(func), @nospecialize(types); kwargs...)

test/helpers/ptx.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ function create_job(@nospecialize(func), @nospecialize(types);
3939
minthreads=nothing, maxthreads=nothing,
4040
blocks_per_sm=nothing, maxregs=nothing,
4141
kwargs...)
42-
config_kwargs, job_kwargs, kwargs =
43-
split_kwargs(kwargs, GPUCompiler.CONFIG_KWARGS, GPUCompiler.JOB_KWARGS)
42+
config_kwargs, kwargs = split_kwargs(kwargs, GPUCompiler.CONFIG_KWARGS)
4443
source = methodinstance(typeof(func), Base.to_tuple_type(types), Base.get_world_counter())
4544
target = PTXCompilerTarget(; cap=v"7.0", minthreads, maxthreads, blocks_per_sm, maxregs)
4645
params = CompilerParams()
4746
config = CompilerConfig(target, params; kernel=false, config_kwargs...)
48-
CompilerJob(source, config; job_kwargs...), kwargs
47+
CompilerJob(source, config), kwargs
4948
end
5049

5150
function code_typed(@nospecialize(func), @nospecialize(types); kwargs...)

test/helpers/spirv.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ GPUCompiler.runtime_module(::CompilerJob{<:Any,CompilerParams}) = TestRuntime
99
function create_job(@nospecialize(func), @nospecialize(types);
1010
supports_fp16=true, supports_fp64=true, backend::Symbol,
1111
kwargs...)
12-
config_kwargs, job_kwargs, kwargs =
13-
split_kwargs(kwargs, GPUCompiler.CONFIG_KWARGS, GPUCompiler.JOB_KWARGS)
12+
config_kwargs, kwargs = split_kwargs(kwargs, GPUCompiler.CONFIG_KWARGS)
1413
source = methodinstance(typeof(func), Base.to_tuple_type(types), Base.get_world_counter())
1514
target = SPIRVCompilerTarget(; backend, validate=true, optimize=true,
1615
supports_fp16, supports_fp64)
1716
params = CompilerParams()
1817
config = CompilerConfig(target, params; kernel=false, config_kwargs...)
19-
CompilerJob(source, config; job_kwargs...), kwargs
18+
CompilerJob(source, config), kwargs
2019
end
2120

2221
function code_typed(@nospecialize(func), @nospecialize(types); kwargs...)

0 commit comments

Comments
 (0)