Skip to content

Commit

Permalink
Merge branch 'main' into ManasviGoyal/segmented_scan
Browse files Browse the repository at this point in the history
  • Loading branch information
ManasviGoyal authored Mar 27, 2024
2 parents a59c385 + 8498b2d commit 2ee57a9
Show file tree
Hide file tree
Showing 118 changed files with 2,708 additions and 1,064 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
additional_dependencies: [pyyaml]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.3.4
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -48,7 +48,7 @@ repos:
exclude: .pre-commit-config.yaml

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.9.0.6"
rev: "v0.10.0.1"
hooks:
- id: shellcheck

Expand All @@ -68,7 +68,7 @@ repos:
args: ["--verbose"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
files: src
Expand Down
2 changes: 1 addition & 1 deletion awkward-cpp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build-backend = "scikit_build_core.build"

[project]
name = "awkward_cpp"
version = "30"
version = "31"
dependencies = [
"numpy>=1.18.0,<2.0",
"importlib_resources;python_version < \"3.9\""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,36 @@

template <typename T>
ERROR awkward_NumpyArray_pad_zero_to_length(
const T* fromptr,
const int64_t* fromoffsets,
int64_t offsetslength,
int64_t target,
T* toptr) {
int64_t l_to_char = 0;
const T* fromptr,
const int64_t* fromoffsets,
int64_t offsetslength,
int64_t target,
T* toptr) {
int64_t l_to_char = 0;

// For each sublist
for (auto k_sublist = 0; k_sublist < offsetslength-1; k_sublist++) {
// Copy from src to dst
for (int64_t j_from_char=fromoffsets[k_sublist]; j_from_char<fromoffsets[k_sublist+1]; j_from_char++) {
toptr[l_to_char++] = fromptr[j_from_char];
}
// Pad to remaining width
auto n_to_pad = target - (fromoffsets[k_sublist+1] - fromoffsets[k_sublist]);
for (int64_t j_from_char=0; j_from_char<n_to_pad; j_from_char++){
toptr[l_to_char++] = 0;
}
// For each sublist
for (auto k_sublist = 0; k_sublist < offsetslength - 1; k_sublist++) {
// Copy from src to dst
for (int64_t j_from_char = fromoffsets[k_sublist]; j_from_char < fromoffsets[k_sublist + 1]; j_from_char++) {
toptr[l_to_char++] = fromptr[j_from_char];
}
// Pad to remaining width
auto n_to_pad = target - (fromoffsets[k_sublist + 1] - fromoffsets[k_sublist]);
for (int64_t j_from_char = 0; j_from_char < n_to_pad; j_from_char++){
toptr[l_to_char++] = 0;
}
}

return success();
return success();
}

ERROR awkward_NumpyArray_pad_zero_to_length_uint8(
const uint8_t* fromptr,
const int64_t* fromoffsets,
int64_t offsetslength,
int64_t target,
uint8_t* toptr) {
return awkward_NumpyArray_pad_zero_to_length<uint8_t>(
const uint8_t* fromptr,
const int64_t* fromoffsets,
int64_t offsetslength,
int64_t target,
uint8_t* toptr) {
return awkward_NumpyArray_pad_zero_to_length<uint8_t>(
fromptr,
fromoffsets,
offsetslength,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

ERROR awkward_NumpyArray_prepare_utf8_to_utf32_padded(
const uint8_t *fromptr,
const int64_t *fromoffsets,
int64_t offsetslength,
int64_t *outmaxcodepoints) {
const int64_t *fromoffsets,
int64_t offsetslength,
int64_t *outmaxcodepoints) {

*outmaxcodepoints = 0;
int64_t i_code_unit = fromoffsets[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@

template <typename FROM, typename TO>
ERROR
awkward_NumpyArray_rearrange_shifted(TO* toptr,
const FROM* shifts,
int64_t length,
const FROM* offsets,
int64_t offsetslength,
const FROM* parents,
int64_t /* parentslength */, // FIXME: these arguments are not needed
const FROM* starts,
int64_t /* startslength */) {
awkward_NumpyArray_rearrange_shifted(
TO* toptr,
const FROM* shifts,
int64_t length,
const FROM* offsets,
int64_t offsetslength,
const FROM* parents,
int64_t /* parentslength */, // FIXME: these arguments are not needed
const FROM* starts,
int64_t /* startslength */) {
int64_t k = 0;
for (int64_t i = 0; i < offsetslength - 1; i++) {
for (int64_t j = 0; j < offsets[i + 1] - offsets[i]; j++) {
Expand All @@ -31,15 +32,16 @@ awkward_NumpyArray_rearrange_shifted(TO* toptr,
return success();
}
ERROR
awkward_NumpyArray_rearrange_shifted_toint64_fromint64(int64_t* toptr,
const int64_t* fromshifts,
int64_t length,
const int64_t* fromoffsets,
int64_t offsetslength,
const int64_t* fromparents,
int64_t parentslength,
const int64_t* fromstarts,
int64_t startslength) {
awkward_NumpyArray_rearrange_shifted_toint64_fromint64(
int64_t* toptr,
const int64_t* fromshifts,
int64_t length,
const int64_t* fromoffsets,
int64_t offsetslength,
const int64_t* fromparents,
int64_t parentslength,
const int64_t* fromstarts,
int64_t startslength) {
return awkward_NumpyArray_rearrange_shifted<int64_t, int64_t>(
toptr, fromshifts, length, fromoffsets, offsetslength, fromparents, parentslength, fromstarts, startslength);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

template <typename T>
ERROR awkward_NumpyArray_subrange_equal(
T* tmpptr,
const int64_t* fromstarts,
const int64_t* fromstops,
int64_t length,
bool* toequal) {
T* tmpptr,
const int64_t* fromstarts,
const int64_t* fromstops,
int64_t length,
bool* toequal) {

bool differ = true;
int64_t leftlen;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#include "awkward/kernels.h"

ERROR awkward_NumpyArray_unique_strings_uint8(
uint8_t* toptr,
const int64_t* offsets,
int64_t offsetslength,
int64_t* outoffsets,
int64_t* tolength) {
uint8_t* toptr,
const int64_t* offsets,
int64_t offsetslength,
int64_t* outoffsets,
int64_t* tolength) {

int64_t slen = 0;
int64_t index = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

ERROR awkward_NumpyArray_utf8_to_utf32_padded(
const uint8_t *fromptr,
const int64_t *fromoffsets,
int64_t offsetslength,
int64_t maxcodepoints,
uint32_t *toptr) {
const int64_t *fromoffsets,
int64_t offsetslength,
int64_t maxcodepoints,
uint32_t *toptr) {

int64_t i_code_unit = fromoffsets[0];
int64_t code_point_width;
Expand Down
8 changes: 7 additions & 1 deletion dev/generate-kernel-signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"awkward_missing_repeat",
"awkward_ListArray_getitem_jagged_apply",
"awkward_RegularArray_getitem_jagged_expand",
"awkward_ListArray_combinations_length",
"awkward_ListArray_getitem_jagged_carrylen",
"awkward_ListArray_getitem_jagged_descend",
"awkward_ListArray_getitem_jagged_expand",
Expand All @@ -64,9 +65,11 @@
"awkward_ListArray_getitem_next_at",
"awkward_ListArray_getitem_next_range_counts",
"awkward_ListArray_rpad_and_clip_length_axis1",
"awkward_ListArray_rpad_axis1",
"awkward_ListOffsetArray_reduce_nonlocal_nextstarts_64",
"awkward_ListArray_getitem_next_range_spreadadvanced",
"awkward_ListArray_localindex",
"awkward_NumpyArray_pad_zero_to_length",
"awkward_NumpyArray_reduce_adjust_starts_64",
"awkward_NumpyArray_reduce_adjust_starts_shifts_64",
"awkward_RegularArray_getitem_next_at",
Expand All @@ -80,6 +83,7 @@
"awkward_index_rpad_and_clip_axis0",
"awkward_index_rpad_and_clip_axis1",
"awkward_IndexedArray_flatten_nextcarry",
"awkward_IndexedArray_flatten_none2empty",
"awkward_IndexedArray_getitem_nextcarry",
"awkward_IndexedArray_getitem_nextcarry_outindex",
"awkward_IndexedArray_index_of_nulls",
Expand All @@ -89,10 +93,11 @@
"awkward_IndexedArray_reduce_next_nonlocal_nextshifts_64",
"awkward_IndexedArray_reduce_next_nonlocal_nextshifts_fromshifts_64",
"awkward_IndexedOptionArray_rpad_and_clip_mask_axis1",
"awkward_ListOffsetArray_local_preparenext_64",
"awkward_ListOffsetArray_rpad_and_clip_axis1",
"awkward_ListOffsetArray_rpad_length_axis1",
"awkward_ListOffsetArray_toRegularArray",
# "awkward_ListOffsetArray_rpad_axis1",
"awkward_ListOffsetArray_rpad_axis1",
"awkward_MaskedArray_getitem_next_jagged_project",
"awkward_UnionArray_project",
"awkward_ListOffsetArray_drop_none_indexes",
Expand All @@ -112,6 +117,7 @@
"awkward_reduce_sum_bool",
"awkward_reduce_prod_bool",
"awkward_reduce_countnonzero",
"awkward_sorting_ranges",
"awkward_sorting_ranges_length",
]

Expand Down
Loading

0 comments on commit 2ee57a9

Please sign in to comment.