@@ -90,16 +90,18 @@ class Array(ArrayBasic):
90
90
to 'local'. Used to override `_mem_local` and `_mem_mapped`.
91
91
scope : str, optional
92
92
The scope in the given memory space. Allowed values: 'heap', 'stack',
93
- 'static', 'constant', 'shared', 'shared-remote'. 'static' refers to a
94
- static array in a C/C++ sense. 'constant' and 'shared' mean that the
95
- Array represents an object allocated in so called constant and shared
96
- memory, respectively, which are typical of device architectures. If
97
- 'shared' is specified but the underlying architecture doesn't have
98
- something akin to shared memory, the behaviour is unspecified. If
99
- 'constant' is specified but the underlying architecture doesn't have
100
- something akin to constant memory, the Array falls back to a global,
101
- const, static array in a C/C++ sense. Note that not all scopes make
102
- sense for a given space.
93
+ 'static', 'constant', 'shared', 'shared-remote', 'registers'.
94
+ 'static' refers to a static array in a C/C++ sense. 'constant' and
95
+ 'shared' mean that the Array represents an object allocated in so
96
+ called constant and shared memory, respectively, which are typical of
97
+ device architectures. If 'shared' is specified but the underlying
98
+ architecture doesn't have something akin to shared memory, the
99
+ behaviour is unspecified. If 'constant' is specified but the underlying
100
+ architecture doesn't have something akin to constant memory, the Array
101
+ falls back to a global, const, static array in a C/C++ sense.
102
+ 'registers' is used to indicate that the Array has a small static size
103
+ and, as such, it could be allocated in registers. Defaults to 'heap'.
104
+ Note that not all scopes make sense for a given space.
103
105
grid : Grid, optional
104
106
Only necessary for distributed-memory parallelism; a Grid contains
105
107
information about the distributed Dimensions, hence it is necessary
@@ -133,7 +135,7 @@ def __init_finalize__(self, *args, **kwargs):
133
135
134
136
self ._scope = kwargs .get ('scope' , 'heap' )
135
137
assert self ._scope in ['heap' , 'stack' , 'static' , 'constant' , 'shared' ,
136
- 'shared-remote' ]
138
+ 'shared-remote' , 'registers' ]
137
139
138
140
self ._initvalue = kwargs .get ('initvalue' )
139
141
assert self ._initvalue is None or self ._scope != 'heap'
@@ -166,7 +168,7 @@ def _C_ctype(self):
166
168
167
169
@property
168
170
def _mem_stack (self ):
169
- return self ._scope in ('stack' , 'shared' )
171
+ return self ._scope in ('stack' , 'shared' , 'registers' )
170
172
171
173
@property
172
174
def _mem_heap (self ):
@@ -180,6 +182,10 @@ def _mem_shared(self):
180
182
def _mem_shared_remote (self ):
181
183
return self ._scope == 'shared-remote'
182
184
185
+ @property
186
+ def _mem_registers (self ):
187
+ return self ._scope == 'registers'
188
+
183
189
@property
184
190
def _mem_constant (self ):
185
191
return self ._scope == 'constant'
0 commit comments