-
Notifications
You must be signed in to change notification settings - Fork 10
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
Automatic Int precision and stencil regeneration change #104
base: develop
Are you sure you want to change the base?
Conversation
…uld remove the need for i32/i64 declaration (although their functionality is still retained) and replace both with the regular Int type
ndsl/dsl/typing.py
Outdated
|
||
|
||
def global_set_floating_point_precision(): | ||
def global_set_precision(): | ||
"""Set the global floating point precision for all reference | ||
to Float in the codebase. Defaults to 64 bit.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update docstring
to Float in the codebase. Defaults to 64 bit.""" | ||
global Float | ||
precision_in_bit = floating_point_precision() | ||
def global_set_precision(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- def global_set_precision():
+ def global_set_precision() -> type:
elif precision_in_bit == 32: | ||
return NDSL_32BIT_FLOAT_TYPE | ||
return NDSL_32BIT_FLOAT_TYPE, NDSL_32BIT_INT_TYPE | ||
else: | ||
NotImplementedError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NotImplementedError( | |
raise NotImplementedError( |
While you are in the vicinity can you also had specialization type for |
Added a feature to automatically determine the precision of an integer based on the global precision of the stencil. retained functionality of i32/i64, but now raises an error if an integer of the incorrect precision is passed to the stencil. In short:
Int/i32/i64
should now behave identically toFloat/f32/f64
.Changed the default value of
rebuild
from True to False for _get_factories. This alleviates a problem of unmodified stencils being recompiled when they are called from a subclass.