Don't eval in generated function return
This commit is contained in:
parent
5be7ca99e7
commit
8a5e49429b
@ -1,25 +1,12 @@
|
||||
# patch QEDprocesses
|
||||
# see issue https://github.com/QEDjl-project/QEDprocesses.jl/issues/77
|
||||
@inline function QEDprocesses.number_particles(
|
||||
proc_def::QEDbase.AbstractProcessDefinition,
|
||||
::Type{PS},
|
||||
proc_def::QEDbase.AbstractProcessDefinition, ::Type{PS}
|
||||
) where {
|
||||
DIR <: QEDbase.ParticleDirection,
|
||||
PT <: QEDbase.AbstractParticleType,
|
||||
EL <: AbstractFourMomentum,
|
||||
PS <: ParticleStateful{DIR, PT, EL},
|
||||
DIR<:QEDbase.ParticleDirection,
|
||||
PT<:QEDbase.AbstractParticleType,
|
||||
EL<:AbstractFourMomentum,
|
||||
PS<:ParticleStateful{DIR,PT,EL},
|
||||
}
|
||||
return QEDprocesses.number_particles(proc_def, DIR(), PT())
|
||||
end
|
||||
|
||||
@inline function QEDcore.ParticleStateful{DIR, SPECIES}(
|
||||
mom::AbstractFourMomentum,
|
||||
) where {DIR <: ParticleDirection, SPECIES <: AbstractParticleType}
|
||||
return ParticleStateful(DIR(), SPECIES(), mom)
|
||||
end
|
||||
|
||||
@inline function QEDcore.ParticleStateful{DIR, SPECIES, EL}(
|
||||
mom::EL,
|
||||
) where {DIR <: ParticleDirection, SPECIES <: AbstractParticleType, EL <: AbstractFourMomentum}
|
||||
return ParticleStateful(DIR(), SPECIES(), mom)
|
||||
end
|
||||
|
@ -16,9 +16,7 @@ function get_compute_function(graph::DAG, instance, machine::Machine)
|
||||
"function compute_$(functionId)(data_input::$(input_type(instance))) $(initCaches); $(assignInputs); $code; return $resSym; end",
|
||||
)
|
||||
|
||||
func = eval(expr)
|
||||
|
||||
return func
|
||||
return expr
|
||||
end
|
||||
|
||||
"""
|
||||
@ -35,22 +33,22 @@ function get_cuda_kernel(graph::DAG, instance, machine::Machine)
|
||||
|
||||
functionId = to_var_name(UUIDs.uuid1(rng[1]))
|
||||
resSym = eval(gen_access_expr(entry_device(tape.machine), tape.outputSymbol))
|
||||
expr = Meta.parse("function compute_$(functionId)(input_vector, output_vector, n::Int64)
|
||||
id = (blockIdx().x - 1) * blockDim().x + threadIdx().x
|
||||
if (id > n)
|
||||
return
|
||||
end
|
||||
@inline data_input = input_vector[id]
|
||||
$(initCaches)
|
||||
$(assignInputs)
|
||||
$code
|
||||
@inline output_vector[id] = $resSym
|
||||
return nothing
|
||||
end")
|
||||
expr = Meta.parse(
|
||||
"function compute_$(functionId)(input_vector, output_vector, n::Int64)
|
||||
id = (blockIdx().x - 1) * blockDim().x + threadIdx().x
|
||||
if (id > n)
|
||||
return
|
||||
end
|
||||
@inline data_input = input_vector[id]
|
||||
$(initCaches)
|
||||
$(assignInputs)
|
||||
$code
|
||||
@inline output_vector[id] = $resSym
|
||||
return nothing
|
||||
end"
|
||||
)
|
||||
|
||||
func = eval(expr)
|
||||
|
||||
return func
|
||||
return expr
|
||||
end
|
||||
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user