summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-01-19 17:10:19 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-01-19 17:10:19 +0100
commitda7878360b0b4c58af922b491f5d775a867b191a (patch)
treec71474f620ac1b81a4c42cf8590e81b556cff99f
parent8b3ade73997e9f87f1232b9dc9af35969e6f50dd (diff)
downloadlibs-lbm-da7878360b0b4c58af922b491f5d775a867b191a.tar.gz
Moving the ghost layers
-rw-r--r--default.nix2
-rw-r--r--lib/core/c++/chunk.hpp3
-rw-r--r--lib/sycl/c++/data.hpp25
3 files changed, 19 insertions, 11 deletions
diff --git a/default.nix b/default.nix
index 1befac1..b41c5a8 100644
--- a/default.nix
+++ b/default.nix
@@ -39,7 +39,7 @@ let
forstio = (import ((builtins.fetchTarball {
url = "https://git.keldu.de/forstio-forstio/snapshot/master.tar.gz";
- sha256 = "sha256:19050mb1j4qq9j9y24y0ffhlj997bzn4my2wiprsgml58azf600m";
+ sha256 = "sha256:1l305m2vsm4vxflip9ij9f8q7qbiy85k06kwqi7jwm0b1j23jrin";
}) + "/default.nix"){
inherit stdenv;
inherit clang-tools;
diff --git a/lib/core/c++/chunk.hpp b/lib/core/c++/chunk.hpp
index bfef358..38b567b 100644
--- a/lib/core/c++/chunk.hpp
+++ b/lib/core/c++/chunk.hpp
@@ -32,7 +32,10 @@ using SuperChunk = Array<ChunkSchema,Dim>;
namespace saw {
template<typename Sch, uint64_t Dim, uint64_t Side, uint64_t Ghost, typename Encode>
class data<kel::lbm::sch::Chunk<Sch,Dim,Side,Ghost>,Encode> final {
+public:
+ using Schema = kel::lbm::sch::Chunk<Sch,Dim,Side,Ghost>;
private:
+ data<Schema::InnerSchema, Encode>
public:
};
}
diff --git a/lib/sycl/c++/data.hpp b/lib/sycl/c++/data.hpp
index 67422e2..53a35bc 100644
--- a/lib/sycl/c++/data.hpp
+++ b/lib/sycl/c++/data.hpp
@@ -12,7 +12,7 @@ struct Sycl {
namespace impl {
template<typename Schema>
-struct struct_has_only_equal_dimension_array
+struct struct_has_only_equal_dimension_array{};
}
}
}
@@ -37,9 +37,14 @@ public:
q_{nullptr}
{}
+ data(StorageT members__, kel::lbm::sycl::queue& q__):
+ members_{members__},
+ q_{&q__}
+ {}
+
~data(){
SAW_ASSERT(q_){
- exit(-1);
+ return;
}
std::visit([this](auto arg){
if(not arg){
@@ -61,14 +66,8 @@ public:
SAW_ASSERT(ptr);
return *ptr;
}
-
- void set_queue(kel::lbm::sycl::queue& q){
- q_ = &q;
- }
};
-}
-
namespace kel {
namespace lbm {
namespace impl {
@@ -80,9 +79,11 @@ struct sycl_malloc_struct_helper<sch::Struct<Members...>, Encode> final {
template<uint64_t i>
static saw::error_or<void> allocate_on_device_member(typename data<Sch,encode::Sycl<Encode>>::StorageT& storage, sycl::queue& q){
if constexpr (i < sizeof...(Members)){
+ using M = typename saw::parameter_pack_type<i,Members...>::type;
auto& ptr = std::get<i>(storage);
+ ptr = sycl::malloc_device<M::ValueType::InnerSchema>(,q);
- return allocate_on_device_member<i+1u>(sycl_data,q);
+ return allocate_on_device_member<i+1u>(storage,q);
}
return saw::make_void();
@@ -90,7 +91,11 @@ struct sycl_malloc_struct_helper<sch::Struct<Members...>, Encode> final {
static saw::error_or<void> allocate_on_device(data<Sch,encode::Sycl<Encode>>& sycl_data, sycl::queue& q){
typename data<Sch,encode::Sycl<Encode>>::StorageT storage;
- return allocate_on_device_member<0u>(storage,q);
+
+ auto eov = allocate_on_device_member<0u>(storage,q);
+ sycl_data = {storage, q};
+
+ return eov;
}
};
}