Skip to content
Snippets Groups Projects
Commit 731fbc91 authored by Rafael Ravedutti's avatar Rafael Ravedutti
Browse files

Add static arrays declaration on GPU constant memory

parent a3e7154a
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,16 @@ class CGen:
self.print("")
self.print("using namespace pairs;")
self.print("")
if self.target.is_gpu():
for array in self.sim.arrays.statics():
if array.device_flag:
t = array.type()
tkw = Types.ctype2keyword(t)
size = self.generate_expression(BinOp.inline(array.alloc_size()))
self.print(f"__constant__ {tkw} d_{array.name()}[{size}];")
self.print("")
for module in self.sim.modules():
self.generate_module(module)
self.print.end()
......
......@@ -27,6 +27,9 @@ class Arrays:
def all(self):
return self.arrays
def statics(self):
return [a for a in self.arrays if a.is_static()]
def find(self, a_name):
array = [a for a in self.arrays if a.name() == a_name]
if array:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment