@@ -1087,6 +1087,7 @@ end
10871087
10881088
10891089function get_array_struct ()
1090+ @static if VERSION < v " 1.11-"
10901091# JL_EXTENSION typedef struct {
10911092# JL_DATA_TYPE
10921093# void *data;
@@ -1117,6 +1118,41 @@ function get_array_struct()
11171118 nrows = LLVM. IntType (8 * sizeof (Csize_t))
11181119
11191120 return LLVM. StructType ([ptrty, sizeT, arrayFlags, elsz, off, nrows]; packed= true )
1121+ else
1122+ # JL_EXTENSION typedef struct {
1123+ # JL_DATA_TYPE
1124+ # size_t length;
1125+ # void *ptr;
1126+ # // followed by padding and inline data, or owner pointer
1127+ # #ifdef _P64
1128+ # // union {
1129+ # // jl_value_t *owner;
1130+ # // T inl[];
1131+ # // };
1132+ # #else
1133+ # //
1134+ # // jl_value_t *owner;
1135+ # // size_t padding[1];
1136+ # // T inl[];
1137+ # #endif
1138+ # } jl_genericmemory_t;
1139+ #
1140+ # JL_EXTENSION typedef struct {
1141+ # JL_DATA_TYPE
1142+ # void *ptr_or_offset;
1143+ # jl_genericmemory_t *mem;
1144+ # } jl_genericmemoryref_t;
1145+ #
1146+ # JL_EXTENSION typedef struct {
1147+ # JL_DATA_TYPE
1148+ # jl_genericmemoryref_t ref;
1149+ # size_t dimsize[]; // length for 1-D, otherwise length is mem->length
1150+ # } jl_array_t;
1151+ i8 = LLVM. IntType (8 )
1152+ ptrty = LLVM. PointerType (i8, 10 )
1153+ sizeT = LLVM. IntType (8 * sizeof (Csize_t))
1154+ return LLVM. StructType ([ptrty, sizeT]; packed= true )
1155+ end
11201156end
11211157
11221158function get_array_data (B, array)
@@ -1171,9 +1207,6 @@ function get_array_nrows(B, array)
11711207 return LLVM. load! (B, nrows, v)
11721208end
11731209
1174- dedupargs () = ()
1175- dedupargs (a, da, args... ) = (a, dedupargs (args... )... )
1176-
11771210# Force sret
11781211struct Return2
11791212 ret1:: Any
@@ -5398,11 +5431,11 @@ function GPUCompiler.codegen(output::Symbol, job::CompilerJob{<:EnzymeTarget};
53985431 handleCustom (llvmfn, " enz_noop" , [StringAttribute (" enzyme_inactive" ), EnumAttribute (" readonly" ), StringAttribute (" enzyme_ta_norecur" )])
53995432 continue
54005433 end
5401- if EnzymeRules. is_inactive_from_sig (mi . specTypes; world, method_table, caller)
5434+ if EnzymeRules. is_inactive_from_sig (specTypes; world, method_table, caller) && has_method (Tuple{ typeof (EnzymeRules . inactive), specTypes . parameters ... }, world, method_table )
54025435 handleCustom (llvmfn, " enz_noop" , [StringAttribute (" enzyme_inactive" ), EnumAttribute (" nofree" ), StringAttribute (" enzyme_no_escaping_allocation" ), StringAttribute (" enzyme_ta_norecur" )])
54035436 continue
54045437 end
5405- if EnzymeRules. is_inactive_noinl_from_sig (mi . specTypes; world, method_table, caller)
5438+ if EnzymeRules. is_inactive_noinl_from_sig (specTypes; world, method_table, caller) && has_method (Tuple{ typeof (EnzymeRules . inactive_noinl), specTypes . parameters ... }, world, method_table )
54065439 handleCustom (llvmfn, " enz_noop" , [StringAttribute (" enzyme_inactive" ), EnumAttribute (" nofree" ), StringAttribute (" enzyme_no_escaping_allocation" ), StringAttribute (" enzyme_ta_norecur" )], false , false )
54075440 for bb in blocks (llvmfn)
54085441 for inst in instructions (bb)
0 commit comments