I have some function which is called by my kernel
function foo(F, material, state, buffer,fiber,family)
grid = material.convexstrategy.grid
grid_F = material.convexstrategy.grid_F
π = material.convexstrategy.g
# compute some things and write into grid,grid_F and π
#...
#....
plus_idx = findfirst(x -> x >= F[1], grid)
minus_idx = findlast(x -> x <= F[1], grid)
ipnext = findfirst(x->x>F[1],grid)
iplast = findlast(x->x<F[1],grid)
# What I'd like to do:
#buffer.W_min[fiber*family] = (π [iplast] + ((π [ipnext] - π [iplast])/(grid[ipnext] - grid[iplast])) * (F[1] - grid[iplast]))
#buffer.F_points[fiber*family,1] = grid_F[plus_idx]
#buffer.F_points[fiber*family,2] = grid_F[minus_idx]
# But only constant assignments work, such as:
buffer.W_min[fiber*family] = (π [1] + ((π [2] - π [1])/(grid[2] - grid[1])) * (F[1] - grid[1]))
buffer.F_points[fiber*family,1] = grid_F[1]
buffer.F_points[fiber*family,2] = grid_F[2]
return nothing
end
fiber
and family
are my thread ids, buffer
is a struct which holds a few CuArrays that are adapted with Adapt.jl
to the appropriate CuDevice
Array
If uncomment what Iβd like to do and comment the constant assignments, I get string errors, that I do not understand:
Reason: unsupported dynamic function invocation (call to print)
Stacktrace:
[1] print_to_string
@ strings/io.jl:135
[2] string
@ strings/io.jl:174
[3] to_index
@ indices.jl:300
[4] to_index
@ indices.jl:277
[5] to_indices
@ indices.jl:333
[6] to_indices
@ indices.jl:325
[7] getindex
@ abstractarray.jl:1170
[8] convexify
@ ~/convexified-damage/src/convexification.jl:77
[9] constitutive_driver
@ ~/convexified-damage/src/material.jl:654
[10] integrate_fiber
@ ~/convexified-damage/src/material.jl:584
Reason: unsupported call through a literal pointer (call to )
Stacktrace:
[1] _growend!
@ array.jl:884
[2] resize!
@ array.jl:1104
[3] print_to_string
@ strings/io.jl:137
[4] string
@ strings/io.jl:174
[5] to_index
@ indices.jl:300
[6] to_index
@ indices.jl:277
[7] to_indices
@ indices.jl:333
[8] to_indices
@ indices.jl:325
[9] getindex
@ abstractarray.jl:1170
[10] convexify
@ ~/convexified-damage/src/convexification.jl:77
[11] constitutive_driver
@ ~/convexified-damage/src/material.jl:654
[12] integrate_fiber
@ ~/convexified-damage/src/material.jl:584
Reason: unsupported call through a literal pointer (call to )
Stacktrace:
[1] _deleteend!
@ array.jl:893
[2] resize!
@ array.jl:1109
[3] print_to_string
@ strings/io.jl:137
[4] string
@ strings/io.jl:174
[5] to_index
@ indices.jl:300
[6] to_index
@ indices.jl:277
[7] to_indices
@ indices.jl:333
[8] to_indices
@ indices.jl:325
[9] getindex
@ abstractarray.jl:1170
[10] convexify
@ ~/convexified-damage/src/convexification.jl:77
[11] constitutive_driver
@ ~/convexified-damage/src/material.jl:654
[12] integrate_fiber
@ ~/convexified-damage/src/material.jl:584
Reason: unsupported call through a literal pointer (call to )
Stacktrace:
[1] String
@ strings/string.jl:53
[2] print_to_string
@ strings/io.jl:137
[3] string
@ strings/io.jl:174
[4] to_index
@ indices.jl:300
[5] to_index
@ indices.jl:277
[6] to_indices
@ indices.jl:333
[7] to_indices
@ indices.jl:325
[8] getindex
@ abstractarray.jl:1170
[9] convexify
@ ~/convexified-damage/src/convexification.jl:77
[10] constitutive_driver
@ ~/convexified-damage/src/material.jl:654
[11] integrate_fiber
@ ~/convexified-damage/src/material.jl:584
Reason: unsupported call through a literal pointer (call to )
Stacktrace:
[1] _string_n
@ strings/string.jl:74
[2] StringVector
@ iobuffer.jl:31
[3] #IOBuffer#361
@ iobuffer.jl:114
[4] print_to_string
@ strings/io.jl:133
[5] string
@ strings/io.jl:174
[6] to_index
@ indices.jl:300
[7] to_index
@ indices.jl:277
[8] to_indices
@ indices.jl:333
[9] to_indices
@ indices.jl:325
[10] getindex
@ abstractarray.jl:1170
[11] convexify
@ ~/convexified-damage/src/convexification.jl:77
[12] constitutive_driver
@ ~/convexified-damage/src/material.jl:654
[13] integrate_fiber
@ ~/convexified-damage/src/material.jl:584
Reason: unsupported call through a literal pointer (call to )
Stacktrace:
[1] unsafe_wrap
@ strings/string.jl:85
[2] StringVector
@ iobuffer.jl:31
[3] #IOBuffer#361
@ iobuffer.jl:114
[4] print_to_string
@ strings/io.jl:133
[5] string
@ strings/io.jl:174
[6] to_index
@ indices.jl:300
[7] to_index
@ indices.jl:277
[8] to_indices
@ indices.jl:333
[9] to_indices
@ indices.jl:325
[10] getindex
@ abstractarray.jl:1170
[11] convexify
@ ~/convexified-damage/src/convexification.jl:77
[12] constitutive_driver
@ ~/convexified-damage/src/material.jl:654
[13] integrate_fiber
@ ~/convexified-damage/src/material.jl:584
Reason: unsupported call through a literal pointer (call to __memset_avx2_unaligned)
Stacktrace:
[1] fill!
@ array.jl:406
[2] #IOBuffer#361
@ iobuffer.jl:121
[3] print_to_string
@ strings/io.jl:133
[4] string
@ strings/io.jl:174
[5] to_index
@ indices.jl:300
[6] to_index
@ indices.jl:277
[7] to_indices
@ indices.jl:333
[8] to_indices
@ indices.jl:325
[9] getindex
@ abstractarray.jl:1170
[10] convexify
@ ~/convexified-damage/src/convexification.jl:77
[11] constitutive_driver
@ ~/convexified-damage/src/material.jl:654
[12] integrate_fiber
@ ~/convexified-damage/src/material.jl:584
Reason: unsupported dynamic function invocation (call to var"#sprint#385"(context, sizehint::Integer, ::typeof(sprint), f::Function, args...) in Base at strings/io.jl:100)
Stacktrace:
[1] #repr#386
@ strings/io.jl:219
[2] limitrepr
@ strings/io.jl:221
[3] to_index
@ indices.jl:300
[4] to_index
@ indices.jl:277
[5] to_indices
@ indices.jl:333
[6] to_indices
@ indices.jl:325
[7] getindex
@ abstractarray.jl:1170
[8] convexify
@ ~/convexified-damage/src/convexification.jl:77
[9] constitutive_driver
@ ~/convexified-damage/src/material.jl:654
[10] integrate_fiber
@ ~/convexified-damage/src/material.jl:584
line 77 corresponds to the line of the non-constant buffer.W_min
assignment.
If I let this outcommented and instead uncomment one line of buffer.F_points
, e.g. buffer.F_points[i*j,1] = grid_F[plus_idx]
I get a stacktrace which doesnβt point any longer to my code. Note that all of this is with -g 2
flag.
son: unsupported dynamic function invocation (call to print)
Stacktrace:
[1] print_to_string
@ strings/io.jl:135
[2] string
@ strings/io.jl:174
[3] to_index
@ indices.jl:300
[4] to_index
@ indices.jl:277
[5] multiple call sites
@ unknown:0
Reason: unsupported call through a literal pointer (call to )
Stacktrace:
[1] _growend!
@ array.jl:884
[2] resize!
@ array.jl:1104
[3] print_to_string
@ strings/io.jl:137
[4] string
@ strings/io.jl:174
[5] to_index
@ indices.jl:300
[6] to_index
@ indices.jl:277
[7] multiple call sites
@ unknown:0
Reason: unsupported call through a literal pointer (call to )
Stacktrace:
[1] _deleteend!
@ array.jl:893
[2] resize!
@ array.jl:1109
[3] print_to_string
@ strings/io.jl:137
[4] string
@ strings/io.jl:174
[5] to_index
@ indices.jl:300
[6] to_index
@ indices.jl:277
[7] multiple call sites
@ unknown:0
Reason: unsupported call through a literal pointer (call to )
Stacktrace:
[1] String
@ strings/string.jl:53
[2] print_to_string
@ strings/io.jl:137
[3] string
@ strings/io.jl:174
[4] to_index
@ indices.jl:300
[5] to_index
@ indices.jl:277
[6] multiple call sites
@ unknown:0
Reason: unsupported call through a literal pointer (call to )
Stacktrace:
[1] _string_n
@ strings/string.jl:74
[2] StringVector
@ iobuffer.jl:31
[3] #IOBuffer#361
@ iobuffer.jl:114
[4] print_to_string
@ strings/io.jl:133
[5] string
@ strings/io.jl:174
[6] to_index
@ indices.jl:300
[7] to_index
@ indices.jl:277
[8] multiple call sites
@ unknown:0
Reason: unsupported call through a literal pointer (call to )
Stacktrace:
[1] unsafe_wrap
@ strings/string.jl:85
[2] StringVector
@ iobuffer.jl:31
[3] #IOBuffer#361
@ iobuffer.jl:114
[4] print_to_string
@ strings/io.jl:133
[5] string
@ strings/io.jl:174
[6] to_index
@ indices.jl:300
[7] to_index
@ indices.jl:277
[8] multiple call sites
@ unknown:0
Reason: unsupported call through a literal pointer (call to __memset_avx2_unaligned)
Stacktrace:
[1] fill!
@ array.jl:406
[2] #IOBuffer#361
@ iobuffer.jl:121
[3] print_to_string
@ strings/io.jl:133
[4] string
@ strings/io.jl:174
[5] to_index
@ indices.jl:300
[6] to_index
@ indices.jl:277
[7] multiple call sites
@ unknown:0
Reason: unsupported dynamic function invocation (call to var"#sprint#385"(context, sizehint::Integer, ::typeof(sprint), f::Function, args...) in Base at strings/io.jl:100)
Stacktrace:
[1] #repr#386
@ strings/io.jl:219
[2] limitrepr
@ strings/io.jl:221
[3] to_index
@ indices.jl:300
[4] to_index
@ indices.jl:277
[5] multiple call sites
@ unknown:0
Am I missing something conceptually? If I can write constants inside my buffers, the datatypes should match. Only if I make use of dynamic indices like plus_idx
which are obtained by findfirst
and similar functions, I get errors. I checked if the indices have an integer value, so they arenβt of type Nothing
.
Iβd be happy if anyone points out conceptual problems or hints to further debug this. I tried to use @device_code_warntype interactive=true
, but couldnβt make any sense of the IR of this portion of code