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

support aborting on cache miss #828

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions loopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,9 @@ def register_symbol_manglers(kernel, manglers):
and
"CG_NO_CACHE" not in os.environ)

from pytools import strtobool
ABORT_ON_CACHE_MISS = strtobool(os.environ.get("LOOPY_ABORT_ON_CACHE_MISS", "False"))


def set_caching_enabled(flag):
"""Set whether :mod:`loopy` is allowed to use disk caching for its various
Expand Down
5 changes: 4 additions & 1 deletion loopy/codegen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ def generate_code_v2(program):

# {{{ cache retrieval

from loopy import CACHING_ENABLED
from loopy import CACHING_ENABLED, ABORT_ON_CACHE_MISS

if CACHING_ENABLED:
input_program = program
Expand All @@ -583,6 +583,9 @@ def generate_code_v2(program):
" code generation cache hit")
return result
except KeyError:
if ABORT_ON_CACHE_MISS:
raise

logger.debug(f"TranslationUnit with entrypoints {program.entrypoints}:"
" code generation cache miss")

Expand Down
Loading