Skip to content

Feat: add fdiv constant folding support and enhance mapping debug info#185

Merged
YanzhouTang merged 5 commits intocoredac:mainfrom
YanzhouTang:render
Nov 5, 2025
Merged

Feat: add fdiv constant folding support and enhance mapping debug info#185
YanzhouTang merged 5 commits intocoredac:mainfrom
YanzhouTang:render

Conversation

@YanzhouTang
Copy link
Copy Markdown
Collaborator

Summary

In this PR, we add constant folding support for fdiv, and enhance some debug info during mapping.

The mapping info after each attempt of II now is organized with table like below (take II = 5 for example):

Tile    | t%5=0                              | t%5=1                              | t%5=2                              | t%5=3                              | t%5=4                              | 
--------+------------------------------------+------------------------------------+------------------------------------+------------------------------------+------------------------------------+
Tile#0   |                                     |                                     | %31 = grant_predicate(%29, %30) (t=7) |                                     |                                     | 
Tile#4   |                                     | %11 = grant_once(%10) (t=6)         |                                     |                                     |                                     | 
Tile#8   | %9 = fdiv(%8) (t=5)                 | %53 = load_indexed(%52) (t=6)       | %3 = grant_once                     |                                     |                                     | 
Tile#9   | %51 = phi(%49, %50) (t=5)           | %136 = add(%135) (t=6)              |                                     |                                     | %25 = grant_predicate(%23, %24)     | 
Tile#10  |                                     | %17 = icmp(%16)                     |                                     |                                     |                                     | 
Tile#11  | %1 = constant                       |                                     | %19 = grant_once(%18)               |                                     |                                     | 
Tile#12  | %5 = fdiv(%4) (t=5)                 | %7 = grant_once(%6) (t=6)           | %55 = sext(%54) (t=7)               | %65 = load_indexed(%64) (t=8)       | %2 = constant                       | 
Tile#13  | %59 = load_indexed(%58) (t=10)      | %13 = fdiv(%12) (t=6)               | %28 = grant_predicate(%26, %27) (t=7) | %63 = load_indexed(%62) (t=8)       |                                     | 
Tile#14  |                                     |                                     | %15 = grant_once(%14) (t=7)         |                                     |                                     | 

Each cell shows the operation and operands and corresponding mapping time so that we can easily check mapping status using modular scheduling.

Copy link
Copy Markdown
Contributor

@tancheng tancheng left a comment

Choose a reason for hiding this comment

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

Can we also have a test to check the dumpped (beautified) log?

@YanzhouTang
Copy link
Copy Markdown
Collaborator Author

YanzhouTang commented Nov 5, 2025

Can we also have a test to check the dumpped (beautified) log?

Add dump-mapping-table parameter in --map-to-accelerator PASS, if it is true, we'll dump successful mapping status table. An example can be found in test/c2llvm2mlir/simple_loop/test.mlir

Also name the below constants as constexpr

@YanzhouTang YanzhouTang merged commit 2a92ac7 into coredac:main Nov 5, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants