8000 [HW] Debugging `test_examples_optimize` · Issue #410 · kaist-cp/cs420 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[HW] Debugging test_examples_optimize #410

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

Closed
jirheee opened this issue May 23, 2022 · 2 comments
Closed

[HW] Debugging test_examples_optimize #410

jirheee opened this issue May 23, 2022 · 2 comments
Assignees
Labels

Comments

@jirheee
Copy link
Collaborator
jirheee commented May 23, 2022

I finished all the given tests for optimization passes and trying to make my compiler work for test_examples_optimize.

But it seems like debugging to pass this test is almost impossible, since we cannot know which part of our optimization pass is malfunctioning. So I am currently trying to guess which optimization pass is not working just by the final output.

Can I ask for help in debugging this cases?

One idea is that if there is some kind of logging functionality in the kecc(like --log option) that writes the optimization result for each pass to the filesystem, I could better debug the optimizations.

@jirheee jirheee added the question Further information is requested label May 23, 2022
@hyn2028
Copy link
hyn2028 commented May 24, 2022

I also found and fixed bugs in my optimization process, thanks to the new addition of test_examples_optimize. I did it in a very iterative and labor intensive way. I'd like to have these features too.

@jirheee
Copy link
Collaborator Author
jirheee commented May 25, 2022

I made a simple shell script for debugging -O1 optimization!

It just runs the kecc in simplify-cfg mem2reg gvn deadcode order until there is no change.

You can just run this script at the root directory then it will log the intermediate results in logs/[current date]/[current time] directory as below:

logs/220525/21:03:17/
├── alignof.ir
│   ├── final.ir
│   ├── final_diff.txt
│   ├── trial_0
│   │   └── deadcode.ir
│   ├── trial_1
│   │   ├── deadcode.ir
│   │   ├── deadcode_stderr.txt
│   │   ├── deadcode_stdout.txt
│   │   ├── diff.txt
│   │   ├── gvn.ir
│   │   ├── gvn_stderr.txt
│   │   ├── gvn_stdout.txt
│   │   ├── mem2reg.ir
│   │   ├── mem2reg_stderr.txt
│   │   ├── mem2reg_stdout.txt
│   │   ├── simplify-cfg.ir
│   │   ├── simplify-cfg_stderr.txt
│   │   ├── simplify-cfg_stdout.txt
│   │   └── start.ir
│   └── trial_2
│       ├── deadcode.ir
│       ├── deadcode_stderr.txt
│       ├── deadcode_stdout.txt
│       ├── diff.txt
│       ├── gvn.ir
│       ├── gvn_stderr.txt
│       ├── gvn_stdout.txt
│       ├── mem2reg.ir
│       ├── mem2reg_stderr.txt
│       ├── mem2reg_stdout.txt
│       ├── simplify-cfg.ir
│       ├── simplify-cfg_stderr.txt
│       ├── simplify-cfg_stdout.txt
│       └── start.ir
...

The code is little dirty and slow since it is not integrated into the test code directly, but I think it is enough for just debugging this test.

I hope this helps other classmates debug the optimizattions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
0