-
Notifications
You must be signed in to change notification settings - Fork 133
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
f32 is not infered on basic mult #1493
Comments
A follow up bug is that even if
|
The quick fix for anyone wanting to go ahead with a PR is to amend line 3289 in frontend/python/newast as follows: elif (not result_data.transient or result in self.sdfg.constants_prop or
(dtype is not None and dtype != result_data.dtype)): This will fix the "bug," but I expect it to be an unsatisfying solution, as it will generate an extraneous and seemingly "unremovable" (by the simplification pass) Tasklet that copies the float64 result of the operation Fundamentally, there are two main issues. The first is that annotated assignments are not very compatible with the DaCe Python frontend. For simplicity, the frontend parses the RHS separately from the LHS. Therefore, the datatype of the RHS is decided by whatever Python/NumPy rules are coded in the frontend. If the datatype of the LHS is different, then we don't go back to change how the RHS is computed. Instead, we add another Tasklet. The reason we don't go back is the second issue: whenever the datatypes of the operands do not agree, we do explicit conversion in the Tasklet code, which is a string and, therefore, not particularly easy to update. A very good example can be seen in the reported issue. In the multiplication It is not a quick fix, but we could amend the frontend to pass annotated assignment information to the visitor methods handling the RHS. The awkward conversions will still be there, but the compiler may be able to optimize them away. However, I think explicit conversion in the Tasklet code is a band-aid for the lack of a better design, as this is code-generation functionality. We should consider a better mechanism in the future. Regarding the follow-up issue, I suspect the edited SDFG already had the connector datatypes set. In other words, the |
Between your explanation, shuffling code to be casted to I still believe this warrant further work but we have workable solution around. Right now, mixed precision is a required feature for weather and climate model, and it'll become even more important as the model run smaller and smaller resolutions. |
Consider this snippet:
SDFG & code generated (below) show
dt2
is consider a 64-bit float, despite the cast.SDFG (not a real zip, just going around GitHub) program.sdfg.zip
The text was updated successfully, but these errors were encountered: