Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor various indexing views #275

Merged
merged 56 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c87a21f
simplify dtypes def
alifahrri May 1, 2024
06f9e74
quick workaround for cyclic includes in as_static
alifahrri May 1, 2024
f61504f
handle maybe type in size & shape
alifahrri May 1, 2024
2fb2fa1
simplify atleas_nd functors
alifahrri May 1, 2024
f9ceda9
refactor get operands, get_compute_graph to handle maybe type
alifahrri May 1, 2024
7ea4c6e
refactor various index utility to handle maybe type
alifahrri May 1, 2024
db4c670
refactor alias view to handle maybe type
alifahrri May 1, 2024
7ce6451
refactor atleast_nd to use reshape view
alifahrri May 1, 2024
ef24339
support maybe type for broadcast_to view
alifahrri May 1, 2024
a98575d
refactor flatten view to use indexing view
alifahrri May 1, 2024
b704156
handle maybe type for indexing view, add lift_indexing helper fn
alifahrri May 1, 2024
27edf01
refactor reshape view to use indexing view
alifahrri May 1, 2024
94ed4b4
handle maybe type for resize view
alifahrri May 1, 2024
82be848
handle maybe type for sliding window
alifahrri May 1, 2024
c92c4c8
handle maybe type for tile view
alifahrri May 1, 2024
c08f6b2
handle maybe type for transpose view
alifahrri May 1, 2024
a088503
handle maybe type for various ufuncs
alifahrri May 1, 2024
9a32cc5
update ufunc view to explicitly use broadcast_binary_ufunc
alifahrri May 1, 2024
ab7c787
add various type_traits metafunctions
alifahrri May 1, 2024
bb7d58b
update tests
alifahrri May 1, 2024
af92169
update utility functions: fwd, isequal, to_string
alifahrri May 1, 2024
d281f21
update utl maybe
alifahrri May 1, 2024
f145630
update devcontainer
alifahrri May 4, 2024
3b360f6
temporarily disable broken tests
alifahrri May 4, 2024
d2ec7a4
support fwd_attribute for maybe type
alifahrri May 4, 2024
f03e19c
avoid triggering gcc error
alifahrri May 4, 2024
2f6613b
handle maybe type for len
alifahrri May 5, 2024
7e18af2
fix tests
alifahrri May 5, 2024
92a45e3
fix isequal comparison of maybe with nothing type
alifahrri May 5, 2024
d9d1bea
fix simd tests build
alifahrri May 5, 2024
508650d
add more compiler builtins
alifahrri May 9, 2024
8b76df6
fix reshape for constexpr
alifahrri May 9, 2024
f74d208
add is_trivially_copy_constructible trait metafunction
alifahrri May 9, 2024
f305249
move atleast_{1,2,3}d constexpr tests data to separate dir
alifahrri May 9, 2024
168d494
add unwrap return type resolver
alifahrri May 9, 2024
fc7af37
handle maybe indexer type on indexing function
alifahrri May 9, 2024
7d7efb7
fix utl either for constexpr
alifahrri May 9, 2024
8241f00
add constexpr tests as separate build targets, fix various tests
alifahrri May 9, 2024
3b3ad3c
rename NMTOOLS_TESTING_CONSTEXPR to NMTOOLS_BUILD_CONSTEXPR_TESTS
alifahrri May 9, 2024
41505d7
revert test macro rename
alifahrri May 9, 2024
ca24c30
fix constexpr executable names on ci
alifahrri May 9, 2024
93bd386
fix indexing bounded size inference
alifahrri May 9, 2024
9239805
add tests to ctest
alifahrri May 9, 2024
0fd5627
try to fix tests
alifahrri May 11, 2024
4ab218f
try to fix tests
alifahrri May 11, 2024
b170c69
support unwrap for mutable arg
alifahrri May 11, 2024
7074e31
fix meta builtins for clang >= 15
alifahrri May 11, 2024
e2162f6
try to fix simde avx512
alifahrri May 11, 2024
4c00b82
avoid redefinition
alifahrri May 11, 2024
f89260e
revert is_trivially_destructible trait metafunction
alifahrri May 12, 2024
0b21749
fix sycl compilation
alifahrri May 12, 2024
f63fe27
fix flatten to_string
alifahrri May 12, 2024
85d7900
skip outer_nd simde tests on gcc
alifahrri May 12, 2024
c158b69
fix gcc werror
alifahrri May 12, 2024
678173c
temporarily disable arduino ci
alifahrri May 12, 2024
00c29f4
fix gcc werror
alifahrri May 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"build": {
"args": {
"USERNAME": "${localEnv:USER}",
"BASE": "nvidia/cuda:11.8.0-devel-ubuntu22.04"
"BASE": "ubuntu:22.04"
},
"target": "dev"
},
Expand All @@ -66,7 +66,8 @@

// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined", "--env=DISPLAY", "--env=QT_X11_NO_MITSHM=1", "--network=host" ],
"runArgs": [ "--privileged=true", "--security-opt", "seccomp=unconfined", "--env=DISPLAY", "--env=QT_X11_NO_MITSHM=1", "--network=host", "--gpus=all", "--device=/dev/dri:/dev/dri"],
// "runArgs": [ "--privileged=true", "--security-opt", "seccomp=unconfined", "--env=DISPLAY", "--env=QT_X11_NO_MITSHM=1", "--network=host", "--gpus=all", "--device=/dev/dri:/dev/dri"],
"runArgs": [ "--privileged=true", "--security-opt", "seccomp=unconfined", "--network=host"],

// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
"mounts": [ "source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind" ],
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/arduino-platformio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:

strategy:
matrix:
test: [ufuncs, meta, utl]
test: []
# TODO: re-enable arduino tests
# test: [ufuncs, meta, utl]
# TODO: re-enable manip & constexpr tests
# test: [manip, ufuncs, meta, utl, constexpr]

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ jobs:
- name: setup doctest
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DCMAKE_TOOLCHAIN_FILE=${PWD}/../../cmake/toolchains/clang.cmake -DNMTOOLS_TESTING_CONSTEXPR=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON ../.. && make -j2 VERBOSE=1'
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DCMAKE_TOOLCHAIN_FILE=${PWD}/../../cmake/toolchains/clang.cmake -DNMTOOLS_BUILD_CONSTEXPR_TESTS=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON ../.. && make -j2 VERBOSE=1'
- name: run tests
run: |
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/array/numeric-tests-doctest'
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/constexpr/numeric-tests-constexpr-doctest'

dockcross-clang-constexpr-no-stl-generic-ndarray-eval:
name: ${{ matrix.name }}-constexpr-no-stl-generic-ndarray-eval
Expand All @@ -251,10 +251,10 @@ jobs:
- name: setup doctest
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DCMAKE_TOOLCHAIN_FILE=${PWD}/../../cmake/toolchains/clang.cmake -DNMTOOLS_TESTING_CONSTEXPR=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=ON ../.. && make -j2 VERBOSE=1'
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DCMAKE_TOOLCHAIN_FILE=${PWD}/../../cmake/toolchains/clang.cmake -DNMTOOLS_BUILD_CONSTEXPR_TESTS=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=ON ../.. && make -j2 VERBOSE=1'
- name: run tests
run: |
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/array/numeric-tests-doctest'
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/constexpr/numeric-tests-constexpr-doctest'

dockcross-clang-constexpr-generic-ndarray-eval:
name: ${{ matrix.name }}-constexpr-generic-ndarray-eval
Expand All @@ -275,7 +275,7 @@ jobs:
- name: setup doctest
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DCMAKE_TOOLCHAIN_FILE=${PWD}/../../cmake/toolchains/clang.cmake -DNMTOOLS_TESTING_CONSTEXPR=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=OFF ../.. && make -j2 VERBOSE=1'
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DCMAKE_TOOLCHAIN_FILE=${PWD}/../../cmake/toolchains/clang.cmake -DNMTOOLS_BUILD_CONSTEXPR_TESTS=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=OFF ../.. && make -j2 VERBOSE=1'
- name: run tests
run: |
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/array/numeric-tests-doctest'
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/constexpr/numeric-tests-constexpr-doctest'
6 changes: 3 additions & 3 deletions .github/workflows/gcc-9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- name: setup doctest
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: mkdir -p build/ && cd build/ && cmake -DNMTOOLS_TESTING_CONSTEXPR=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON .. && make -j2 VERBOSE=1
run: mkdir -p build/ && cd build/ && cmake -DNMTOOLS_BUILD_CONSTEXPR_TESTS=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON .. && make -j2 VERBOSE=1
- name: run tests
run: |
build/tests/array/numeric-tests-doctest
Expand All @@ -82,7 +82,7 @@ jobs:
- name: setup doctest
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: mkdir -p build/ && cd build/ && cmake -DNMTOOLS_TESTING_CONSTEXPR=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=OFF .. && make -j2 VERBOSE=1
run: mkdir -p build/ && cd build/ && cmake -DNMTOOLS_BUILD_CONSTEXPR_TESTS=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=OFF .. && make -j2 VERBOSE=1
- name: run tests
run: |
build/tests/array/numeric-tests-doctest
Expand All @@ -100,7 +100,7 @@ jobs:
- name: setup doctest
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: mkdir -p build/ && cd build/ && cmake -DNMTOOLS_TESTING_CONSTEXPR=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=ON .. && make -j2 VERBOSE=1
run: mkdir -p build/ && cd build/ && cmake -DNMTOOLS_BUILD_CONSTEXPR_TESTS=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=ON .. && make -j2 VERBOSE=1
- name: run tests
run: |
build/tests/array/numeric-tests-doctest
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ jobs:
- name: setup doctest
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_TESTING_CONSTEXPR=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON ../.. && make -j2 VERBOSE=1'
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_BUILD_CONSTEXPR_TESTS=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON ../.. && make -j2 VERBOSE=1'
- name: run tests
run: |
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/array/numeric-tests-doctest'
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/constexpr/numeric-tests-constexpr-doctest'

