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 namespace Experimental {
39 template <class, class...>
40 class OffsetView;
41 };
42}; // namespace Kokkos
43// Kokkos::Unmanaged is an enum, which we can't forward declare - we'll test
44// that we have the right value in the template though
45enum
46{
47 Kokkos_Unmanaged = 0x01
48};
49
50#define REALM_PROVIDE_ACCESSOR_TO_KOKKOS_VIEW_CONVERSION
51#endif
52
53#include <vector>
54#include <map>
55#include <iostream>
56
63namespace Realm {
64
71 public:
73 InstanceLayoutConstraints(const std::map<FieldID, size_t> &field_sizes,
74 size_t block_size);
75 InstanceLayoutConstraints(const std::vector<size_t> &field_sizes, size_t block_size);
76 InstanceLayoutConstraints(const std::vector<FieldID> &field_ids,
77 const std::vector<size_t> &field_sizes, size_t block_size);
78 InstanceLayoutConstraints(const FieldID *field_ids, const size_t *field_sizes,
79 size_t num_fields, size_t block_size);
80
81 struct FieldInfo {
84 size_t offset; // used if `fixed_offset` is true
85 size_t size;
86 size_t alignment;
87 };
88 typedef std::vector<FieldInfo> FieldGroup;
89
90 std::vector<FieldGroup> field_groups;
91 };
92
93 namespace PieceLookup {
94
96 public:
97 virtual ~CompiledProgram() {}
98
99 // used during compilation to request memory to store instructions
100 // in - can only be used once
101 virtual void *allocate_memory(size_t bytes) = 0;
102
103 // after any changes to the contents of the memory, this must be
104 // called to ensure all devices see the changes
105 virtual void commit_updates() = 0;
106
112
113 std::map<FieldID, PerField> fields;
114 atomic<bool> is_compiled{false};
115 };
116
117 // this is a namespace instead of an enum so that it can be extended elsewhere
118 namespace Opcodes {
119 typedef unsigned char Opcode;
120
121 static const Opcode OP_INVALID = 0;
122 static const Opcode OP_SPLIT1 = 1; // this is a SplitPlane<N,T>
123 } // namespace Opcodes
124
125 // some processors are limited in which instruction types they can
126 // support, so we build masks to describe usage/capabilities
127 static const unsigned ALLOW_SPLIT1 = 1U << Opcodes::OP_SPLIT1;
128
130 // all instructions are at least 4 bytes and aligned to 16 bytes, but
131 // the only data common to all is the opcode, which appears in the low
132 // 8 bits
133 REALM_ALIGNED_TYPE_CONST(uint32_aligned_16, uint32_t, 16);
134 uint32_aligned_16 data;
135
136 Instruction(uint32_t _data);
137
140
141 // two helper methods that get you to another instruction
142
143 // skip() gets the next instruction in sequence, which requires knowing
144 // the size of the current instruction - instructions below take care
145 // of this in most cases
147 const Instruction *skip(size_t bytes) const;
148
149 // jump(N) jumps forward in the instruction stream by N 16-B chunks
150 // special case: a delta of 0 is "end of program" and returns null
152 const Instruction *jump(unsigned delta) const;
153 };
154
155 }; // namespace PieceLookup
156
163 protected:
164 // cannot be created directly
166
167 public:
168 template <typename S>
169 static InstanceLayoutGeneric *deserialize_new(S &deserializer);
170
172
173 virtual InstanceLayoutGeneric *clone(void) const = 0;
174
179 virtual void relocate(size_t adjust_amt) = 0;
180
181 virtual void print(std::ostream &os) const = 0;
182
192 template <int N, typename T>
193 static InstanceLayoutGeneric *
195 const int dim_order[N]);
196
207 template <int N, typename T>
208 static InstanceLayoutGeneric *
209 choose_instance_layout(IndexSpace<N, T> is, const std::vector<Rect<N, T>> &covering,
210 const InstanceLayoutConstraints &ilc, const int dim_order[N]);
211
214
217
218 // we optimize for fields being laid out similarly, and have fields
219 // indirectly reference a piece list
220 struct FieldLayout {
224 };
225
226 using FieldMap = std::map<FieldID, FieldLayout>;
228 bool idindexed_fields{false};
229 };
230
232 std::ostream &operator<<(std::ostream &os, const InstanceLayoutGeneric &ilg);
233
241 public:
242 InstanceLayoutOpaque(size_t _bytes_used, size_t _alignment_reqd);
243
244 virtual InstanceLayoutGeneric *clone(void) const;
245
246 virtual void relocate(size_t adjust_amt);
247
248 virtual void print(std::ostream &os) const;
249
252 };
253
254 namespace PieceLayoutTypes {
255 typedef unsigned char LayoutType;
256
257 static const LayoutType InvalidLayoutType = 0;
258 static const LayoutType AffineLayoutType = 1;
259 }; // namespace PieceLayoutTypes
260
266 public:
268
270
271 virtual void relocate(size_t base_offset) = 0;
272
273 virtual void print(std::ostream &os) const = 0;
274
275 // used for constructing lookup programs
276 virtual size_t lookup_inst_size() const = 0;
278 unsigned next_delta) const = 0;
279
281 };
282
287 template <int N, typename T = int>
289 public:
293 const Rect<N, T> &_bounds);
294
295 template <typename S>
297
298 virtual InstanceLayoutPiece<N, T> *clone(void) const = 0;
299
300 virtual size_t calculate_offset(const Point<N, T> &p) const = 0;
301
303 };
304
305 template <int N, typename T>
306 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
307 const InstanceLayoutPiece<N, T> &ilp);
308
314 template <int N, typename T = int>
316 public:
318
319 template <typename S>
321
322 virtual InstanceLayoutPiece<N, T> *clone(void) const;
323
330 virtual size_t calculate_offset(const Point<N, T> &p) const;
331
332 virtual void relocate(size_t base_offset);
333
334 virtual void print(std::ostream &os) const;
335
336 // used for constructing lookup programs
337 virtual size_t lookup_inst_size() const;
339 unsigned next_delta) const;
340
344
345 template <typename S>
346 bool serialize(S &serializer) const;
347
349 size_t offset;
350 };
351
356 template <int N, typename T = int>
358 public:
361
364 InstancePieceList(InstancePieceList &&) noexcept = default;
365 InstancePieceList &operator=(InstancePieceList &&) noexcept = default;
366
367 const InstanceLayoutPiece<N, T> *find_piece(Point<N, T> p) const;
368
369 void relocate(size_t base_offset);
370
371 template <typename S>
372 bool serialize(S &serializer) const;
373 template <typename S>
374 bool deserialize(S &deserializer);
375
376 std::vector<InstanceLayoutPiece<N, T> *> pieces;
377 // placeholder for lookup structure (e.g. K-D tree)
378 };
379
380 template <int N, typename T>
381 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
382 const InstancePieceList<N, T> &ipl);
383
388 template <int N, typename T = int>
390 public:
392
393 template <typename S>
394 static InstanceLayoutGeneric *deserialize_new(S &deserializer);
395
396 virtual ~InstanceLayout(void);
397
398 virtual InstanceLayoutGeneric *clone(void) const;
399
404 virtual void relocate(size_t base_offset);
405
406 virtual void print(std::ostream &os) const;
407
410
419
421 std::vector<InstancePieceList<N, T>> piece_lists;
422
423 // Pre-computed dimension ordering for idindexed_fields
424 std::vector<int> preferred_dim_order;
425
429
430 template <typename S>
431 bool serialize(S &serializer) const;
432 };
433
434 // instance layouts are compiled into "piece lookup programs" for fast
435 // access on both CPU and accelerators
436
437 namespace PieceLookup {
438
439 namespace Opcodes {
440 static const Opcode OP_AFFINE_PIECE = 2; // this is a AffinePiece<N,T>
441 }
442
443 static const unsigned ALLOW_AFFINE_PIECE = 1U << Opcodes::OP_AFFINE_PIECE;
444
445 template <int N, typename T>
447 // data is: { delta[23:0], opcode[7:0] }
448 // top 24 bits of data is jump delta
449 AffinePiece(unsigned next_delta);
450
452 unsigned delta() const;
453
455 uintptr_t base;
457
459 const Instruction *next() const;
460 };
461
462 template <int N, typename T>
464 // data is: { delta[15:0], dim[7:0], opcode[7:0] }
465 SplitPlane(int _split_dim, T _split_plane, unsigned _next_delta);
466
467 void set_delta(unsigned _next_delta);
468
470 unsigned delta() const;
472 int split_dim() const;
473
474 // if point's coord is less than split_plane, go to next, else jump
476
478 const Instruction *next(const Point<N, T> &p) const;
479
481 bool splits_rect(const Rect<N, T> &r) const;
482 };
483
484 }; // namespace PieceLookup
485
486 template <typename FT>
488 public:
489 AccessorRefHelper(RegionInstance _inst, size_t _offset);
490
491 // "read"
492 operator FT(void) const;
493
494 // "write"
496 AccessorRefHelper(AccessorRefHelper &&) noexcept = default;
497 AccessorRefHelper<FT> &operator=(const FT &newval);
498 AccessorRefHelper<FT> &operator=(const AccessorRefHelper<FT> &rhs);
499
500 protected:
501 template <typename T>
502 friend std::ostream &operator<<(std::ostream &os, const AccessorRefHelper<T> &arh);
503
505 size_t offset;
506 };
507
516 template <typename FT, int N, typename T = int>
518 public:
520
528 GenericAccessor(RegionInstance inst, FieldID field_id, size_t subfield_offset = 0);
529
538 GenericAccessor(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
539 size_t subfield_offset = 0);
540
542
543 static bool is_compatible(RegionInstance inst, size_t field_offset);
544 static bool is_compatible(RegionInstance inst, size_t field_offset,
545 const Rect<N, T> &subrect);
546
547 template <typename INST>
548 static bool is_compatible(const INST &instance, unsigned field_id);
549 template <typename INST>
550 static bool is_compatible(const INST &instance, unsigned field_id,
551 const Rect<N, T> &subrect);
552
553 // GenericAccessor does not support returning a pointer to an element
554 // FT *ptr(const Point<N,T>& p) const;
555
556 FT read(const Point<N, T> &p);
557 void write(const Point<N, T> &p, FT newval);
558
566
567 // instead of storing the top-level layout - we narrow down to just the
568 // piece list and relative offset of the field we're interested in
572 // cache the most recently-used piece
574
575 // protected:
576 // not a const method because of the piece caching
577 size_t get_offset(const Point<N, T> &p);
578 };
579
580 template <typename FT, int N, typename T>
581 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
583
592 template <typename FT, int N, typename T = int>
594 public:
595 // NOTE: even when compiling with nvcc, non-default constructors are only
596 // available in host code
597
598 // TODO: Sean check if this is safe for a default constructor
601
612 AffineAccessor(RegionInstance inst, FieldID field_id, size_t subfield_offset = 0);
613
624 AffineAccessor(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
625 size_t subfield_offset = 0);
626
628
637 template <int N2, typename T2>
639 const Point<N2, T2> &offset, FieldID field_id,
640 size_t subfield_offset = 0);
641
642 // note that the subrect here is in in the accessor's indexspace
643 // (from which the corresponding subrectangle in the instance can be
644 // easily determined)
645 template <int N2, typename T2>
647 const Point<N2, T2> &offset, FieldID field_id,
648 const Rect<N, T> &subrect, size_t subfield_offset = 0);
650
653
654 AffineAccessor(const AffineAccessor &) = default;
656 AffineAccessor(AffineAccessor &&) noexcept = default;
657 AffineAccessor &operator=(AffineAccessor &&) noexcept = default;
658
659 static bool is_compatible(RegionInstance inst, FieldID field_id);
660 static bool is_compatible(RegionInstance inst, FieldID field_id,
661 const Rect<N, T> &subrect);
662 template <int N2, typename T2>
663 static bool is_compatible(RegionInstance inst, const Matrix<N2, N, T2> &transform,
664 const Point<N2, T2> &offset, FieldID field_id);
665 template <int N2, typename T2>
666 static bool is_compatible(RegionInstance inst, const Matrix<N2, N, T2> &transform,
667 const Point<N2, T2> &offset, FieldID field_id,
668 const Rect<N, T> &subrect);
669
670 // used by constructors or can be called directly
672 void reset();
673 void reset(RegionInstance inst, FieldID field_id, size_t subfield_offset = 0);
674 void reset(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
675 size_t subfield_offset = 0);
676 template <int N2, typename T2>
677 void reset(RegionInstance inst, const Matrix<N2, N, T2> &transform,
678 const Point<N2, T2> &offset, FieldID field_id, size_t subfield_offset = 0);
679 template <int N2, typename T2>
680 void reset(RegionInstance inst, const Matrix<N2, N, T2> &transform,
681 const Point<N2, T2> &offset, FieldID field_id, const Rect<N, T> &subrect,
682 size_t subfield_offset = 0);
683
685 FT *ptr(const Point<N, T> &p) const;
687 FT read(const Point<N, T> &p) const;
689 void write(const Point<N, T> &p, FT newval) const;
690
692 FT &operator[](const Point<N, T> &p) const;
693
695 bool is_dense_arbitrary(const Rect<N, T> &bounds) const; // any dimension ordering
697 bool is_dense_col_major(const Rect<N, T> &bounds) const; // Fortran dimension ordering
699 bool is_dense_row_major(const Rect<N, T> &bounds) const; // C dimension ordering
700
701#ifdef REALM_PROVIDE_ACCESSOR_TO_KOKKOS_VIEW_CONVERSION
702 // conversion to Kokkos unmanaged views
703
704 // Kokkos::View uses relative ("local") indexing - the first element is
705 // always index 0, even when accessing a subregion that does not include
706 // global element 0
707 template <typename... Args>
708 operator Kokkos::View<Args...>() const;
709
710 // Kokkos::Experimental::OffsetView uses absolute ("global") indexing -
711 // the indices used on the OffsetView::operator() match what is used for
712 // the AffineAccessor's operator[]
713 template <typename... Args>
714 operator Kokkos::Experimental::OffsetView<Args...>() const;
715#endif
716
717 // protected:
718 // friend
719 // std::ostream& operator<<(std::ostream& os, const AffineAccessor<FT,N,T>& a);
720// #define REALM_ACCESSOR_DEBUG
721#if defined(REALM_ACCESSOR_DEBUG) || defined(REALM_USE_KOKKOS)
722 Rect<N, T> bounds;
723#endif
724#ifdef REALM_USE_KOKKOS
725 bool bounds_specified;
726#endif
727#ifdef REALM_ACCESSOR_DEBUG
728 RegionInstance dbg_inst;
729#if defined(__CUDACC__) || defined(__HIPCC__)
730#error "REALM_ACCESSOR_DEBUG macro for AffineAccessor not supported for GPU code"
731#endif
732#endif
733 uintptr_t base;
735
736 protected:
738 FT *get_ptr(const Point<N, T> &p) const;
739 };
740
741 template <typename FT, int N, typename T>
742 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
743 const AffineAccessor<FT, N, T> &a);
744
745 // a multi-affine accessor handles instances with multiple pieces, but only
746 // if all of them are affine
747 template <typename FT, int N, typename T = int>
749
750 template <typename FT, int N, typename T>
751 REALM_PUBLIC_API std::ostream &operator<<(std::ostream &os,
753
761 template <typename FT, int N, typename T>
763 public:
766
777 size_t subfield_offset = 0);
778
789 MultiAffineAccessor(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
790 size_t subfield_offset = 0);
791
794
798 MultiAffineAccessor &operator=(MultiAffineAccessor &&) noexcept = default;
799
800 static bool is_compatible(RegionInstance inst, FieldID field_id);
801 static bool is_compatible(RegionInstance inst, FieldID field_id,
802 const Rect<N, T> &subrect);
803
804 // used by constructors or can be called directly
806 void reset();
807 void reset(RegionInstance inst, FieldID field_id, size_t subfield_offset = 0);
808 void reset(RegionInstance inst, FieldID field_id, const Rect<N, T> &subrect,
809 size_t subfield_offset = 0);
810
812
819 FT *ptr(const Point<N, T> &p) const;
821 FT *ptr(const Rect<N, T> &r, size_t strides[N]) const;
823 FT read(const Point<N, T> &p) const;
825 void write(const Point<N, T> &p, FT newval) const;
827
829 FT &operator[](const Point<N, T> &p) const;
830
832 FT *ptr(const Point<N, T> &p);
834 FT *ptr(const Rect<N, T> &r, size_t strides[N]);
836 FT read(const Point<N, T> &p);
838 void write(const Point<N, T> &p, FT newval);
839
841 FT &operator[](const Point<N, T> &p);
842
843 protected:
844 friend std::ostream &operator<< <FT, N, T>(std::ostream &os,
845 const MultiAffineAccessor<FT, N, T> &a);
846
847 // cached info from the most recent piece, or authoritative info for
848 // a single piece
849 bool piece_valid;
850 Rect<N, T> piece_bounds;
851 uintptr_t piece_base;
852 Point<N, size_t> piece_strides;
853 // if we need to do a new lookup, this is where we start
854 const PieceLookup::Instruction *start_inst;
855 size_t field_offset;
856 };
857
858}; // namespace Realm
859
860#include "realm/inst_layout.inl"
861
862#endif // ifndef REALM_INST_LAYOUT_H
Definition inst_layout.h:487
AccessorRefHelper(const AccessorRefHelper &)=default
AccessorRefHelper(AccessorRefHelper &&) noexcept=default
AccessorRefHelper(RegionInstance _inst, size_t _offset)
Definition inst_layout.h:593
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:734
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:733
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:315
static Serialization::PolymorphicSerdezSubclass< InstanceLayoutPiece< N, T >, AffineLayoutPiece< N, T > > serdez_subclass
Definition inst_layout.h:343
static InstanceLayoutPiece< N, T > * deserialize_new(S &deserializer)
size_t offset
Definition inst_layout.h:349
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:348
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:517
const InstanceLayoutPiece< N, T > * prev_piece
Definition inst_layout.h:573
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:569
size_t rel_offset
Definition inst_layout.h:571
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:570
Definition inst_layout.h:70
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:72
std::vector< FieldGroup > field_groups
Definition inst_layout.h:90
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:88
InstanceLayoutConstraints(const std::vector< size_t > &field_sizes, size_t block_size)
Definition inst_layout.h:162
std::map< FieldID, FieldLayout > FieldMap
Definition inst_layout.h:226
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:227
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:215
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:216
Definition inst_layout.h:240
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:265
PieceLayoutTypes::LayoutType layout_type
Definition inst_layout.h:280
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:288
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:302
Definition inst_layout.h:389
IndexSpace< N, T > space
Definition inst_layout.h:420
static InstanceLayoutGeneric * deserialize_new(S &deserializer)
std::vector< int > preferred_dim_order
Definition inst_layout.h:424
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:421
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:428
virtual ~InstanceLayout(void)
virtual void print(std::ostream &os) const
bool serialize(S &serializer) const
Definition inst_layout.h:357
InstancePieceList(InstancePieceList &&) noexcept=default
InstancePieceList & operator=(const InstancePieceList &)=default
InstancePieceList(const InstancePieceList &)=default
Definition inst_layout.h:762
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:95
virtual ~CompiledProgram()
Definition inst_layout.h:97
std::map< FieldID, PerField > fields
Definition inst_layout.h:113
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:255
unsigned char Opcode
Definition inst_layout.h:119
Definition activemsg.h:42
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:85
bool fixed_offset
Definition inst_layout.h:83
FieldID field_id
Definition inst_layout.h:82
size_t offset
Definition inst_layout.h:84
size_t alignment
Definition inst_layout.h:86
Definition inst_layout.h:220
int list_idx
Definition inst_layout.h:221
int size_in_bytes
Definition inst_layout.h:223
size_t rel_offset
Definition inst_layout.h:222
Definition point.h:230
Definition inst_layout.h:446
uintptr_t base
Definition inst_layout.h:455
Rect< N, T > bounds
Definition inst_layout.h:454
AffinePiece(unsigned next_delta)
Point< N, size_t > strides
Definition inst_layout.h:456
REALM_CUDA_HD const Instruction * next() const
REALM_CUDA_HD unsigned delta() const
uintptr_t field_offset
Definition inst_layout.h:110
unsigned inst_usage_mask
Definition inst_layout.h:109
const PieceLookup::Instruction * start_inst
Definition inst_layout.h:108
Definition inst_layout.h:129
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:134
Definition inst_layout.h:463
T split_plane
Definition inst_layout.h:475
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