Skip to content
Snippets Groups Projects

Add type conversion for SP types

Closed Markus Holzer requested to merge holzer/pystencils:FixDatatypes into master
1 unresolved thread

If Assignments are already typed for double-precision but the kernel is created for single-precision the assignments should be adapted.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Michael Kuron
    Michael Kuron @kuron started a thread on the diff
    Last updated by Markus Holzer
    1101 1101 move_constants_before_loop(function_node.body)
    1102 1102 cleanup_blocks(function_node.body)
    1103 1103
    1104 def replace_data_type_of_typed_symbols(assignments, data_type):
    1105 """changes the data types of the lhs of assignments which are already specified as TypedSymbol. This is needed
    1106 if the Assignments are already typed to double but the kernel is created for single precision"""
    1107 for i, assignment in enumerate(assignments):
    1108 if type(assignment.lhs) is TypedSymbol and assignment.lhs.dtype != data_type:
    1109 assignments[i] = Assignment(TypedSymbol(assignments[i].lhs.name, data_type), assignments[i].rhs)
    • The general concept is good. But your current solution fails when there are Blocks or Conditionals in the list of assignments. Better iterate over assignments.atoms(TypedSymbol).

      Also, please only change the data type when it's double or float. Do not change it if it's int.

    • Ok, thanks for the review. Sounds good, I will adapt the implementation this day.

    • Please register or sign in to reply
  • Michael Kuron mentioned in merge request lbmpy!69 (merged)

    mentioned in merge request lbmpy!69 (merged)

  • Closed because this change might introduce too many bugs.

  • closed

Please register or sign in to reply