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

transformations: (convert-snrt-to-riscv) Add lowerings for even more info ops #2428

Merged
merged 3 commits into from
May 13, 2024

Conversation

AntonLydike
Copy link
Collaborator

Missing ops:

  • snrt.global_compute_core_idx
  • snrt.global_compute_core_num
  • snrt.global_dm_core_num
  • snrt.cluster_compute_core_idx
  • snrt.cluster_dm_core_idx

These seem to be relatively unused in practice and are skipped for now.

@AntonLydike AntonLydike added the transformations Changes or adds a transformatio label Apr 4, 2024
@AntonLydike AntonLydike self-assigned this Apr 4, 2024
@AntonLydike
Copy link
Collaborator Author

The is_dm_core and is_compute_core return values have been changed to i1 from i32 such that they can be used as conditionals without further hassle

Copy link

codecov bot commented Apr 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.65%. Comparing base (81fc104) to head (26d847d).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2428      +/-   ##
==========================================
- Coverage   89.77%   89.65%   -0.13%     
==========================================
  Files         354      357       +3     
  Lines       44705    45156     +451     
  Branches     6704     6788      +84     
==========================================
+ Hits        40136    40486     +350     
- Misses       3592     3651      +59     
- Partials      977     1019      +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AntonLydike
Copy link
Collaborator Author

This also adds some stuff that uses compile time constants in the snitch repo in the SnrtConstants dataclass

@compor compor self-requested a review April 4, 2024 14:55
Copy link
Collaborator

@JosseVanDelm JosseVanDelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but it seems a bit arbitrary to only give the cluster number as a parameter to this pass?
Can you also add some more documentation to the pass arguments?

"""

SNRT_CLUSTER_NUM: int
SNRT_CLUSTER_CORE_NUM: int = 9 # TODO: is this correct?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

):
rewriter.replace_matched_op(
[
nfo := riscv.LiOp(self.constants.SNRT_BASE_HARTID),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be info?

class ConvertSnrtToRISCV(ModulePass):
name = "convert-snrt-to-riscv"

cluster_num: int
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstring!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added!

@superlopuh
Copy link
Member

Is there any way you could split this up?

@AntonLydike
Copy link
Collaborator Author

Looks good, but it seems a bit arbitrary to only give the cluster number as a parameter to this pass? Can you also add some more documentation to the pass arguments?

I felt at the time that the cluster number is the only "real" variable part, but thinking about it more, snax has different counts for dm and compute cores...

@JosseVanDelm
Copy link
Collaborator

I felt at the time that the cluster number is the only "real" variable part, but thinking about it more, snax has different counts for dm and compute cores...

To me it seems more logical if you keep all of these being defined as constants for the time being instead of any particular one being targettable.
Adding a proper parser for these options is probably a bit overkill and would introduce new dependencies on hjson/mako (?)

@AntonLydike AntonLydike force-pushed the anton/snrt_more_lowerings branch from 8bba923 to 0e31ef2 Compare May 10, 2024 13:58
AntonLydike added a commit that referenced this pull request May 10, 2024
(hopefully) smaller version of #2428 stripped of all the more complex
lowerings introduced in that PR
Missing ops:
- snrt.global_compute_core_idx
- snrt.global_compute_core_num
- snrt.global_dm_core_num
- snrt.cluster_compute_core_idx
- snrt.cluster_dm_core_idx

These seem to be relatively unused in practice and are skipped for now
@AntonLydike AntonLydike force-pushed the anton/snrt_more_lowerings branch from 0e31ef2 to 930d009 Compare May 10, 2024 15:39
@AntonLydike
Copy link
Collaborator Author

After merging #2559, this PR should be reviewable now @superlopuh

@AntonLydike
Copy link
Collaborator Author

This PR now adds these 5 operations, each to a bit more complex set of operations:

  • snrt.cluster_idx
  • snrt.cluster_core_idx
  • snrt.global_core_idx
  • snrt.is_compute_core
  • snrt.is_dm_core

@AntonLydike AntonLydike requested a review from JosseVanDelm May 10, 2024 15:43
@AntonLydike AntonLydike changed the title transformations: (convert-snrt-to-riscv) Add lowerings for almost all info ops transformations: (convert-snrt-to-riscv) Add lowerings for even more info ops May 10, 2024
@@ -536,6 +675,8 @@ class ConvertSnrtToRISCV(SnrtConstants, ModulePass):

name = "convert-snrt-to-riscv"

cluster_num: int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cluster_num: int

@AntonLydike AntonLydike merged commit ad73bdb into main May 13, 2024
10 checks passed
@AntonLydike AntonLydike deleted the anton/snrt_more_lowerings branch May 13, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
transformations Changes or adds a transformatio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants