From 271eeee7656240a9845a3393df0e2c88e803f146 Mon Sep 17 00:00:00 2001 From: Quntized Date: Wed, 22 Jul 2026 22:09:43 +0600 Subject: [PATCH 1/3] kokkos view structure hierarchical Signed-off-by: Quntized --- kokkos_tree/kokkos_core/README.md | 0 ...iew_data_analysis_kokkos_investigation.hpp | 57 +++++++++++++++++++ kokkos_tree/test_dyn_rank.cpp | 1 + 3 files changed, 58 insertions(+) create mode 100644 kokkos_tree/kokkos_core/README.md create mode 100644 kokkos_tree/kokkos_core/View_data_analysis_kokkos_investigation.hpp diff --git a/kokkos_tree/kokkos_core/README.md b/kokkos_tree/kokkos_core/README.md new file mode 100644 index 0000000..e69de29 diff --git a/kokkos_tree/kokkos_core/View_data_analysis_kokkos_investigation.hpp b/kokkos_tree/kokkos_core/View_data_analysis_kokkos_investigation.hpp new file mode 100644 index 0000000..6e5849a --- /dev/null +++ b/kokkos_tree/kokkos_core/View_data_analysis_kokkos_investigation.hpp @@ -0,0 +1,57 @@ +#include +#include +//#include + +namespace Test{ + +TEST(ViewDataType,ViewDataType_linefrom251){ + static_assert(std::is_same_v>::type, double>, "ViewDataType>::type should be double"); + static_assert(std::is_same_v>::type, double*>, "ViewDataType>::type should be double*"); + static_assert(std::is_same_v>::type, double**>, "ViewDataType>::type should be double**"); + static_assert(std::is_same_v>::type, double**[5]>, "ViewDataType>::type should be double**[5]"); +} +TEST(ViewArrayAnalysis,ViewArrayAnalysis_line_289){ + static_assert(std::is_same_v::value_type, double>, "ViewArrayAnalysis::value_type should be double"); + static_assert(std::is_same_v::const_value_type, const double>, "ViewArrayAnalysis::const_value_type should be const double"); + static_assert(std::is_same_v::non_const_value_type, double>, "ViewArrayAnalysis::non_const_value_type should be double"); + static_assert(std::is_same_v::static_dimension, Kokkos::Impl::ViewDimension<>>, "ViewArrayAnalysis::static_dimension should be Kokkos::Impl::ViewDimension<>"); + static_assert(std::is_same_v::dynamic_dimension, Kokkos::Impl::ViewDimension<>>, "ViewArrayAnalysis::dynamic_dimension should be Kokkos::Impl::ViewDimension<>"); + static_assert(std::is_same_v::dimension, Kokkos::Impl::ViewDimension<>>, "ViewArrayAnalysis::dimension should be Kokkos::Impl::ViewDimension<>"); + //static_assert(std::is_same_v::nested,Kokkos::Impl::ViewArrayAnalysis>, "ViewArrayAnalysis::nested should be Kokkos::Impl::ViewArrayAnalysis"); this is private can't invoke. + static_assert(std::is_same_v::value_type, double>, "ViewArrayAnalysis::value_type should be double"); + static_assert(std::is_same_v::const_value_type, const double>, "ViewArrayAnalysis::const_value_type should be const double"); + static_assert(std::is_same_v::non_const_value_type, double>, "ViewArrayAnalysis::non_const_value_type should be double"); + static_assert(std::is_same_v::static_dimension, Kokkos::Impl::ViewDimension<5>>, "ViewArrayAnalysis::static_dimension should be Kokkos::Impl::ViewDimension<5>"); + //static_assert(std::is_same_v::dynamic_dimension, Kokkos::Impl::ViewDimension<>>, "ViewArrayAnalysis::dynamic_dimension should be Kokkos::Impl::ViewDimension<>"); + static_assert(Kokkos::Impl::ViewArrayAnalysis::static_dimension::ArgN0 == 5, "ViewArrayAnalysis::static_dimension::ArgN0 should be 5"); + static_assert(std::is_same_v::value_type,double>, "ViewArrayAnalysis::value_type should bematch"); + auto constexpr argn0 = Kokkos::Impl::ViewArrayAnalysis::static_dimension::ArgN0; + auto constexpr argn1 = Kokkos::Impl::ViewArrayAnalysis::static_dimension::ArgN1; + auto constexpr argn2 = Kokkos::Impl::ViewArrayAnalysis::static_dimension::ArgN2; + auto constexpr rank = Kokkos::Impl::ViewArrayAnalysis::static_dimension::rank; + auto constexpr rank_dyn = Kokkos::Impl::ViewArrayAnalysis::static_dimension::rank_dynamic; + std::cout<<"ArgN0 " <; + auto constexpr dargn0 = vaa::dynamic_dimension::ArgN0; + std::cout<<"Dynamic argn0 "<; + auto constexpr mdargn0 = mvaa::dynamic_dimension::ArgN0; + auto constexpr mdargn1 = mvaa::dynamic_dimension::ArgN1; + auto constexpr mdargn2 = mvaa::dynamic_dimension::ArgN2; + auto constexpr mdrank = mvaa::dynamic_dimension::rank; + auto constexpr mdrankdyn = mvaa::dynamic_dimension::rank_dynamic; + std::cout<<"mdArgN0 " < #include int main(int argc, char **argv) { From 014c909995728df2793cdca7ed586bcb345bf3ff Mon Sep 17 00:00:00 2001 From: Quntized Date: Thu, 23 Jul 2026 01:41:59 +0600 Subject: [PATCH 2/3] Checked if this two eq/not Signed-off-by: Quntized --- .../kokkos_core/View_data_analysis_kokkos_investigation.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kokkos_tree/kokkos_core/View_data_analysis_kokkos_investigation.hpp b/kokkos_tree/kokkos_core/View_data_analysis_kokkos_investigation.hpp index 6e5849a..4fca69e 100644 --- a/kokkos_tree/kokkos_core/View_data_analysis_kokkos_investigation.hpp +++ b/kokkos_tree/kokkos_core/View_data_analysis_kokkos_investigation.hpp @@ -50,8 +50,8 @@ TEST(ViewArrayAnalysis,ViewArrayAnalysis_line_289){ std::cout<<"mdArgN2 " <::dynamic_dimension,Kokkos::Impl::ViewDimension<0,0,0>>, "ViewArrayAnalysis::dynamic_dimension should be Kokkos::Impl::ViewDimension<0,0,0>"); + static_assert(std::is_same_v::dynamic_dimension,Kokkos::Impl::ViewArrayAnalysis::dimension>, "ViewArrayAnalysis::dynamic_dimension should be Kokkos::Impl::ViewArrayAnalysis::dimension"); } } \ No newline at end of file From 8991fe76997f2d6f26b26c84fb969d591cc9396c Mon Sep 17 00:00:00 2001 From: Quntized Date: Fri, 24 Jul 2026 00:00:32 +0600 Subject: [PATCH 3/3] mdspan some investigation on extent , maybe_static_extent and stuff Signed-off-by: Quntized --- kokkos_tree/mdspan/README.md | 0 kokkos_tree/mdspan/kokkos_extent_inv.hpp | 43 ++++++++++++++++++++++++ kokkos_tree/test_dyn_rank.cpp | 1 + 3 files changed, 44 insertions(+) create mode 100644 kokkos_tree/mdspan/README.md create mode 100644 kokkos_tree/mdspan/kokkos_extent_inv.hpp diff --git a/kokkos_tree/mdspan/README.md b/kokkos_tree/mdspan/README.md new file mode 100644 index 0000000..e69de29 diff --git a/kokkos_tree/mdspan/kokkos_extent_inv.hpp b/kokkos_tree/mdspan/kokkos_extent_inv.hpp new file mode 100644 index 0000000..4e563ca --- /dev/null +++ b/kokkos_tree/mdspan/kokkos_extent_inv.hpp @@ -0,0 +1,43 @@ +#include + + +using ext = MDSPAN_IMPL_STANDARD_NAMESPACE::extents; +namespace Test { + +TEST(extent_inv, extent_line_376){ + static_assert(std::is_same_v,"index_type is not int"); + static_assert(std::is_same_v,"rank_type is not size_t"); + auto constexpr rank = ext::rank(); + static_assert(rank == 3,"rank is not 3"); + auto constexpr drank = ext::rank_dynamic(); + static_assert(drank == 0,"dynamic rank is not 0"); + using dext = MDSPAN_IMPL_STANDARD_NAMESPACE::extents; + auto constexpr drank2 = dext::rank_dynamic(); + static_assert(drank2 == 1,"dynamic rank is not 1"); + using msa = MDSPAN_IMPL_STANDARD_NAMESPACE::detail::maybe_static_array; + static_assert(std::is_same_v,"value_type is not int"); + static_assert(std::is_same_v,"static_value_type is not size_t"); + static_assert(msa::tag_value == MDSPAN_IMPL_STANDARD_NAMESPACE::dynamic_extent,"tag_value is not dynamic_extent"); + msa m1(23); + std::array d_rank = {4}; + msa m2(d_rank); + auto m1_static = m1.static_value(0); + EXPECT_EQ(m1_static,2); + auto m2_dynamic = m2.value(3); + std::cout<<"m2_dynamic: "<; + static_assert(extent::rank() == 4,"rank is not 4"); + static_assert(extent::rank_dynamic() == 1,"dynamic rank is not 1"); + //static_assert(extent::extent(0) == 2,"extent(0) is not 2"); + ///static_assert(extent::extent(3) == 0,"extent(3) is not 3"); as non static; + extent ex; + EXPECT_EQ(ex.extent(0),2); + EXPECT_EQ(ex.extent(1),3); + EXPECT_EQ(ex.extent(2),4); + EXPECT_EQ(ex.extent(3),0); + static_assert(extent::static_extent(0) == 2,"extent(0) is not 2"); +} +} \ No newline at end of file diff --git a/kokkos_tree/test_dyn_rank.cpp b/kokkos_tree/test_dyn_rank.cpp index 4b5d5cf..54965f8 100644 --- a/kokkos_tree/test_dyn_rank.cpp +++ b/kokkos_tree/test_dyn_rank.cpp @@ -3,6 +3,7 @@ #include "mdspan/kokkos_raw_mdspan.hpp" #include "kokkos_core/test_drank.hpp" #include "kokkos_core/View_data_analysis_kokkos_investigation.hpp" +#include "mdspan/kokkos_extent_inv.hpp" #include #include int main(int argc, char **argv) {