dockcross-gcc-constexpr-no-stl-generic-ndarray-eval:
name: ${{ matrix.name }}-constexpr-no-stl-generic-ndarray-eval
Expand All @@ -256,10 +256,10 @@ jobs:
- name: setup doctest
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_TESTING_CONSTEXPR=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=ON ../.. && make -j2 VERBOSE=1'
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_BUILD_CONSTEXPR_TESTS=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=ON ../.. && make -j2 VERBOSE=1'
- name: run tests
run: |
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/array/numeric-tests-doctest'
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/constexpr/numeric-tests-constexpr-doctest'

dockcross-gcc-constexpr-generic-ndarray-eval:
name: ${{ matrix.name }}-constexpr-generic-ndarray-eval
Expand All @@ -280,7 +280,7 @@ jobs:
- name: setup doctest
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_TESTING_CONSTEXPR=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=OFF ../.. && make -j2 VERBOSE=1'
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_BUILD_CONSTEXPR_TESTS=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=OFF ../.. && make -j2 VERBOSE=1'
- name: run tests
run: |
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/array/numeric-tests-doctest'
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/constexpr/numeric-tests-constexpr-doctest'
6 changes: 3 additions & 3 deletions .github/workflows/web-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ jobs:
- name: build
run: |
./dockcross-${{ matrix.name }} bash -c "emcc -v"
./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_TESTING_CONSTEXPR=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON ../.. && make -j2 VERBOSE=1'
./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_BUILD_CONSTEXPR_TESTS=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON ../.. && make -j2 VERBOSE=1'
- name: run tests
run: ./dockcross-${{ matrix.name }} node build/${{ matrix.name }}/tests/array/numeric-tests-doctest.js

Expand Down Expand Up @@ -237,7 +237,7 @@ jobs:
- name: build
run: |
./dockcross-${{ matrix.name }} bash -c "emcc -v"
./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_TESTING_CONSTEXPR=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=OFF ../.. && make -j2 VERBOSE=1'
./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_BUILD_CONSTEXPR_TESTS=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=OFF ../.. && make -j2 VERBOSE=1'
- name: run tests
run: ./dockcross-${{ matrix.name }} node build/${{ matrix.name }}/tests/array/numeric-tests-doctest.js

Expand Down Expand Up @@ -278,6 +278,6 @@ jobs:
- name: build
run: |
./dockcross-${{ matrix.name }} bash -c "emcc -v"
./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_TESTING_CONSTEXPR=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=ON ../.. && make -j2 VERBOSE=1'
./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_BUILD_CONSTEXPR_TESTS=ON -DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF -DNMTOOLS_TEST_ARRAY_EVAL=ON -DNMTOOLS_TESTING_GENERIC_NDARRAY=ON -DNMTOOLS_TESTING_NOSTL=ON ../.. && make -j2 VERBOSE=1'
- name: run tests
run: ./dockcross-${{ matrix.name }} node build/${{ matrix.name }}/tests/array/numeric-tests-doctest.js
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions include/nmtools/array/as_static.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#include "nmtools/utility/fwd.hpp"
#include "nmtools/array/shape.hpp"
#include "nmtools/utility/forward.hpp"
#include "nmtools/array/ndarray.hpp" // for nmtools_static_vector
// #include "nmtools/array/ndarray.hpp" // for nmtools_static_vector
#include "nmtools/utl/static_vector.hpp"

