Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize kernel mode for hybrid QNN test case #1572

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions python/cudaq/kernel/kernel_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,24 @@ def compile(self):
# variables from the parent frame that we captured
# have not changed. If they have changed, we need to
# recompile with the new values.
for i, s in enumerate(inspect.stack()):
if s.frame == self.parentFrame:
s = inspect.currentframe()
while s:
if s == self.parentFrame:
# We found the parent frame, now
# see if any of the variables we depend
# on have changed.
self.globalScopedVars = {
k: v for k, v in dict(inspect.getmembers(s.frame))
['f_locals'].items()
k: v
for k, v in dict(inspect.getmembers(s))['f_locals'].items()
}
if self.dependentCaptures != None:
for k, v in self.dependentCaptures.items():
if self.globalScopedVars[k] != v:
# Need to recompile
self.module = None
break
break
s = s.f_back

if self.module != None:
return
Expand Down
Loading