Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
inst_layout.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Stanford University, NVIDIA Corporation
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18// Layout descriptors for Realm RegionInstances
19
20#ifndef REALM_INST_LAYOUT_H
21#define REALM_INST_LAYOUT_H
22
23#include "realm/indexspace.h"
24#include "realm/serialize.h"
25
26#if defined(REALM_USE_KOKKOS)
27// we don't want to include Kokkos_View.hpp because it brings in too much
28// other stuff, so forward declare the pieces we need to define a templated
29// conversion from Realm accessor to Kokkos::View (anything that actually
30// instantiates the template will presumably have included Kokkos_View.hpp
31// in its full glory)
32namespace Kokkos {
33 template <class, class...>
34 class View;
35 template <unsigned>
36 struct MemoryTraits;
37 struct LayoutStride;
38 template <class, size_t, class>
39 struct Array;
40 namespace Experimental {
41 template <class, class...>
42 class OffsetView;
43 };
44}; // namespace Kokkos
45// Kokkos::Unmanaged is an enum, which we can't forward declare - we'll test
46// that we have the right value in the template though
47enum
48{
49 Kokkos_Unmanaged = 0x01
50};
51
52#define REALM_PROVIDE_ACCESSOR_TO_KOKKOS_VIEW_CONVERSION
53#endif
54
55#include <vector>
56#include <map>
57#include <iostream>
58
65namespace Realm {
66
73 public:
75 InstanceLayoutConstraints(const std::map<FieldID, size_t> &field_sizes,
76 size_t block_size);
77 InstanceLayoutConstraints(const std::vector<size_t> &field_sizes, size_t block_size);
78 InstanceLayoutConstraints(const std::vector<FieldID> &field_ids,
79 const std::vector<size_t> &field_sizes, size_t block_size);
80 InstanceLayoutConstraints(const FieldID *field_ids, const size_t *field_sizes,
81 size_t num_fields, size_t block_size);
82
83 struct FieldInfo {
86 size_t offset; // used if `fixed_offset` is true
87 size_t size;
88 size_t alignment;
89 };
90 typedef std::vector<FieldInfo> FieldGroup;
91
92 std::vector<FieldGroup> field_groups;
93 };
94
95 namespace PieceLookup {
96
98 public:
99 virtual ~CompiledProgram() {}
100
101 // used during compilation to request memory to store instructions
102 // in - can only be used once
103 virtual void *allocate_memory(size_t bytes) = 0;
104
105 // after any changes to the contents of the memory, this must be
106 // called to ensure all devices see the changes
107 virtual void commit_updates() = 0;
108
114
115 std::map<FieldID, PerField> fields;
116 atomic<bool> is_compiled{false};
117 };
118
119 // this is a namespace instead of an enum so that it can be extended elsewhere
120 namespace Opcodes {
121 typedef unsigned char Opcode;
122
123 static const Opcode OP_INVALID = 0;
124 static const Opcode OP_SPLIT1 = 1; // this is a SplitPlane<N,T>
125 } // namespace Opcodes
126
127 // some processors are limited in which instruction types they can
128 // support, so we build masks to describe usage/capabilities
129 static const unsigned ALLOW_SPLIT1 = 1U << Opcodes::OP_SPLIT1;
130
132 // all instructions are at least 4 bytes and aligned to 16 bytes, but
133 // the only data common to all is the opcode, which appears in the low
134 // 8 bits
135 REALM_ALIGNED_TYPE_CONST(uint32_aligned_16, uint32_t, 16);
136 uint32_aligned_16 data;
137
138 Instruction(uint32_t _data);
139
142
143 // two helper methods that get you to another instruction
144
145 // skip() gets the next instruction in sequence, which requires knowing
146 // the size of the current instruction - instructions below take care
147 // of this in most cases
149 const Instruction *skip(size_t bytes) const;
150
151 // jump(N) jumps forward in the instruction stream by N 16-B chunks
152 // special case: a delta of 0 is "end of program" and returns null
154 const Instruction *jump(unsigned delta) const;
155 };
156
157 }; // namespace PieceLookup
158
165 protected:
166 // cannot be created directly
168
169 public:
170 template <typename S>
171 static InstanceLayoutGeneric *deserialize_new(S &deserializer);
172
174
175 virtual InstanceLayoutGeneric *clone(void) const = 0;
176
181 virtual void relocate(size_t adjust_amt) = 0;
182
183 virtual void print(std::ostream &os) const = 0;
184
194 template <int N, typename T>
195 static InstanceLayoutGeneric *
197 const int dim_order[N]);
198
209 template <int N, typename T>
210 static InstanceLayoutGeneric *
211 choose_instance_layout(IndexSpace<N, T> is, const std::vector<Rect<N, T>> &covering,
212 const InstanceLayoutConstraints &ilc, const int dim_order[N]);
213
216
219
220 // we optimize for fields being laid out similarly, and have fields
221 // indirectly reference a piece list
222 struct FieldLayout {
226 };
227
228 using FieldMap = std::map<FieldID, FieldLayout>;
230 bool idindexed_fields{false};
231 };
232
234 std::ostream &operator<<(std::ostream &os, const InstanceLayoutGeneric &ilg);
235
243 public:
244 InstanceLayoutOpaque(size_t _bytes_used, size_t _alignment_reqd);
245
246 virtual InstanceLayoutGeneric *clone(void) const;
247
248 virtual void relocate(size_t adjust_amt);
249
250 virtual void print(std::ostream &os) const;
251
254 };
255
256 namespace PieceLayoutTypes {
257 typedef unsigned char LayoutType;
258
259 static const LayoutType InvalidLayoutType = 0;
260 static const LayoutType AffineLayoutType = 1;
261 }; // namespace PieceLayoutTypes
262
268 public:
270
272
273 virtual void relocate(size_t base_offset) = 0;
274
275 virtual void print(std::ostream &os) const = 0;
276
277 // used for constructing lookup programs
278 virtual size_t lookup_inst_size() const = 0;
280 unsigned next_delta) const = 0;
281
283 };
284
289 template <int N, typename T = int>
291 public:
295 const Rect<N, T> &_bounds);
296
297 template <typename S>
299
300 virtual InstanceLayoutPiece<N, T> *clone(void) const = 0;
301
302 virtual size_t calculate_offset(const Point<N, T> &p) const = 0;
303
305 };
306
307 template <int N, typename T>
308 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
309 const InstanceLayoutPiece<N, T> &ilp);
310
316 template <int N, typename T = int>
318 public:
320
321 template <typename S>
323
324 virtual InstanceLayoutPiece<N, T> *clone(void) const;
325
332 virtual size_t calculate_offset(const Point<N, T> &p) const;
333
334 virtual void relocate(size_t base_offset);
335
336 virtual void print(std::ostream &os) const;
337
338 // used for constructing lookup programs
339 virtual size_t lookup_inst_size() const;
341 unsigned next_delta) const;
342
346
347 template <typename S>
348 bool serialize(S &serializer) const;
349
351 size_t offset;
352 };
353
358 template <int N, typename T = int>
360 public:
363
366 InstancePieceList(InstancePieceList &&) noexcept = default;
367 InstancePieceList &operator=(InstancePieceList &&) noexcept = default;
368
369 const InstanceLayoutPiece<N, T> *find_piece(Point<N, T> p) const;
370
371 void relocate(size_t base_offset);
372
373 template <typename S>
374 bool serialize(S &serializer) const;
375 template <typename S>
376 bool deserialize(S &deserializer);
377
378 std::vector<InstanceLayoutPiece<N, T> *> pieces;
379 // placeholder for lookup structure (e.g. K-D tree)
380 };
381
382 template <int N, typename T>
383 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
384 const InstancePieceList<N, T> &ipl);
385
390 template <int N, typename T = int>
392 public:
394
395 template <typename S>
396 static InstanceLayoutGeneric *deserialize_new(S &deserializer);
397
398 virtual ~InstanceLayout(void);
399
400 virtual InstanceLayoutGeneric *clone(void) const;
401
406 virtual void relocate(size_t base_offset);
407
408 virtual void print(std::ostream &os) const;
409
412
421
423 std::vector<InstancePieceList<N, T>> piece_lists;
424
425 // Pre-computed dimension ordering for idindexed_fields
426 std::vector<int> preferred_dim_order;
427
431
432 template <typename S>
433 bool serialize(S &serializer) const;
434 };
435
436 // instance layouts are compiled into "piece lookup programs" for fast
437 // access on both CPU and accelerators
438
439 namespace PieceLookup {
440
441 namespace Opcodes {
442 static const Opcode OP_AFFINE_PIECE = 2; // this is a AffinePiece<N,T>
443 }
444
445 static const unsigned ALLOW_AFFINE_PIECE = 1U << Opcodes::OP_AFFINE_PIECE;
446
447 template <int N, typename T>
449 // data is: { delta[23:0], opcode[7:0] }
450 // top 24 bits of data is jump delta
451 AffinePiece(unsigned next_delta);
452
454 unsigned delta() const;
455
457 uintptr_t base;
459
461 const Instruction *next() const;
462 };
463
464 template <int N, typename T>
466 // data is: { delta[15:0], dim[7:0], opcode[7:0] }
467 SplitPlane(int _split_dim, T _split_plane, unsigned _next_delta);
468
469 void set_delta(unsigned _next_delta);
470
472 unsigned delta() const;
474 int split_dim() const;
475
476 // if point's coord is less than split_plane, go to next, else jump
478
480 const Instruction *next(const Point<N, T> &p) const;
481
483 bool splits_rect(const Rect<N, T> &r) const;
484 };
485
486 }; // namespace PieceLookup
487
488 template <typename FT>
490 public:
491 AccessorRefHelper(RegionInstance _inst, size_t _offset);
492
493 // "read"
494 operator FT(void) const;
495
496 // "write"
498 AccessorRefHelper(AccessorRefHelper &&) noexcept = default;
499 AccessorRefHelper<FT> &operator=(const FT &newval);
500 AccessorRefHelper<FT> &operator=(const AccessorRefHelper<FT> &rhs);
501
502 protected:
503 template <typename T>
504 friend std::ostream &operator<<(std::ostream &os, const AccessorRefHelper<T> &arh);
505
507 size_t offset;
508 };
509
518 template <typename FT, int N, typename T = int>
520 public:
522
530 GenericAccessor(RegionInstance inst, FieldID field_id, size_t subfield_offset = 0);
531
540 GenericAccessor(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
541 size_t subfield_offset = 0);
542
544
545 static bool is_compatible(RegionInstance inst, size_t field_offset);
546 static bool is_compatible(RegionInstance inst, size_t field_offset,
547 const Rect<N, T> &subrect);
548
549 template <typename INST>
550 static bool is_compatible(const INST &instance, unsigned field_id);
551 template <typename INST>
552 static bool is_compatible(const INST &instance, unsigned field_id,
553 const Rect<N, T> &subrect);
554
555 // GenericAccessor does not support returning a pointer to an element
556 // FT *ptr(const Point<N,T>& p) const;
557
558 FT read(const Point<N, T> &p);
559 void write(const Point<N, T> &p, FT newval);
560
568
569 // instead of storing the top-level layout - we narrow down to just the
570 // piece list and relative offset of the field we're interested in
574 // cache the most recently-used piece
576
577 // protected:
578 // not a const method because of the piece caching
579 size_t get_offset(const Point<N, T> &p);
580 };
581
582 template <typename FT, int N, typename T>
583 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
585
594 template <typename FT, int N, typename T = int>
596 public:
597 // NOTE: even when compiling with nvcc, non-default constructors are only
598 // available in host code
599
600 // TODO: Sean check if this is safe for a default constructor
603
614 AffineAccessor(RegionInstance inst, FieldID field_id, size_t subfield_offset = 0);
615
626 AffineAccessor(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
627 size_t subfield_offset = 0);
628
630
639 template <int N2, typename T2>
641 const Point<N2, T2> &offset, FieldID field_id,
642 size_t subfield_offset = 0);
643
644 // note that the subrect here is in in the accessor's indexspace
645 // (from which the corresponding subrectangle in the instance can be
646 // easily determined)
647 template <int N2, typename T2>
649 const Point<N2, T2> &offset, FieldID field_id,
650 const Rect<N, T> &subrect, size_t subfield_offset = 0);
652
655
656 AffineAccessor(const AffineAccessor &) = default;
658 AffineAccessor(AffineAccessor &&) noexcept = default;
659 AffineAccessor &operator=(AffineAccessor &&) noexcept = default;
660
661 static bool is_compatible(RegionInstance inst, FieldID field_id);
662 static bool is_compatible(RegionInstance inst, FieldID field_id,
663 const Rect<N, T> &subrect);
664 template <int N2, typename T2>
665 static bool is_compatible(RegionInstance inst, const Matrix<N2, N, T2> &transform,
666 const Point<N2, T2> &offset, FieldID field_id);
667 template <int N2, typename T2>
668 static bool is_compatible(RegionInstance inst, const Matrix<N2, N, T2> &transform,
669 const Point<N2, T2> &offset, FieldID field_id,
670 const Rect<N, T> &subrect);
671
672 // used by constructors or can be called directly
674 void reset();
675 void reset(RegionInstance inst, FieldID field_id, size_t subfield_offset = 0);
676 void reset(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
677 size_t subfield_offset = 0);
678 template <int N2, typename T2>
679 void reset(RegionInstance inst, const Matrix<N2, N, T2> &transform,
680 const Point<N2, T2> &offset, FieldID field_id, size_t subfield_offset = 0);
681 template <int N2, typename T2>
682 void reset(RegionInstance inst, const Matrix<N2, N, T2> &transform,
683 const Point<N2, T2> &offset, FieldID field_id, const Rect<N, T> &subrect,
684 size_t subfield_offset = 0);
685
687 FT *ptr(const Point<N, T> &p) const;
689 FT read(const Point<N, T> &p) const;
691 void write(const Point<N, T> &p, FT newval) const;
692
694 FT &operator[](const Point<N, T> &p) const;
695
697 bool is_dense_arbitrary(const Rect<N, T> &bounds) const; // any dimension ordering
699 bool is_dense_col_major(const Rect<N, T> &bounds) const; // Fortran dimension ordering
701 bool is_dense_row_major(const Rect<N, T> &bounds) const; // C dimension ordering
702
703#ifdef REALM_PROVIDE_ACCESSOR_TO_KOKKOS_VIEW_CONVERSION
704 // conversion to Kokkos unmanaged views
705
706 // Kokkos::View uses relative ("local") indexing - the first element is
707 // always index 0, even when accessing a subregion that does not include
708 // global element 0
709 template <typename... Args>
710 operator Kokkos::View<Args...>() const;
711
712 // Kokkos::Experimental::OffsetView uses absolute ("global") indexing -
713 // the indices used on the OffsetView::operator() match what is used for
714 // the AffineAccessor's operator[]
715 template <typename... Args>
716 operator Kokkos::Experimental::OffsetView<Args...>() const;
717#endif
718
719 // protected:
720 // friend
721 // std::ostream& operator<<(std::ostream& os, const AffineAccessor<FT,N,T>& a);
722// #define REALM_ACCESSOR_DEBUG
723#if defined(REALM_ACCESSOR_DEBUG) || defined(REALM_USE_KOKKOS)
724 Rect<N, T> bounds;
725#endif
726#ifdef REALM_USE_KOKKOS
727 bool bounds_specified;
728#endif
729#ifdef REALM_ACCESSOR_DEBUG
730 RegionInstance dbg_inst;
731#if defined(__CUDACC__) || defined(__HIPCC__)
732#error "REALM_ACCESSOR_DEBUG macro for AffineAccessor not supported for GPU code"
733#endif
734#endif
735 uintptr_t base;
737
738 protected:
740 FT *get_ptr(const Point<N, T> &p) const;
741 };
742
743 template <typename FT, int N, typename T>
744 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
745 const AffineAccessor<FT, N, T> &a);
746
747 // a multi-affine accessor handles instances with multiple pieces, but only
748 // if all of them are affine
749 template <typename FT, int N, typename T = int>
751
752 template <typename FT, int N, typename T>
753 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
755
763 template <typename FT, int N, typename T>
765 public:
768
779 size_t subfield_offset = 0);
780
791 MultiAffineAccessor(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
792 size_t subfield_offset = 0);
793
796
800 MultiAffineAccessor &operator=(MultiAffineAccessor &&) noexcept = default;
801
802 static bool is_compatible(RegionInstance inst, FieldID field_id);
803 static bool is_compatible(RegionInstance inst, FieldID field_id,
804 const Rect<N, T> &subrect);
805
806 // used by constructors or can be called directly
808 void reset();
809 void reset(RegionInstance inst, FieldID field_id, size_t subfield_offset = 0);
810 void reset(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
811 size_t subfield_offset = 0);
812
814
821 FT *ptr(const Point<N, T> &p) const;
823 FT *ptr(const Rect<N, T> &r, size_t strides[N]) const;
825 FT read(const Point<N, T> &p) const;
827 void write(const Point<N, T> &p, FT newval) const;
829
831 FT &operator[](const Point<N, T> &p) const;
832
834 FT *ptr(const Point<N, T> &p);
836 FT *ptr(const Rect<N, T> &r, size_t strides[N]);
838 FT read(const Point<N, T> &p);
840 void write(const Point<N, T> &p, FT newval);
841
843 FT &operator[](const Point<N, T> &p);
844
845 protected:
846 friend std::ostream &operator<< <FT, N, T>(std::ostream &os,
847 const MultiAffineAccessor<FT, N, T> &a);
848
849 // cached info from the most recent piece, or authoritative info for
850 // a single piece
851 bool piece_valid;
852 Rect<N, T> piece_bounds;
853 uintptr_t piece_base;
854 Point<N, size_t> piece_strides;
855 // if we need to do a new lookup, this is where we start
856 const PieceLookup::Instruction *start_inst;
857 size_t field_offset;
858 };
859
860}; // namespace Realm
861
862#include "realm/inst_layout.inl"
863
864#endif // ifndef REALM_INST_LAYOUT_H
Definition inst_layout.h:489
AccessorRefHelper(const AccessorRefHelper &)=default
AccessorRefHelper(AccessorRefHelper &&) noexcept=default
AccessorRefHelper(RegionInstance _inst, size_t _offset)
Definition inst_layout.h:595
AffineAccessor(RegionInstance inst, const Matrix< N2, N, T2 > &transform, const Point< N2, T2 > &offset, FieldID field_id, const Rect< N, T > &subrect, size_t subfield_offset=0)
AffineAccessor & operator=(const AffineAccessor &)=default
AffineAccessor(RegionInstance inst, const Matrix< N2, N, T2 > &transform, const Point< N2, T2 > &offset, FieldID field_id, size_t subfield_offset=0)
AffineAccessor(const AffineAccessor &)=default
Point< N, size_t > strides
Definition inst_layout.h:736
AffineAccessor(AffineAccessor &&) noexcept=default
AffineAccessor(RegionInstance inst, FieldID field_id, size_t subfield_offset=0)
REALM_CUDA_HD AffineAccessor(void)
REALM_CUDA_HD FT * get_ptr(const Point< N, T > &p) const
uintptr_t base
Definition inst_layout.h:735
AffineAccessor(RegionInstance inst, FieldID field_id, const Rect< N, T > &subrect, size_t subfield_offset=0)
REALM_CUDA_HD ~AffineAccessor(void)
Definition inst_layout.h:317
static Serialization::PolymorphicSerdezSubclass< InstanceLayoutPiece< N, T >, AffineLayoutPiece< N, T > > serdez_subclass
Definition inst_layout.h:345
static InstanceLayoutPiece< N, T > * deserialize_new(S &deserializer)
size_t offset
Definition inst_layout.h:351
virtual size_t calculate_offset(const Point< N, T > &p) const
virtual PieceLookup::Instruction * create_lookup_inst(void *ptr, unsigned next_delta) const
virtual void print(std::ostream &os) const
Point< N, size_t > strides
Definition inst_layout.h:350
virtual size_t lookup_inst_size() const
virtual InstanceLayoutPiece< N, T > * clone(void) const
bool serialize(S &serializer) const
virtual void relocate(size_t base_offset)
Definition inst_layout.h:519
const InstanceLayoutPiece< N, T > * prev_piece
Definition inst_layout.h:575
void write(const Point< N, T > &p, FT newval)
GenericAccessor(RegionInstance inst, FieldID field_id, const Rect< N, T > &subrect, size_t subfield_offset=0)
GenericAccessor(RegionInstance inst, FieldID field_id, size_t subfield_offset=0)
AccessorRefHelper< FT > operator[](const Point< N, T > &p)
FT read(const Point< N, T > &p)
static bool is_compatible(const INST &instance, unsigned field_id)
RegionInstance inst
Definition inst_layout.h:571
size_t rel_offset
Definition inst_layout.h:573
size_t get_offset(const Point< N, T > &p)
static bool is_compatible(const INST &instance, unsigned field_id, const Rect< N, T > &subrect)
static bool is_compatible(RegionInstance inst, size_t field_offset, const Rect< N, T > &subrect)
static bool is_compatible(RegionInstance inst, size_t field_offset)
const InstancePieceList< N, T > * piece_list
Definition inst_layout.h:572
Definition inst_layout.h:72
InstanceLayoutConstraints(const FieldID *field_ids, const size_t *field_sizes, size_t num_fields, size_t block_size)
InstanceLayoutConstraints(const std::map< FieldID, size_t > &field_sizes, size_t block_size)
InstanceLayoutConstraints(void)
Definition inst_layout.h:74
std::vector< FieldGroup > field_groups
Definition inst_layout.h:92
InstanceLayoutConstraints(const std::vector< FieldID > &field_ids, const std::vector< size_t > &field_sizes, size_t block_size)
std::vector< FieldInfo > FieldGroup
Definition inst_layout.h:90
InstanceLayoutConstraints(const std::vector< size_t > &field_sizes, size_t block_size)
Definition inst_layout.h:164
std::map< FieldID, FieldLayout > FieldMap
Definition inst_layout.h:228
static InstanceLayoutGeneric * deserialize_new(S &deserializer)
static InstanceLayoutGeneric * choose_instance_layout(IndexSpace< N, T > is, const std::vector< Rect< N, T > > &covering, const InstanceLayoutConstraints &ilc, const int dim_order[N])
virtual void relocate(size_t adjust_amt)=0
FieldMap fields
Definition inst_layout.h:229
virtual ~InstanceLayoutGeneric(void)
virtual void print(std::ostream &os) const =0
virtual REALM_INTERNAL_API_EXTERNAL_LINKAGE void compile_lookup_program(PieceLookup::CompiledProgram &p) const =0
size_t bytes_used
Definition inst_layout.h:217
static InstanceLayoutGeneric * choose_instance_layout(IndexSpace< N, T > is, const InstanceLayoutConstraints &ilc, const int dim_order[N])
virtual InstanceLayoutGeneric * clone(void) const =0
size_t alignment_reqd
Definition inst_layout.h:218
Definition inst_layout.h:242
virtual InstanceLayoutGeneric * clone(void) const
virtual void print(std::ostream &os) const
virtual REALM_INTERNAL_API_EXTERNAL_LINKAGE void compile_lookup_program(PieceLookup::CompiledProgram &p) const
virtual void relocate(size_t adjust_amt)
InstanceLayoutOpaque(size_t _bytes_used, size_t _alignment_reqd)
Definition inst_layout.h:267
PieceLayoutTypes::LayoutType layout_type
Definition inst_layout.h:282
virtual PieceLookup::Instruction * create_lookup_inst(void *ptr, unsigned next_delta) const =0
InstanceLayoutPieceBase(PieceLayoutTypes::LayoutType _layout_type)
virtual ~InstanceLayoutPieceBase(void)
virtual void relocate(size_t base_offset)=0
virtual size_t lookup_inst_size() const =0
virtual void print(std::ostream &os) const =0
Definition inst_layout.h:290
InstanceLayoutPiece(PieceLayoutTypes::LayoutType _layout_type)
virtual size_t calculate_offset(const Point< N, T > &p) const =0
InstanceLayoutPiece(PieceLayoutTypes::LayoutType _layout_type, const Rect< N, T > &_bounds)
static InstanceLayoutPiece< N, T > * deserialize_new(S &deserializer)
virtual InstanceLayoutPiece< N, T > * clone(void) const =0
Rect< N, T > bounds
Definition inst_layout.h:304
Definition inst_layout.h:391
IndexSpace< N, T > space
Definition inst_layout.h:422
static InstanceLayoutGeneric * deserialize_new(S &deserializer)
std::vector< int > preferred_dim_order
Definition inst_layout.h:426
size_t calculate_offset(Point< N, T > p, FieldID fid) const
virtual REALM_INTERNAL_API_EXTERNAL_LINKAGE void compile_lookup_program(PieceLookup::CompiledProgram &p) const
std::vector< InstancePieceList< N, T > > piece_lists
Definition inst_layout.h:423
virtual InstanceLayoutGeneric * clone(void) const
virtual void relocate(size_t base_offset)
static Serialization::PolymorphicSerdezSubclass< InstanceLayoutGeneric, InstanceLayout< N, T > > serdez_subclass
Definition inst_layout.h:430
virtual ~InstanceLayout(void)
virtual void print(std::ostream &os) const
bool serialize(S &serializer) const
Definition inst_layout.h:359
InstancePieceList(InstancePieceList &&) noexcept=default
InstancePieceList & operator=(const InstancePieceList &)=default
InstancePieceList(const InstancePieceList &)=default
Definition inst_layout.h:764
REALM_CUDA_HD ~MultiAffineAccessor(void)
MultiAffineAccessor(RegionInstance inst, FieldID field_id, const Rect< N, T > &subrect, size_t subfield_offset=0)
MultiAffineAccessor & operator=(const MultiAffineAccessor &)=default
MultiAffineAccessor(MultiAffineAccessor &&) noexcept=default
MultiAffineAccessor(RegionInstance inst, FieldID field_id, size_t subfield_offset=0)
MultiAffineAccessor(const MultiAffineAccessor &)=default
REALM_CUDA_HD MultiAffineAccessor(void)
Definition inst_layout.h:97
virtual ~CompiledProgram()
Definition inst_layout.h:99
std::map< FieldID, PerField > fields
Definition inst_layout.h:115
virtual void * allocate_memory(size_t bytes)=0
Definition instance.h:66
Definition atomics.h:31
#define REALM_INTERNAL_API_EXTERNAL_LINKAGE
Definition compiler_support.h:218
#define REALM_CUDA_HD
Definition compiler_support.h:95
#define REALM_PUBLIC_API
Definition compiler_support.h:217
unsigned char LayoutType
Definition inst_layout.h:257
unsigned char Opcode
Definition inst_layout.h:121
Definition activemsg.h:38
realm_field_id_t FieldID
Definition instance.h:45
std::ostream & operator<<(std::ostream &os, const DenseRectangleList< N, T > &drl)
Definition indexspace.h:1279
Definition indexspace.h:323
size_t size
Definition inst_layout.h:87
bool fixed_offset
Definition inst_layout.h:85
FieldID field_id
Definition inst_layout.h:84
size_t offset
Definition inst_layout.h:86
size_t alignment
Definition inst_layout.h:88
Definition inst_layout.h:222
int list_idx
Definition inst_layout.h:223
int size_in_bytes
Definition inst_layout.h:225
size_t rel_offset
Definition inst_layout.h:224
Definition point.h:230
Definition inst_layout.h:448
uintptr_t base
Definition inst_layout.h:457
Rect< N, T > bounds
Definition inst_layout.h:456
AffinePiece(unsigned next_delta)
Point< N, size_t > strides
Definition inst_layout.h:458
REALM_CUDA_HD const Instruction * next() const
REALM_CUDA_HD unsigned delta() const
uintptr_t field_offset
Definition inst_layout.h:112
unsigned inst_usage_mask
Definition inst_layout.h:111
const PieceLookup::Instruction * start_inst
Definition inst_layout.h:110
Definition inst_layout.h:131
REALM_ALIGNED_TYPE_CONST(uint32_aligned_16, uint32_t, 16)
REALM_CUDA_HD const Instruction * jump(unsigned delta) const
REALM_CUDA_HD const Instruction * skip(size_t bytes) const
REALM_CUDA_HD Opcodes::Opcode opcode() const
uint32_aligned_16 data
Definition inst_layout.h:136
Definition inst_layout.h:465
T split_plane
Definition inst_layout.h:477
REALM_CUDA_HD int split_dim() const
SplitPlane(int _split_dim, T _split_plane, unsigned _next_delta)
void set_delta(unsigned _next_delta)
REALM_CUDA_HD bool splits_rect(const Rect< N, T > &r) const
REALM_CUDA_HD const Instruction * next(const Point< N, T > &p) const
REALM_CUDA_HD unsigned delta() const
Definition point.h:55
Definition point.h:143