namespace nmtools::array
{
Expand All @@ -20,7 +21,7 @@ namespace nmtools::array
{
if constexpr (meta::is_dynamic_index_array_v<attribute_type>) {
using element_type = meta::get_element_type_t<attribute_t>;
using result_type = nmtools_static_vector<element_type,max_dim>;
using result_type = utl::static_vector<element_type,max_dim>;
auto result = result_type{};
result.resize(attribute.size());
for (size_t i=0; i<len(result); i++) {
Expand Down
19 changes: 8 additions & 11 deletions include/nmtools/array/eval/kernel_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,12 @@ namespace nmtools::array
return array;
}

template <typename type, typename shape_type>
nmtools_func_attribute
auto create_mutable_array(type* data_ptr, const shape_type& shape)
{
const auto numel = index::product(shape);

auto ref = view::mutable_ref(data_ptr,numel);
return view::reshape(ref,shape);
}

template <auto DIM=0, typename dim_type=nm_index_t, typename size_type=nm_index_t, typename type>
nmtools_func_attribute
auto create_mutable_array(type* data_ptr, const size_type* shape_ptr, dim_type dim)
{
const auto shape = create_vector<DIM>(shape_ptr,dim);
return create_mutable_array(data_ptr,shape);
return device_array(data_ptr,shape,dim);
}

template <typename size_type=nm_size_t>
Expand Down Expand Up @@ -182,12 +172,19 @@ namespace nmtools::array
return;
}
assign_result(output,*result,thread_id,block_id,block_size);
} else if constexpr (meta::is_maybe_v<mutable_array_t>) {
if (!static_cast<bool>(output)) {
return;
}
assign_result(*output,result,thread_id,block_id,block_size);
} else {
auto size = nmtools::size(output);
auto idx = compute_offset(thread_id,block_id,block_size);
if (idx < size) {
auto flat_lhs = view::mutable_flatten(output);
auto flat_rhs = view::flatten(result);
static_assert( !meta::is_maybe_v<decltype(flat_lhs)> );
static_assert( !meta::is_maybe_v<decltype(flat_rhs)> );
const auto rhs = flat_rhs(idx);
auto& lhs = flat_lhs(idx);
lhs = rhs;
Expand Down
12 changes: 6 additions & 6 deletions include/nmtools/array/eval/simd/evaluator/ufunc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ namespace nmtools::array
const auto reduction_kind = meta::as_type_v<ReductionKind::VERTICAL>;
const auto enumerator = index::reduction_2d_enumerator(reduction_kind,n_elem_pack,out_shape,inp_shape,reduction_axis);
for (size_t i=0; i<enumerator.size(); i++) {
auto [out_pack, inp_pack] = enumerator[i];
auto [out_tag,out_offset] = out_pack;
auto [inp_tag,inp_offset] = inp_pack;
const auto [out_pack, inp_pack] = enumerator[i];
const auto [out_tag,out_offset] = out_pack;
const auto [inp_tag,inp_offset] = inp_pack;
switch (out_tag) {
case SIMD::ACCUMULATE_PACKED: {
auto inp_pack = op.loadu(&inp_data_ptr[inp_offset]);
auto out_pack = op.loadu(&out_data_ptr[out_offset]);
auto tmp = op.eval(out_pack,inp_pack);
const auto inp_pack = op.loadu(&inp_data_ptr[inp_offset]);
const auto out_pack = op.loadu(&out_data_ptr[out_offset]);
const auto tmp = op.eval(out_pack,inp_pack);
op.storeu(&out_data_ptr[out_offset],tmp);
} break;
case SIMD::ACCUMULATE: {
Expand Down
10 changes: 5 additions & 5 deletions include/nmtools/array/eval/simd/index/matmul.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ namespace nmtools::index
const auto res_l = lhs_offset + (inner_step * N_ELEM_PACK);
const auto res_r = rhs_offset + (inner_step * N_ELEM_PACK);

const auto tag_l = ((inner_step * N_ELEM_PACK + N_ELEM_PACK) <= n_fmadd) ? SIMD::PACKED : static_cast<SIMD>(N_ELEM_PACK - n_rest);
const auto tag_r = ((inner_step * N_ELEM_PACK + N_ELEM_PACK) <= n_fmadd) ? SIMD::PACKED : static_cast<SIMD>(N_ELEM_PACK - n_rest);
const auto tag_l = (nm_size_t(inner_step * N_ELEM_PACK + N_ELEM_PACK) <= nm_size_t(n_fmadd)) ? SIMD::PACKED : static_cast<SIMD>(N_ELEM_PACK - n_rest);
const auto tag_r = (nm_size_t(inner_step * N_ELEM_PACK + N_ELEM_PACK) <= nm_size_t(n_fmadd)) ? SIMD::PACKED : static_cast<SIMD>(N_ELEM_PACK - n_rest);

auto result = result_t{};
at(result,0) = tagged_index_t{SIMD::SCALAR,out_offset};
at(result,1) = tagged_index_t{tag_l,res_l};
at(result,2) = tagged_index_t{tag_r,res_r};
at(result,0) = tagged_index_t{SIMD::SCALAR,static_cast<index_t>(out_offset)};
at(result,1) = tagged_index_t{tag_l,static_cast<index_t>(res_l)};
at(result,2) = tagged_index_t{tag_r,static_cast<index_t>(res_r)};

return result;
}
Expand Down
Loading
Loading