-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathkernel-dispatch.h
1848 lines (1609 loc) · 46.2 KB
/
kernel-dispatch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
#ifndef AWKWARD_KERNEL_DISPATCH_H_
#define AWKWARD_KERNEL_DISPATCH_H_
#include "awkward/common.h"
#include "awkward/util.h"
#include "awkward/kernel-utils.h"
#include "awkward/kernels.h"
#include <sstream>
#ifndef _MSC_VER
#include "dlfcn.h"
#endif
namespace awkward {
namespace kernel {
enum class lib {
cpu,
cuda,
size
};
class LibraryPathCallback {
public:
LibraryPathCallback() = default;
virtual std::string library_path() = 0;
};
class LibraryCallback {
public:
LibraryCallback();
void add_library_path_callback(
kernel::lib ptr_lib,
const std::shared_ptr<LibraryPathCallback> &callback);
std::string awkward_library_path(kernel::lib ptr_lib);
private:
std::map<kernel::lib, std::vector<std::shared_ptr<LibraryPathCallback>>> lib_path_callbacks;
std::mutex lib_path_callbacks_mutex;
};
extern std::shared_ptr<LibraryCallback> lib_callback;
/// @brief Internal utility function to return an opaque ptr if an handle is
/// acquired for the specified ptr_lib. If not, then it raises an appropriate
/// exception
void* acquire_handle(kernel::lib ptr_lib);
/// @brief Internal utility function to return an opaque ptr if an symbol is
/// found for the corresponding handle. If not, then it raises an appropriate
/// exception
void* acquire_symbol(void* handle, const std::string& symbol_name);
/// @class array_deleter
///
/// @brief Used as a `std::shared_ptr` deleter (second argument) to
/// overload `delete ptr` with `delete[] ptr`.
///
/// This is necessary for `std::shared_ptr` to contain array buffers.
///
/// See also
/// - cuda_array_deleter, which deletes an array on a GPU.
/// - no_deleter, which does not free memory at all (for borrowed
/// references).
/// - pyobject_deleter, which reduces the reference count of a
/// Python object when there are no more C++ shared pointers
/// referencing it.
template <typename T>
class LIBAWKWARD_EXPORT_SYMBOL array_deleter {
public:
/// @brief Called by `std::shared_ptr` when its reference count reaches
/// zero.
void operator()(T const *ptr) {
awkward_free(reinterpret_cast<void const*>(ptr));
}
};
/// @class cuda_array_deleter
///
/// @brief Used as a `std::shared_ptr` deleter (second argument) to
/// overload `delete ptr` with `cudaFree`.
///
/// This is necessary for `std::shared_ptr` to contain array buffers.
///
/// See also
/// - array_deleter, which deletes array buffers in main memory.
/// - no_deleter, which does not free memory at all (for borrowed
/// references).
/// - pyobject_deleter, which reduces the reference count of a
/// Python object when there are no more C++ shared pointers
/// referencing it.
template <typename T>
class LIBAWKWARD_EXPORT_SYMBOL cuda_array_deleter {
public:
/// @brief Called by `std::shared_ptr` when its reference count reaches
/// zero.
void operator()(T const *ptr) {
auto handle = acquire_handle(lib::cuda);
typedef decltype(awkward_free) functor_type;
auto* awkward_free_fcn = reinterpret_cast<functor_type*>(
acquire_symbol(handle, "awkward_free"));
(*awkward_free_fcn)(reinterpret_cast<void const*>(ptr));
}
};
/// @class no_deleter
///
/// @brief Used as a `std::shared_ptr` deleter (second argument) to
/// overload `delete ptr` with nothing (no dereferencing).
///
/// This could be used to pass borrowed references with the same
/// C++ type as owned references.
///
/// See also
/// - array_deleter, which frees array buffers, rather than objects.
/// - cuda_array_deleter, which frees array buffers on GPUs.
/// - pyobject_deleter, which reduces the reference count of a
/// Python object when there are no more C++ shared pointers
/// referencing it.
template <typename T>
class LIBAWKWARD_EXPORT_SYMBOL no_deleter {
public:
/// @brief Called by `std::shared_ptr` when its reference count reaches
/// zero.
void operator()(T const *ptr) { }
};
/// @brief Returns the number of the device associated with the pointer
const int64_t
lib_device_num(
kernel::lib ptr_lib,
void* ptr);
/// @brief Produces a <Lib/> element for 'tostring' to indicate the kernel
/// library.
const std::string lib_tostring(
kernel::lib ptr_lib,
void* ptr,
const std::string& indent,
const std::string& pre,
const std::string& post);
/// @brief Internal Function an array buffer from library `FROM` to library
/// `TO`, usually between main memory and a GPU.
///
/// @note This function has not been implemented to handle Multi-GPU setups.
ERROR copy_to(
kernel::lib to_lib,
kernel::lib from_lib,
void* to_ptr,
void* from_ptr,
int64_t bytelength);
/// @brief FIXME
const std::string
fully_qualified_cache_key(
kernel::lib ptr_lib,
const std::string& cache_key);
/// @brief Internal Function to allocate an empty array of a given length
/// with a given type. The `bytelength` parameter is the number of bytes,
/// so be sure to multiply by sizeof(...) when using this function.
///
/// @note This function has not been implemented to handle Multi-GPU setups.
template <typename T>
std::shared_ptr<T> malloc(
kernel::lib ptr_lib,
int64_t bytelength) {
if (ptr_lib == lib::cpu) {
return std::shared_ptr<T>(
reinterpret_cast<T*>(awkward_malloc(bytelength)),
kernel::array_deleter<T>());
}
else if (ptr_lib == lib::cuda) {
auto handle = acquire_handle(lib::cuda);
typedef decltype(awkward_malloc) functor_type;
auto* awkward_malloc_fcn = reinterpret_cast<functor_type*>(
acquire_symbol(handle, "awkward_malloc"));
return std::shared_ptr<T>(
reinterpret_cast<T*>((*awkward_malloc_fcn)(bytelength)),
kernel::cuda_array_deleter<T>());
}
else {
throw std::runtime_error(
std::string("unrecognized ptr_lib in ptr_alloc<bool>"));
}
}
/////////////////////////////////// awkward/kernels/getitem.h
/// @brief Internal utility kernel to avoid raw pointer access.
template <typename T>
T NumpyArray_getitem_at0(
kernel::lib ptr_lib,
T* ptr);
// FIXME: move regularize_rangeslice to common.h; it's not a kernel.
void regularize_rangeslice(
int64_t* start,
int64_t* stop,
bool posstep,
bool hasstart,
bool hasstop,
int64_t length);
ERROR regularize_arrayslice_64(
kernel::lib ptr_lib,
int64_t* flatheadptr,
int64_t lenflathead,
int64_t length);
template <typename T>
ERROR Index_iscontiguous(
kernel::lib ptr_lib,
bool* result,
const T* fromindex,
int64_t length);
template <typename T>
ERROR Index_to_Index64(
kernel::lib ptr_lib,
int64_t* toptr,
const T* fromptr,
int64_t length);
template <typename T>
ERROR Index_carry_64(
kernel::lib ptr_lib,
T* toindex,
const T* fromindex,
const int64_t* carry,
int64_t lenfromindex,
int64_t length);
template <typename T>
ERROR Index_carry_nocheck_64(
kernel::lib ptr_lib,
T* toindex,
const T* fromindex,
const int64_t* carry,
int64_t length);
ERROR slicearray_ravel_64(
kernel::lib ptr_lib,
int64_t* toptr,
const int64_t* fromptr,
int64_t ndim,
const int64_t* shape,
const int64_t* strides);
ERROR slicemissing_check_same(
kernel::lib ptr_lib,
bool* same,
const int8_t* bytemask,
const int64_t* missingindex,
int64_t length);
template <typename T>
ERROR carry_arange(
kernel::lib ptr_lib,
T* toptr,
int64_t length);
template <typename ID>
ERROR Identities_getitem_carry_64(
kernel::lib ptr_lib,
ID* newidentitiesptr,
const ID* identitiesptr,
const int64_t* carryptr,
int64_t lencarry,
int64_t width,
int64_t length);
ERROR NumpyArray_contiguous_init_64(
kernel::lib ptr_lib,
int64_t* toptr,
int64_t skip,
int64_t stride);
ERROR NumpyArray_copy(
kernel::lib ptr_lib,
uint8_t* toptr,
const uint8_t* fromptr,
int64_t len);
ERROR NumpyArray_contiguous_copy_64(
kernel::lib ptr_lib,
uint8_t* toptr,
const uint8_t* fromptr,
int64_t len,
int64_t stride,
const int64_t* pos);
ERROR NumpyArray_contiguous_copy_from_many_64(
kernel::lib ptr_lib,
uint8_t* toptr,
const uint8_t** fromptrs,
int64_t* fromlens,
int64_t len,
int64_t stride,
const int64_t* pos);
ERROR NumpyArray_contiguous_next_64(
kernel::lib ptr_lib,
int64_t* topos,
const int64_t* frompos,
int64_t len,
int64_t skip,
int64_t stride);
ERROR NumpyArray_getitem_next_null_64(
kernel::lib ptr_lib,
uint8_t* toptr,
const uint8_t* fromptr,
int64_t len,
int64_t stride,
const int64_t* pos);
ERROR NumpyArray_getitem_next_at_64(
kernel::lib ptr_lib,
int64_t* nextcarryptr,
const int64_t* carryptr,
int64_t lencarry,
int64_t skip,
int64_t at);
ERROR NumpyArray_getitem_next_range_64(
kernel::lib ptr_lib,
int64_t* nextcarryptr,
const int64_t* carryptr,
int64_t lencarry,
int64_t lenhead,
int64_t skip,
int64_t start,
int64_t step);
ERROR NumpyArray_getitem_next_range_advanced_64(
kernel::lib ptr_lib,
int64_t* nextcarryptr,
int64_t* nextadvancedptr,
const int64_t* carryptr,
const int64_t* advancedptr,
int64_t lencarry,
int64_t lenhead,
int64_t skip,
int64_t start,
int64_t step);
ERROR NumpyArray_getitem_next_array_64(
kernel::lib ptr_lib,
int64_t* nextcarryptr,
int64_t* nextadvancedptr,
const int64_t* carryptr,
const int64_t* flatheadptr,
int64_t lencarry,
int64_t lenflathead,
int64_t skip);
ERROR NumpyArray_getitem_next_array_advanced_64(
kernel::lib ptr_lib,
int64_t* nextcarryptr,
const int64_t* carryptr,
const int64_t* advancedptr,
const int64_t* flatheadptr,
int64_t lencarry,
int64_t skip);
ERROR NumpyArray_getitem_boolean_numtrue(
kernel::lib ptr_lib,
int64_t* numtrue,
const int8_t* fromptr,
int64_t length,
int64_t stride);
ERROR NumpyArray_getitem_boolean_nonzero_64(
kernel::lib ptr_lib,
int64_t* toptr,
const int8_t* fromptr,
int64_t length,
int64_t stride);
template <typename T>
ERROR ListArray_getitem_next_at_64(
kernel::lib ptr_lib,
int64_t* tocarry,
const T* fromstarts,
const T* fromstops,
int64_t lenstarts,
int64_t at);
template <typename T>
ERROR ListArray_getitem_next_range_carrylength(
kernel::lib ptr_lib,
int64_t* carrylength,
const T* fromstarts,
const T* fromstops,
int64_t lenstarts,
int64_t start,
int64_t stop,
int64_t step);
template <typename T>
ERROR ListArray_getitem_next_range_64(
kernel::lib ptr_lib,
T* tooffsets,
int64_t* tocarry,
const T* fromstarts,
const T* fromstops,
int64_t lenstarts,
int64_t start,
int64_t stop,
int64_t step);
template <typename T>
ERROR ListArray_getitem_next_range_counts_64(
kernel::lib ptr_lib,
int64_t* total,
const T* fromoffsets,
int64_t lenstarts);
template <typename T>
ERROR ListArray_getitem_next_range_spreadadvanced_64(
kernel::lib ptr_lib,
int64_t* toadvanced,
const int64_t* fromadvanced,
const T* fromoffsets,
int64_t lenstarts);
template <typename T>
ERROR ListArray_getitem_next_array_64(
kernel::lib ptr_lib,
int64_t* tocarry,
int64_t* toadvanced,
const T* fromstarts,
const T* fromstops,
const int64_t* fromarray,
int64_t lenstarts,
int64_t lenarray,
int64_t lencontent);
template <typename T>
ERROR ListArray_getitem_next_array_advanced_64(
kernel::lib ptr_lib,
int64_t* tocarry,
int64_t* toadvanced,
const T* fromstarts,
const T* fromstops,
const int64_t* fromarray,
const int64_t* fromadvanced,
int64_t lenstarts,
int64_t lenarray,
int64_t lencontent);
template <typename T>
ERROR ListArray_getitem_carry_64(
kernel::lib ptr_lib,
T* tostarts,
T* tostops,
const T* fromstarts,
const T* fromstops,
const int64_t* fromcarry,
int64_t lenstarts,
int64_t lencarry);
ERROR RegularArray_getitem_next_at_64(
kernel::lib ptr_lib,
int64_t* tocarry,
int64_t at,
int64_t len,
int64_t size);
ERROR RegularArray_getitem_next_range_64(
kernel::lib ptr_lib,
int64_t* tocarry,
int64_t regular_start,
int64_t step,
int64_t len,
int64_t size,
int64_t nextsize);
ERROR RegularArray_getitem_next_range_spreadadvanced_64(
kernel::lib ptr_lib,
int64_t* toadvanced,
const int64_t* fromadvanced,
int64_t len,
int64_t nextsize);
ERROR RegularArray_getitem_next_array_regularize_64(
kernel::lib ptr_lib,
int64_t* toarray,
const int64_t* fromarray,
int64_t lenarray,
int64_t size);
ERROR RegularArray_getitem_next_array_64(
kernel::lib ptr_lib,
int64_t* tocarry,
int64_t* toadvanced,
const int64_t* fromarray,
int64_t len,
int64_t lenarray,
int64_t size);
ERROR RegularArray_getitem_next_array_advanced_64(
kernel::lib ptr_lib,
int64_t* tocarry,
int64_t* toadvanced,
const int64_t* fromadvanced,
const int64_t* fromarray,
int64_t len,
int64_t lenarray,
int64_t size);
ERROR RegularArray_getitem_carry_64(
kernel::lib ptr_lib,
int64_t* tocarry,
const int64_t* fromcarry,
int64_t lencarry,
int64_t size);
template <typename T>
ERROR IndexedArray_numnull(
kernel::lib ptr_lib,
int64_t* numnull,
const T* fromindex,
int64_t lenindex);
template <typename T>
ERROR IndexedArray_index_of_nulls(
kernel::lib ptr_lib,
int64_t* toindex,
const T* fromindex,
int64_t lenindex,
const int64_t* parents,
const int64_t* starts);
template <typename T>
ERROR IndexedArray_getitem_nextcarry_outindex_64(
kernel::lib ptr_lib,
int64_t* tocarry,
T* toindex,
const T* fromindex,
int64_t lenindex,
int64_t lencontent);
template <typename T>
ERROR IndexedArray_getitem_nextcarry_outindex_mask_64(
kernel::lib ptr_lib,
int64_t* tocarry,
int64_t* toindex,
const T* fromindex,
int64_t lenindex,
int64_t lencontent);
ERROR ListOffsetArray_getitem_adjust_offsets_64(
kernel::lib ptr_lib,
int64_t* tooffsets,
int64_t* tononzero,
const int64_t* fromoffsets,
int64_t length,
const int64_t* nonzero,
int64_t nonzerolength);
ERROR ListOffsetArray_getitem_adjust_offsets_index_64(
kernel::lib ptr_lib,
int64_t* tooffsets,
int64_t* tononzero,
const int64_t* fromoffsets,
int64_t length,
const int64_t* index,
int64_t indexlength,
const int64_t* nonzero,
int64_t nonzerolength,
const int8_t* originalmask,
int64_t masklength);
ERROR IndexedArray_getitem_adjust_outindex_64(
kernel::lib ptr_lib,
int8_t* tomask,
int64_t* toindex,
int64_t* tononzero,
const int64_t* fromindex,
int64_t fromindexlength,
const int64_t* nonzero,
int64_t nonzerolength);
template <typename T>
ERROR IndexedArray_getitem_nextcarry_64(
kernel::lib ptr_lib,
int64_t* tocarry,
const T* fromindex,
int64_t lenindex,
int64_t lencontent);
template <typename T>
ERROR IndexedArray_getitem_carry_64(
kernel::lib ptr_lib,
T* toindex,
const T* fromindex,
const int64_t* fromcarry,
int64_t lenindex,
int64_t lencarry);
template <typename T>
ERROR UnionArray_regular_index_getsize(
kernel::lib ptr_lib,
int64_t* size,
const T* fromtags,
int64_t length);
template <typename T, typename I>
ERROR UnionArray_regular_index(
kernel::lib ptr_lib,
I* toindex,
I* current,
int64_t size,
const T* fromtags,
int64_t length);
template <typename T, typename I>
ERROR UnionArray_project_64(
kernel::lib ptr_lib,
int64_t* lenout,
int64_t* tocarry,
const T* fromtags,
const I* fromindex,
int64_t length,
int64_t which);
ERROR missing_repeat_64(
kernel::lib ptr_lib,
int64_t* outindex,
const int64_t* index,
int64_t indexlength,
int64_t repetitions,
int64_t regularsize);
ERROR RegularArray_getitem_jagged_expand_64(
kernel::lib ptr_lib,
int64_t* multistarts,
int64_t * multistops,
const int64_t* singleoffsets,
int64_t regularsize,
int64_t regularlength);
template <typename T>
ERROR ListArray_getitem_jagged_expand_64(
kernel::lib ptr_lib,
int64_t* multistarts,
int64_t* multistops,
const int64_t* singleoffsets,
int64_t* tocarry,
const T* fromstarts,
const T* fromstops,
int64_t jaggedsize,
int64_t length);
ERROR ListArray_getitem_jagged_carrylen_64(
kernel::lib ptr_lib,
int64_t* carrylen,
const int64_t* slicestarts,
const int64_t* slicestops,
int64_t sliceouterlen);
template <typename T>
ERROR ListArray_getitem_jagged_apply_64(
kernel::lib ptr_lib,
int64_t* tooffsets,
int64_t* tocarry,
const int64_t* slicestarts,
const int64_t* slicestops,
int64_t sliceouterlen,
const int64_t* sliceindex,
int64_t sliceinnerlen,
const T* fromstarts,
const T* fromstops,
int64_t contentlen);
ERROR ListArray_getitem_jagged_numvalid_64(
kernel::lib ptr_lib,
int64_t* numvalid,
const int64_t* slicestarts,
const int64_t* slicestops,
int64_t length,
const int64_t* missing,
int64_t missinglength);
ERROR ListArray_getitem_jagged_shrink_64(
kernel::lib ptr_lib,
int64_t* tocarry,
int64_t* tosmalloffsets,
int64_t* tolargeoffsets,
const int64_t* slicestarts,
const int64_t* slicestops,
int64_t length,
const int64_t* missing);
template <typename T>
ERROR ListArray_getitem_jagged_descend_64(
kernel::lib ptr_lib,
int64_t* tooffsets,
const int64_t* slicestarts,
const int64_t* slicestops,
int64_t sliceouterlen,
const T* fromstarts,
const T* fromstops);
template <typename T>
T index_getitem_at_nowrap(
kernel::lib ptr_lib,
T* ptr,
int64_t at);
template <typename T>
void index_setitem_at_nowrap(
kernel::lib ptr_lib,
T* ptr,
int64_t at,
T value);
ERROR ByteMaskedArray_getitem_carry_64(
kernel::lib ptr_lib,
int8_t* tomask,
const int8_t* frommask,
int64_t lenmask,
const int64_t* fromcarry,
int64_t lencarry);
ERROR ByteMaskedArray_numnull(
kernel::lib ptr_lib,
int64_t* numnull,
const int8_t* mask,
int64_t length,
bool validwhen);
ERROR ByteMaskedArray_getitem_nextcarry_64(
kernel::lib ptr_lib,
int64_t* tocarry,
const int8_t* mask,
int64_t length,
bool validwhen);
ERROR ByteMaskedArray_getitem_nextcarry_outindex_64(
kernel::lib ptr_lib,
int64_t* tocarry,
int64_t* toindex,
const int8_t* mask,
int64_t length,
bool validwhen);
ERROR ByteMaskedArray_toIndexedOptionArray64(
kernel::lib ptr_lib,
int64_t* toindex,
const int8_t* mask,
int64_t length,
bool validwhen);
ERROR Content_getitem_next_missing_jagged_getmaskstartstop(
kernel::lib ptr_lib,
int64_t* index_in,
int64_t* offsets_in,
int64_t* mask_out,
int64_t* starts_out,
int64_t* stops_out,
int64_t length);
template <typename T>
ERROR MaskedArray_getitem_next_jagged_project(
kernel::lib ptr_lib,
T* index,
int64_t* starts_in,
int64_t* stops_in,
int64_t* starts_out,
int64_t* stops_out,
int64_t length);
/////////////////////////////////// awkward/kernels/identities.h
template <typename T>
ERROR new_Identities(
kernel::lib ptr_lib,
T* toptr,
int64_t length);
template <typename T>
ERROR Identities_to_Identities64(
kernel::lib ptr_lib,
int64_t* toptr,
const T* fromptr,
int64_t length,
int64_t width);
template <typename C, typename T>
ERROR Identities_from_ListOffsetArray(
kernel::lib ptr_lib,
C* toptr,
const C* fromptr,
const T* fromoffsets,
int64_t tolength,
int64_t fromlength,
int64_t fromwidth);
template <typename C, typename T>
ERROR Identities_from_ListArray(
kernel::lib ptr_lib,
bool* uniquecontents,
C* toptr,
const C* fromptr,
const T* fromstarts,
const T* fromstops,
int64_t tolength,
int64_t fromlength,
int64_t fromwidth);
template <typename ID>
ERROR Identities_from_RegularArray(
kernel::lib ptr_lib,
ID* toptr,
const ID* fromptr,
int64_t size,
int64_t tolength,
int64_t fromlength,
int64_t fromwidth);
template <typename C, typename T>
ERROR Identities_from_IndexedArray(
kernel::lib ptr_lib,
bool* uniquecontents,
C* toptr,
const C* fromptr,
const T* fromindex,
int64_t tolength,
int64_t fromlength,
int64_t fromwidth);
template <typename C, typename T, typename I>
ERROR Identities_from_UnionArray(
kernel::lib ptr_lib,
bool* uniquecontents,
C* toptr,
const C* fromptr,
const T* fromtags,
const I* fromindex,
int64_t tolength,
int64_t fromlength,
int64_t fromwidth,
int64_t which);
template <typename ID>
ERROR Identities_extend(
kernel::lib ptr_lib,
ID* toptr,
const ID* fromptr,
int64_t fromlength,
int64_t tolength);
/////////////////////////////////// awkward/kernels/operations.h
template <typename T>
ERROR ListArray_num_64(
kernel::lib ptr_lib,
int64_t* tonum,
const T* fromstarts,
const T* fromstops,
int64_t length);
ERROR RegularArray_num_64(
kernel::lib ptr_lib,
int64_t* tonum,
int64_t size,
int64_t length);
template <typename T>
ERROR ListOffsetArray_flatten_offsets_64(
kernel::lib ptr_lib,
int64_t* tooffsets,
const T* outeroffsets,
int64_t outeroffsetslen,
const int64_t* inneroffsets,
int64_t inneroffsetslen);
template <typename T>
ERROR IndexedArray_flatten_none2empty_64(
kernel::lib ptr_lib,
int64_t* outoffsets,
const T* outindex,
int64_t outindexlength,
const int64_t* offsets,
int64_t offsetslength);
template <typename T, typename I>
ERROR UnionArray_flatten_length_64(
kernel::lib ptr_lib,
int64_t* total_length,
const T* fromtags,
const I* fromindex,
int64_t length,
int64_t** offsetsraws);
template <typename T, typename I>
ERROR UnionArray_nestedfill_tags_index_64(
kernel::lib ptr_lib,
T* totags,
I* toindex,
int64_t* tmpstarts,
T tag,
const int64_t* fromcounts,
int64_t length);
template <typename T, typename I>
ERROR UnionArray_flatten_combine_64(
kernel::lib ptr_lib,
int8_t* totags,
int64_t* toindex,
int64_t* tooffsets,
const T* fromtags,
const I* fromindex,
int64_t length,
int64_t** offsetsraws);
template <typename T>
ERROR IndexedArray_flatten_nextcarry_64(
kernel::lib ptr_lib,
int64_t* tocarry,
const T* fromindex,
int64_t lenindex,
int64_t lencontent);
template <typename T>
ERROR IndexedArray_overlay_mask8_to64(
kernel::lib ptr_lib,
int64_t* toindex,
const int8_t* mask,
const T* fromindex,
int64_t length);
template <typename T>
ERROR IndexedArray_mask8(
kernel::lib ptr_lib,
int8_t* tomask,
const T* fromindex,
int64_t length);
ERROR ByteMaskedArray_mask8(
kernel::lib ptr_lib,
int8_t* tomask,
const int8_t* frommask,
int64_t length,
bool validwhen);
ERROR zero_mask8(
kernel::lib ptr_lib,
int8_t* tomask,
int64_t length);
ERROR one_mask8(
kernel::lib ptr_lib,
int8_t* tomask,
int64_t length);
template <typename T>
ERROR IndexedArray_simplify32_to64(
kernel::lib ptr_lib,
int64_t* toindex,
const T* outerindex,
int64_t outerlength,
const int32_t* innerindex,
int64_t innerlength);
template <typename T>
ERROR IndexedArray_simplifyU32_to64(
kernel::lib ptr_lib,
int64_t* toindex,
const T* outerindex,
int64_t outerlength,
const uint32_t* innerindex,
int64_t innerlength);
template <typename T>