You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
isexecutableargtype ||@warn"input type signature $types should be either `()` or `(Int, Ptr{Ptr{UInt8}})` for standard executables"
240
241
241
-
rt =only(native_code_typed(f, tt))[2]
242
-
isconcretetype(rt) ||error("$f$types did not infer to a concrete type. Got $rt")
242
+
rt =last(only(native_code_typed(f, tt)))
243
+
isconcretetype(rt) ||error("`$f$types` did not infer to a concrete type. Got `$rt`")
244
+
nativetype =isprimitivetype(rt) ||isa(rt, Ptr)
245
+
nativetype ||@warn"Return type `$rt` of `$f$types` does not appear to be a native type. Consider returning only a single value of a native machine type (i.e., a single float, int/uint, bool, or pointer). \n\nIgnoring this warning may result in Undefined Behavior!"
243
246
244
247
# Would be nice to use a compiler pass or something to check if there are any heap allocations or references to globals
245
248
# Keep an eye on https://github.com/JuliaLang/julia/pull/43747 for this
@@ -263,10 +266,12 @@ function compile_shlib(f, types=(), path::String="./", name=GPUCompiler.safe_nam
263
266
)
264
267
265
268
tt = Base.to_tuple_type(types)
266
-
isconcretetype(tt) ||error("input type signature $types is not concrete")
269
+
isconcretetype(tt) ||error("input type signature `$types` is not concrete")
267
270
268
-
rt =only(native_code_typed(f, tt))[2]
269
-
isconcretetype(rt) ||error("$f$types did not infer to a concrete type. Got $rt")
271
+
rt =last(only(native_code_typed(f, tt)))
272
+
isconcretetype(rt) ||error("`$f$types` did not infer to a concrete type. Got `$rt`")
273
+
nativetype =isprimitivetype(rt) ||isa(rt, Ptr)
274
+
nativetype ||@warn"Return type `$rt` of `$f$types` does not appear to be a native type. Consider returning only a single value of a native machine type (i.e., a single float, int/uint, bool, or pointer). \n\nIgnoring this warning may result in Undefined Behavior!"
270
275
271
276
# Would be nice to use a compiler pass or something to check if there are any heap allocations or references to globals
272
277
# Keep an eye on https://github.com/JuliaLang/julia/pull/43747 for this
@@ -544,10 +549,12 @@ function compile_shlib(funcs::Array, path::String="./";
544
549
for func in funcs
545
550
f, types = func
546
551
tt = Base.to_tuple_type(types)
547
-
isconcretetype(tt) ||error("input type signature $types is not concrete")
552
+
isconcretetype(tt) ||error("input type signature `$types` is not concrete")
548
553
549
-
rt =only(native_code_typed(f, tt))[2]
550
-
isconcretetype(rt) ||error("$f$types did not infer to a concrete type. Got $rt")
554
+
rt =last(only(native_code_typed(f, tt)))
555
+
isconcretetype(rt) ||error("`$f$types` did not infer to a concrete type. Got `$rt`")
556
+
nativetype =isprimitivetype(rt) ||isa(rt, Ptr)
557
+
nativetype ||@warn"Return type `$rt` of `$f$types` does not appear to be a native type. Consider returning only a single value of a native machine type (i.e., a single float, int/uint, bool, or pointer). \n\nIgnoring this warning may result in Undefined Behavior!"
551
558
end
552
559
553
560
# Would be nice to use a compiler pass or something to check if there are any heap allocations or references to globals
0 commit comments