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 };
231
233 std::ostream &operator<<(std::ostream &os, const InstanceLayoutGeneric &ilg);
234
242 public:
243 InstanceLayoutOpaque(size_t _bytes_used, size_t _alignment_reqd);
244
245 virtual InstanceLayoutGeneric *clone(void) const;
246
247 virtual void relocate(size_t adjust_amt);
248
249 virtual void print(std::ostream &os) const;
250
253 };
254
255 namespace PieceLayoutTypes {
256 typedef unsigned char LayoutType;
257
258 static const LayoutType InvalidLayoutType = 0;
259 static const LayoutType AffineLayoutType = 1;
260 }; // namespace PieceLayoutTypes
261
267 public:
269
271
272 virtual void relocate(size_t base_offset) = 0;
273
274 virtual void print(std::ostream &os) const = 0;
275
276 // used for constructing lookup programs
277 virtual size_t lookup_inst_size() const = 0;
279 unsigned next_delta) const = 0;
280
282 };
283
288 template <int N, typename T = int>
290 public:
294 const Rect<N, T> &_bounds);
295
296 template <typename S>
298
299 virtual InstanceLayoutPiece<N, T> *clone(void) const = 0;
300
301 virtual size_t calculate_offset(const Point<N, T> &p) const = 0;
302
304 };
305
306 template <int N, typename T>
307 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
308 const InstanceLayoutPiece<N, T> &ilp);
309
315 template <int N, typename T = int>
317 public:
319
320 template <typename S>
322
323 virtual InstanceLayoutPiece<N, T> *clone(void) const;
324
331 virtual size_t calculate_offset(const Point<N, T> &p) const;
332
333 virtual void relocate(size_t base_offset);
334
335 virtual void print(std::ostream &os) const;
336
337 // used for constructing lookup programs
338 virtual size_t lookup_inst_size() const;
340 unsigned next_delta) const;
341
345
346 template <typename S>
347 bool serialize(S &serializer) const;
348
350 size_t offset;
351 };
352
357 template <int N, typename T = int>
359 public:
362
365 InstancePieceList(InstancePieceList &&) noexcept = default;
366 InstancePieceList &operator=(InstancePieceList &&) noexcept = default;
367
368 const InstanceLayoutPiece<N, T> *find_piece(Point<N, T> p) const;
369
370 void relocate(size_t base_offset);
371
372 template <typename S>
373 bool serialize(S &serializer) const;
374 template <typename S>
375 bool deserialize(S &deserializer);
376
377 std::vector<InstanceLayoutPiece<N, T> *> pieces;
378 // placeholder for lookup structure (e.g. K-D tree)
379 };
380
381 template <int N, typename T>
382 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
383 const InstancePieceList<N, T> &ipl);
384
389 template <int N, typename T = int>
391 public:
393
394 template <typename S>
395 static InstanceLayoutGeneric *deserialize_new(S &deserializer);
396
397 virtual ~InstanceLayout(void);
398
399 virtual InstanceLayoutGeneric *clone(void) const;
400
405 virtual void relocate(size_t base_offset);
406
407 virtual void print(std::ostream &os) const;
408
411
420
422 std::vector<InstancePieceList<N, T>> piece_lists;
423
427
428 template <typename S>
429 bool serialize(S &serializer) const;
430 };
431
432 // instance layouts are compiled into "piece lookup programs" for fast
433 // access on both CPU and accelerators
434
435 namespace PieceLookup {
436
437 namespace Opcodes {
438 static const Opcode OP_AFFINE_PIECE = 2; // this is a AffinePiece<N,T>
439 }
440
441 static const unsigned ALLOW_AFFINE_PIECE = 1U << Opcodes::OP_AFFINE_PIECE;
442
443 template <int N, typename T>
445 // data is: { delta[23:0], opcode[7:0] }
446 // top 24 bits of data is jump delta
447 AffinePiece(unsigned next_delta);
448
450 unsigned delta() const;
451
453 uintptr_t base;
455
457 const Instruction *next() const;
458 };
459
460 template <int N, typename T>
462 // data is: { delta[15:0], dim[7:0], opcode[7:0] }
463 SplitPlane(int _split_dim, T _split_plane, unsigned _next_delta);
464
465 void set_delta(unsigned _next_delta);
466
468 unsigned delta() const;
470 int split_dim() const;
471
472 // if point's coord is less than split_plane, go to next, else jump
474
476 const Instruction *next(const Point<N, T> &p) const;
477
479 bool splits_rect(const Rect<N, T> &r) const;
480 };
481
482 }; // namespace PieceLookup
483
484 template <typename FT>
486 public:
487 AccessorRefHelper(RegionInstance _inst, size_t _offset);
488
489 // "read"
490 operator FT(void) const;
491
492 // "write"
494 AccessorRefHelper(AccessorRefHelper &&) noexcept = default;
495 AccessorRefHelper<FT> &operator=(const FT &newval);
496 AccessorRefHelper<FT> &operator=(const AccessorRefHelper<FT> &rhs);
497
498 protected:
499 template <typename T>
500 friend std::ostream &operator<<(std::ostream &os, const AccessorRefHelper<T> &arh);
501
503 size_t offset;
504 };
505
514 template <typename FT, int N, typename T = int>
516 public:
518
526 GenericAccessor(RegionInstance inst, FieldID field_id, size_t subfield_offset = 0);
527
536 GenericAccessor(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
537 size_t subfield_offset = 0);
538
540
541 static bool is_compatible(RegionInstance inst, size_t field_offset);
542 static bool is_compatible(RegionInstance inst, size_t field_offset,
543 const Rect<N, T> &subrect);
544
545 template <typename INST>
546 static bool is_compatible(const INST &instance, unsigned field_id);
547 template <typename INST>
548 static bool is_compatible(const INST &instance, unsigned field_id,
549 const Rect<N, T> &subrect);
550
551 // GenericAccessor does not support returning a pointer to an element
552 // FT *ptr(const Point<N,T>& p) const;
553
554 FT read(const Point<N, T> &p);
555 void write(const Point<N, T> &p, FT newval);
556
564
565 // instead of storing the top-level layout - we narrow down to just the
566 // piece list and relative offset of the field we're interested in
570 // cache the most recently-used piece
572
573 // protected:
574 // not a const method because of the piece caching
575 size_t get_offset(const Point<N, T> &p);
576 };
577
578 template <typename FT, int N, typename T>
579 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
581
590 template <typename FT, int N, typename T = int>
592 public:
593 // NOTE: even when compiling with nvcc, non-default constructors are only
594 // available in host code
595
596 // TODO: Sean check if this is safe for a default constructor
599
610 AffineAccessor(RegionInstance inst, FieldID field_id, size_t subfield_offset = 0);
611
622 AffineAccessor(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
623 size_t subfield_offset = 0);
624
626
635 template <int N2, typename T2>
637 const Point<N2, T2> &offset, FieldID field_id,
638 size_t subfield_offset = 0);
639
640 // note that the subrect here is in in the accessor's indexspace
641 // (from which the corresponding subrectangle in the instance can be
642 // easily determined)
643 template <int N2, typename T2>
645 const Point<N2, T2> &offset, FieldID field_id,
646 const Rect<N, T> &subrect, size_t subfield_offset = 0);
648
651
652 AffineAccessor(const AffineAccessor &) = default;
654 AffineAccessor(AffineAccessor &&) noexcept = default;
655 AffineAccessor &operator=(AffineAccessor &&) noexcept = default;
656
657 static bool is_compatible(RegionInstance inst, FieldID field_id);
658 static bool is_compatible(RegionInstance inst, FieldID field_id,
659 const Rect<N, T> &subrect);
660 template <int N2, typename T2>
661 static bool is_compatible(RegionInstance inst, const Matrix<N2, N, T2> &transform,
662 const Point<N2, T2> &offset, FieldID field_id);
663 template <int N2, typename T2>
664 static bool is_compatible(RegionInstance inst, const Matrix<N2, N, T2> &transform,
665 const Point<N2, T2> &offset, FieldID field_id,
666 const Rect<N, T> &subrect);
667
668 // used by constructors or can be called directly
670 void reset();
671 void reset(RegionInstance inst, FieldID field_id, size_t subfield_offset = 0);
672 void reset(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
673 size_t subfield_offset = 0);
674 template <int N2, typename T2>
675 void reset(RegionInstance inst, const Matrix<N2, N, T2> &transform,
676 const Point<N2, T2> &offset, FieldID field_id, size_t subfield_offset = 0);
677 template <int N2, typename T2>
678 void reset(RegionInstance inst, const Matrix<N2, N, T2> &transform,
679 const Point<N2, T2> &offset, FieldID field_id, const Rect<N, T> &subrect,
680 size_t subfield_offset = 0);
681
683 FT *ptr(const Point<N, T> &p) const;
685 FT read(const Point<N, T> &p) const;
687 void write(const Point<N, T> &p, FT newval) const;
688
690 FT &operator[](const Point<N, T> &p) const;
691
693 bool is_dense_arbitrary(const Rect<N, T> &bounds) const; // any dimension ordering
695 bool is_dense_col_major(const Rect<N, T> &bounds) const; // Fortran dimension ordering
697 bool is_dense_row_major(const Rect<N, T> &bounds) const; // C dimension ordering
698
699#ifdef REALM_PROVIDE_ACCESSOR_TO_KOKKOS_VIEW_CONVERSION
700 // conversion to Kokkos unmanaged views
701
702 // Kokkos::View uses relative ("local") indexing - the first element is
703 // always index 0, even when accessing a subregion that does not include
704 // global element 0
705 template <typename... Args>
706 operator Kokkos::View<Args...>() const;
707
708 // Kokkos::Experimental::OffsetView uses absolute ("global") indexing -
709 // the indices used on the OffsetView::operator() match what is used for
710 // the AffineAccessor's operator[]
711 template <typename... Args>
712 operator Kokkos::Experimental::OffsetView<Args...>() const;
713#endif
714
715 // protected:
716 // friend
717 // std::ostream& operator<<(std::ostream& os, const AffineAccessor<FT,N,T>& a);
718// #define REALM_ACCESSOR_DEBUG
719#if defined(REALM_ACCESSOR_DEBUG) || defined(REALM_USE_KOKKOS)
720 Rect<N, T> bounds;
721#endif
722#ifdef REALM_USE_KOKKOS
723 bool bounds_specified;
724#endif
725#ifdef REALM_ACCESSOR_DEBUG
726 RegionInstance dbg_inst;
727#if defined(__CUDACC__) || defined(__HIPCC__)
728#error "REALM_ACCESSOR_DEBUG macro for AffineAccessor not supported for GPU code"
729#endif
730#endif
731 uintptr_t base;
733
734 protected:
736 FT *get_ptr(const Point<N, T> &p) const;
737 };
738
739 template <typename FT, int N, typename T>
740 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
741 const AffineAccessor<FT, N, T> &a);
742
743 // a multi-affine accessor handles instances with multiple pieces, but only
744 // if all of them are affine
745 template <typename FT, int N, typename T = int>
747
748 template <typename FT, int N, typename T>
749 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
751
759 template <typename FT, int N, typename T>
761 public:
764
775 size_t subfield_offset = 0);
776
787 MultiAffineAccessor(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
788 size_t subfield_offset = 0);
789
792
796 MultiAffineAccessor &operator=(MultiAffineAccessor &&) noexcept = default;
797
798 static bool is_compatible(RegionInstance inst, FieldID field_id);
799 static bool is_compatible(RegionInstance inst, FieldID field_id,
800 const Rect<N, T> &subrect);
801
802 // used by constructors or can be called directly
804 void reset();
805 void reset(RegionInstance inst, FieldID field_id, size_t subfield_offset = 0);
806 void reset(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
807 size_t subfield_offset = 0);
808
810
817 FT *ptr(const Point<N, T> &p) const;
819 FT *ptr(const Rect<N, T> &r, size_t strides[N]) const;
821 FT read(const Point<N, T> &p) const;
823 void write(const Point<N, T> &p, FT newval) const;
825
827 FT &operator[](const Point<N, T> &p) const;
828
830 FT *ptr(const Point<N, T> &p);
832 FT *ptr(const Rect<N, T> &r, size_t strides[N]);
834 FT read(const Point<N, T> &p);
836 void write(const Point<N, T> &p, FT newval);
837
839 FT &operator[](const Point<N, T> &p);
840
841 protected:
842 friend std::ostream &operator<< <FT, N, T>(std::ostream &os,
843 const MultiAffineAccessor<FT, N, T> &a);
844
845 // cached info from the most recent piece, or authoritative info for
846 // a single piece
847 bool piece_valid;
848 Rect<N, T> piece_bounds;
849 uintptr_t piece_base;
850 Point<N, size_t> piece_strides;
851 // if we need to do a new lookup, this is where we start
852 const PieceLookup::Instruction *start_inst;
853 size_t field_offset;
854 };
855
856}; // namespace Realm
857
858#include "realm/inst_layout.inl"
859
860#endif // ifndef REALM_INST_LAYOUT_H
Definition inst_layout.h:485
AccessorRefHelper(const AccessorRefHelper &)=default
AccessorRefHelper(AccessorRefHelper &&) noexcept=default
AccessorRefHelper(RegionInstance _inst, size_t _offset)
Definition inst_layout.h:591
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:732
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:731
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:316
static Serialization::PolymorphicSerdezSubclass< InstanceLayoutPiece< N, T >, AffineLayoutPiece< N, T > > serdez_subclass
Definition inst_layout.h:344
static InstanceLayoutPiece< N, T > * deserialize_new(S &deserializer)
size_t offset
Definition inst_layout.h:350
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:349
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:515
const InstanceLayoutPiece< N, T > * prev_piece
Definition inst_layout.h:571
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:567
size_t rel_offset
Definition inst_layout.h:569
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:568
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:241
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:266
PieceLayoutTypes::LayoutType layout_type
Definition inst_layout.h:281
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:289
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:303
Definition inst_layout.h:390
IndexSpace< N, T > space
Definition inst_layout.h:421
static InstanceLayoutGeneric * deserialize_new(S &deserializer)
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:422
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:426
virtual ~InstanceLayout(void)
virtual void print(std::ostream &os) const
bool serialize(S &serializer) const
Definition inst_layout.h:358
InstancePieceList(InstancePieceList &&) noexcept=default
InstancePieceList & operator=(const InstancePieceList &)=default
InstancePieceList(const InstancePieceList &)=default
Definition inst_layout.h:760
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:256
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:444
uintptr_t base
Definition inst_layout.h:453
Rect< N, T > bounds
Definition inst_layout.h:452
AffinePiece(unsigned next_delta)
Point< N, size_t > strides
Definition inst_layout.h:454
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:461
T split_plane
Definition inst_layout.h:473
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